[SQL] Compile SQL window ROWS queries to RANGE (ROW_NUMBER)#6613
Merged
Conversation
ROWS queries to RANGE (ROW_NUMBER)
Contributor
Author
|
Most of the changes are just new tests. |
mihaibudiu
commented
Jul 10, 2026
| </tr> | ||
| </table> | ||
|
|
||
| :::warning Potential inefficiency |
Contributor
Author
There was a problem hiding this comment.
This paragraph was moved down in the file
gz
approved these changes
Jul 15, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 15, 2026
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
mihaibudiu
enabled auto-merge
July 15, 2026 20:58
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.
This PR implements support for window queries like
Previously we only supported
RANGEqueries, but notROWSqueries.There is no native DBSP operator that implements
ROWS BETWEEN, so this is done by rewriting the SQL to first compute aROW_NUMBERfor each partition and use that in evaluating theBETWEENclause using aRANGEquery. This rewrite is done purely at the Calcite level.ROW_NUMBERis not the most efficient operator, so this many not work great for all use cases. It is still TBD whether native support forROWScan do better.With this change we support all 100 TPC-DS queries.
Fixes #5908
Describe Manual Test Plan
Ran java tests manually.
Checklist