GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||
GeezerVison is showing github.com — DuckDB: support the ==, ** and ~~ operators and chained signs by guizmaii · Pull Request #2795 · JSQLParser/JSqlParser Conversation
|
| Input | Before | After |
|---|---|---|
a == b |
error | EqualsTo, spelled == |
2 * 3 ** 2 |
error | Multiplication(2, Exponentiation(3, 2)) |
a ~~ 'x' |
RegExpMatchOperator(a, ~'x') (wrong tree) |
LikeExpression LIKE, spelled ~~ |
a !~~* 'x' |
wrong tree | LikeExpression NOT ILIKE, spelled !~~* |
a ~~~ 'x*' |
error | LikeExpression GLOB |
- -1, +-+1, ~ ~a |
error | nested SignedExpression |
Exponentiation is a new BinaryExpression; ExpressionVisitor.visit(Exponentiation) is a default method, so existing visitors keep compiling. Its precedence matches DuckDB: above *, left-associative, below the unary sign (-2 ** 2 = 4). ^ stays BitwiseXor at the level of *, so 2^3**2 still differs from DuckDB's power ^.LikeExpression.setLikeOperator sets the keyword and NOT from the operator; the operator spelling is then derived from them, so later setNot/setLikeKeyWord calls print consistently (falling back to the keyword form, e.g. for NOT GLOB).~, or both are -: - -1 must not deparse as the comment --1, nor - ~1 / ~ ~a as the single operators -~ / ~~.a ~~b and a !~~b used to parse as a regular expression match against ~b; they are now LIKE / NOT LIKE, as in PostgreSQL and DuckDB. Unspaced ~~a failed before and still does.// (lexed as a Snowflake line comment), ^@ and postfix a NOT NULL.checkGrammarAmbiguity: no conflicts. ./gradlew check: 10,121 tests, 0 failures.test/sql, 70,729 statements): 199 more parse, none less.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please resolve conflicts. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0b2a6d0 to
d79008a
Compare
- `a == b` is `EqualsTo` with the `==` spelling. - `a ** b` is the new `Exponentiation`, above the multiplicative operators and left-associative, as in DuckDB. - `~~`, `~~*`, `~~~`, `!~~` and `!~~*` are `LIKE`, `ILIKE`, `GLOB` and their negations, kept as written. `a ~~ 'x'` used to parse as the regular expression match `a ~ (~'x')`. - `- -1`, `+-+1` and `~ ~a` nest signs. A sign is separated from an operand starting with the same sign so that `- -1` does not deparse as the comment `--1`, nor `~ ~a` as `~~a`.
- The `~~` spelling is now derived from the keyword and `NOT`, so `setNot` or `setLikeKeyWord` no longer leave a stale operator, and `PRIOR` and `BINARY` are printed with it. `!~~~` and `null` are rejected. - A sign is also separated from an operand when either is `~`: DuckDB and PostgreSQL read `-~1` as one unknown operator. - `**` is the `OP_POWER` token; the `MulChain` alternative was never reached. - `visit(Exponentiation)` is a default method, so existing `ExpressionVisitor` implementations keep compiling.
d79008a to
8523ca9
Compare
There was an error while loading. Please reload this page.
|
Thank you! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.