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 QUALIFY after WINDOW, OVER (w ...) and FILTER without WHERE by guizmaii · Pull Request #2803 · JSQLParser/JSqlParser

Conversation

@guizmaii

@guizmaii guizmaii commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

For DuckDB's window and aggregate syntax (window functions, QUALIFY, FILTER).

Input Before After
... WINDOW w AS (ORDER BY a) QUALIFY row_number() OVER w = 1 error QUALIFY printed after WINDOW (isQualifyAfterWindow())
sum(a) OVER (w ROWS 2 PRECEDING), WINDOW w2 AS (w ORDER BY b) error WindowDefinition.getBaseWindowName() = w
sum(a) FILTER (b > 1) error AnalyticExpression.isFilterWhereKeyword() = false
  • DuckDB requires WINDOW before QUALIFY and BigQuery the reverse, so PlainSelect records the order it was written in.
  • The base window name is recognised when the first token of the specification is not PARTITION, ORDER, ROWS, RANGE or GROUPS, so frames such as OVER (rows BETWEEN ...) are unchanged.
  • FILTER without WHERE is rejected under Dialect.POSTGRESQL, which requires it (OrderedSetFilterTest unchanged).
  • All new inputs were errors in every dialect; on ~9,760 statements extracted from this repository's tests, results are identical to master.
  • Not included: DuckDB's GROUP BY a, GROUPING SETS (...) mixes, which GroupByElement's separate lists cannot represent in order.
  • checkGrammarAmbiguity: no conflicts. ./gradlew check: 10,118 tests, 0 failures.
  • DuckDB's own test suite (test/sql, 70,729 statements): 26 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 09:59
Copilot AI balanced review requested due to automatic review settings October 13, 2026 09:59
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 conflict.

All reactions

Sorry, something went wrong.

Uh oh!

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

@guizmaii
guizmaii force-pushed the duckdb-window-grouping branch 2 times, most recently from e1d2f66 to 2f3123b Compare October 13, 2026 12:49
@hayssams

hayssams commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Nice

All reactions

Sorry, something went wrong.

Uh oh!

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

@guizmaii
guizmaii force-pushed the duckdb-window-grouping branch 2 times, most recently from 91825c0 to cd8889c Compare October 13, 2026 22:02
@manticore-projects

manticore-projects commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

please resolve conflict.

All reactions

Sorry, something went wrong.

Uh oh!

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

@guizmaii
guizmaii force-pushed the duckdb-window-grouping branch from cd8889c to 6a340be Compare October 13, 2026 22:27
@guizmaii

guizmaii commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on master, conflicts resolved.

All reactions

Sorry, something went wrong.

Uh oh!

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

guizmaii added 2 commits October 14, 2026 09:28
@guizmaii
DuckDB: support QUALIFY after WINDOW, OVER (w ...) and FILTER without…
ed3fb3a
… WHERE

- QUALIFY may follow the WINDOW clause and prints back there
  (`PlainSelect.isQualifyAfterWindow()`).
- A window specification may start with the name of the window it
  extends, `OVER (w ORDER BY b)`, also in WINDOW definitions
  (`WindowDefinition.getBaseWindowName()`).
- `FILTER (b > 1)` without WHERE is accepted except under the
  PostgreSQL dialect (`AnalyticExpression.isFilterWhereKeyword()`).
@guizmaii
Keep window specifications parseable inside lookahead
70e67f4
- The base window name is a choice rather than an optional, so that
  lookahead scans through a window specification keep its check:
  `JSON_VALUE(... DEFAULT sum(a) OVER (PARTITION BY b) ON EMPTY)` parses
  again.
- Only an OVER window may extend a named window, not WITHIN GROUP.
- QUALIFY after WINDOW requires a WINDOW clause.
@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-window-grouping branch from 6a340be to 70e67f4 Compare October 13, 2026 22:31
@guizmaii

guizmaii commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on master again (after #2801), conflicts resolved.

All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects
manticore-projects merged commit 7dcdeec into JSQLParser:master Oct 13, 2026
9 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 very much!

All reactions

Sorry, something went wrong.

Uh oh!

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

@guizmaii

guizmaii commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@manticore-projects Thanks for reviewing and merging my PRs!

Do you mind releasing a new version, please?

All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects

manticore-projects commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

@manticore-projects Thanks for reviewing and merging my PRs!

Do you mind releasing a new version, please?

Certainly: pkg:maven/com.manticore-projects.jsqlformatter/[email protected]

And thank you for all your work and contributions! I do appreciate you.

guizmaii reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

@guizmaii
guizmaii deleted the duckdb-window-grouping branch October 22, 2026 23:12
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.

4 participants

@guizmaii @manticore-projects @hayssams
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.