Repository navigation
DuckDB: support QUALIFY after WINDOW, OVER (w ...) and FILTER without WHERE - #2803
Merged
manticore-projects merged 2 commits intoOct 13, 2026
Merged
Conversation
guizmaii
marked this pull request as ready for review
October 13, 2026 09:59
27 tasks
Contributor
|
please resolve conflict. |
guizmaii
force-pushed
the
duckdb-window-grouping
branch
2 times, most recently
from
October 13, 2026 12:49
e1d2f66 to
2f3123b
Compare
Contributor
|
Nice |
guizmaii
force-pushed
the
duckdb-window-grouping
branch
2 times, most recently
from
October 13, 2026 22:02
91825c0 to
cd8889c
Compare
Contributor
|
please resolve conflict. |
guizmaii
force-pushed
the
duckdb-window-grouping
branch
from
October 13, 2026 22:27
cd8889c to
6a340be
Compare
Contributor
Author
|
Rebased on master, conflicts resolved. |
… 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()`).
- 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.
Contributor
|
Please resolve conflicts. |
guizmaii
force-pushed
the
duckdb-window-grouping
branch
from
October 13, 2026 22:31
6a340be to
70e67f4
Compare
Contributor
Author
|
Rebased on master again (after #2801), conflicts resolved. |
Contributor
|
Thank you very much! |
Contributor
Author
|
@manticore-projects Thanks for reviewing and merging my PRs! Do you mind releasing a new version, please? |
Contributor
Certainly: pkg:maven/com.manticore-projects.jsqlformatter/jsqlparser@5.4.162 And thank you for all your work and contributions! I do appreciate you. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For DuckDB's window and aggregate syntax (window functions, QUALIFY, FILTER).
... WINDOW w AS (ORDER BY a) QUALIFY row_number() OVER w = 1isQualifyAfterWindow())sum(a) OVER (w ROWS 2 PRECEDING),WINDOW w2 AS (w ORDER BY b)WindowDefinition.getBaseWindowName()=wsum(a) FILTER (b > 1)AnalyticExpression.isFilterWhereKeyword()= falsePlainSelectrecords the order it was written in.OVER (rows BETWEEN ...)are unchanged.Dialect.POSTGRESQL, which requires it (OrderedSetFilterTestunchanged).GROUP BY a, GROUPING SETS (...)mixes, whichGroupByElement's separate lists cannot represent in order.checkGrammarAmbiguity: no conflicts../gradlew check: 10,118 tests, 0 failures.test/sql, 70,729 statements): 26 more parse, none less.