-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(over window): fix over window predicate pushdown #13662
Merged
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b24f20e
fix: only pushdown irrelevant conjunctions
stdrc 26c7e55
test: update planner test
stdrc 825882c
chore: rename slt folder
stdrc 0ece269
fix: fix over_window_to_topn_rule reaching unreachable code
stdrc 6de8334
chore: renaming
stdrc 9a78a14
test: add e2e test for over window predicate pushdown
stdrc 30f1fd6
fix: only pushdown partition by cols
stdrc 0b0b227
test: update planner tests
stdrc 5136be1
test: fix e2e
stdrc cf4587b
fix
stdrc e245458
Merge branch 'main' into rc/fix-over-window-predicate-pushdown
stdrc dff9536
Merge branch 'main' into rc/fix-over-window-predicate-pushdown
stdrc eb5765b
Merge branch 'main' into rc/fix-over-window-predicate-pushdown
stdrc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
e2e_test/over_window/generated/batch/with_filter/mod.slt.part
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This file is generated by `gen.py`. Do not edit it manually! | ||
|
||
# Test window functions together with filters. | ||
# https://github.com/risingwavelabs/risingwave/issues/13653 | ||
|
||
statement ok | ||
create table t (id int, cat varchar, rule varchar, at timestamptz); | ||
|
||
statement ok | ||
insert into t values | ||
(1, 'foo', 'A', '2023-11-23T12:00:42Z') | ||
, (2, 'foo', 'B', '2023-11-23T12:01:15Z'); | ||
|
||
query TT | ||
select rule, lag(rule) over (partition by cat order by at) from t where rule = 'B'; | ||
---- | ||
B NULL | ||
|
||
query TT | ||
select * from (select rule, lag(rule) over (partition by cat order by at) as prev_rule from t) where rule = 'B'; | ||
---- | ||
B A | ||
|
||
query TT | ||
select * from (select rule, at, row_number() over (partition by cat order by at) as rank from t) where at = '2023-11-23T12:01:15Z'::timestamptz; | ||
---- | ||
B 2023-11-23 12:01:15+00:00 2 |
This file contains 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
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
e2e_test/over_window/generated/streaming/with_filter/mod.slt.part
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This file is generated by `gen.py`. Do not edit it manually! | ||
|
||
# Test window functions together with filters. | ||
# https://github.com/risingwavelabs/risingwave/issues/13653 | ||
|
||
statement ok | ||
create table t (id int, cat varchar, rule varchar, at timestamptz); | ||
|
||
statement ok | ||
insert into t values | ||
(1, 'foo', 'A', '2023-11-23T12:00:42Z') | ||
, (2, 'foo', 'B', '2023-11-23T12:01:15Z'); | ||
|
||
query TT | ||
select rule, lag(rule) over (partition by cat order by at) from t where rule = 'B'; | ||
---- | ||
B NULL | ||
|
||
query TT | ||
select * from (select rule, lag(rule) over (partition by cat order by at) as prev_rule from t) where rule = 'B'; | ||
---- | ||
B A | ||
|
||
query TT | ||
select * from (select rule, at, row_number() over (partition by cat order by at) as rank from t) where at = '2023-11-23T12:01:15Z'::timestamptz; | ||
---- | ||
B 2023-11-23 12:01:15+00:00 2 |
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Test window functions together with filters. | ||
# https://github.com/risingwavelabs/risingwave/issues/13653 | ||
|
||
statement ok | ||
create table t (id int, cat varchar, rule varchar, at timestamptz); | ||
|
||
statement ok | ||
insert into t values | ||
(1, 'foo', 'A', '2023-11-23T12:00:42Z') | ||
, (2, 'foo', 'B', '2023-11-23T12:01:15Z'); | ||
|
||
query TT | ||
select rule, lag(rule) over (partition by cat order by at) from t where rule = 'B'; | ||
---- | ||
B NULL | ||
|
||
query TT | ||
select * from (select rule, lag(rule) over (partition by cat order by at) as prev_rule from t) where rule = 'B'; | ||
---- | ||
B A | ||
|
||
query TT | ||
select * from (select rule, at, row_number() over (partition by cat order by at) as rank from t) where at = '2023-11-23T12:01:15Z'::timestamptz; | ||
---- | ||
B 2023-11-23 12:01:15+00:00 2 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Considering this case, even if we use a
id
which should be notover_window_related_cols
column, we should not push this filter through the over window.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.
Then it seems that we cannot push any predicate through over window.
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.
However, partition only related filter could be pushed down. For example
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.
Indeed.