Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nom-sql: Rework negative number parsing
Previously, we parsed negative numbers to be a UnaryOperator::Neg applied to a Literal. This was incompatible with our autoparameterization AST rewrite pass, which only replaced *Literals* with placeholders. To add support for the autoparameterization of negative literals, this commit updates the way we parse prefix negation in our expression pratt parser such that a negative sign applied to an integer, a float, or a double always produces a literal instead of a UnaryOperator. I considered just updating the autoparameterization rewrite pass to look for and replace `UnaryOperators::Neg`s applied to literals, but this would have meant having to evaluate the negative sign in our rewrite pass, which felt less correct than simplifying our representation of negative numbers in the AST. While doing this work, I discovered that we do not correctly evaluate `-1 = -1` for both MySQL and Postgres. This will be addressed in a follow-up commit. Release-Note-Core: Added support for the autoparamterization of negative numbers Change-Id: I8c11f3ad2d4c35d0f08c9eb4d7abc4684c21f4b1 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/6945 Tested-by: Buildkite CI Reviewed-by: Jason Brown <jason.b@readyset.io>
- Loading branch information
1 parent
658018d
commit a67c2f6
Showing
4 changed files
with
58 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters