GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DuckDB: support the ==, ** and ~~ operators and chained signs by guizmaii · Pull Request #2795 · JSQLParser/JSqlParser

Conversation

@guizmaii

@guizmaii guizmaii commented Oct 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

For DuckDB (operators, numeric, pattern matching).

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).
  • A sign is separated from an operand starting with a sign when either is ~, or both are -: - -1 must not deparse as the comment --1, nor - ~1 / ~ ~a as the single operators -~ / ~~.
  • Behaviour change: 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.
  • Not included: DuckDB's integer division // (lexed as a Snowflake line comment), ^@ and postfix a NOT NULL.
  • checkGrammarAmbiguity: no conflicts. ./gradlew check: 10,121 tests, 0 failures.
  • DuckDB's own test suite (test/sql, 70,729 statements): 199 more parse, none less.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@guizmaii
guizmaii marked this pull request as ready for review October 13, 2026 08:33
Copilot AI balanced review requested due to automatic review settings October 13, 2026 08:33
Copilot AI reviewed Oct 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@guizmaii guizmaii mentioned this pull request Oct 13, 2026
DuckDB: remaining syntax to support #2804
Open
27 tasks
@manticore-projects

manticore-projects commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Please resolve conflicts.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guizmaii
guizmaii force-pushed the duckdb-operators branch from 0b2a6d0 to d79008a Compare October 13, 2026 10:42
guizmaii added 2 commits October 13, 2026 23:39
@guizmaii
DuckDB: support the ==, ** and ~~ operators and chained signs
633641c
- `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`.
@guizmaii
Keep the operator spelling of LIKE in step with the model
8523ca9
- 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.
@guizmaii
guizmaii force-pushed the duckdb-operators branch from d79008a to 8523ca9 Compare October 13, 2026 12:41
@manticore-projects
manticore-projects merged commit fde4f03 into JSQLParser:master Oct 13, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@manticore-projects

manticore-projects commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ybai08 ybai08 mentioned this pull request Oct 17, 2026
fix: bind ^ tighter than *, / and % #2831
Merged
@guizmaii
guizmaii deleted the duckdb-operators branch October 22, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@guizmaii @manticore-projects
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.