-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(over window): fix over window predicate pushdown (#13662)
Signed-off-by: Richard Chien <[email protected]>
- Loading branch information
Showing
16 changed files
with
252 additions
and
46 deletions.
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.
51 changes: 51 additions & 0 deletions
51
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,51 @@ | ||
# 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'); | ||
|
||
statement ok | ||
create view v1 as | ||
select rule, lag(rule) over (partition by cat order by at) from t where rule = 'B'; | ||
|
||
statement ok | ||
create view v2 as | ||
select * from (select rule, lag(rule) over (partition by cat order by at) as prev_rule from t) where rule = 'B'; | ||
|
||
statement ok | ||
create view v3 as | ||
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; | ||
|
||
query TT | ||
select * from v1; | ||
---- | ||
B NULL | ||
|
||
query TT | ||
select * from v2; | ||
---- | ||
B A | ||
|
||
query TT | ||
select * from v3; | ||
---- | ||
B 2023-11-23 12:01:15+00:00 2 | ||
|
||
statement ok | ||
drop view v1; | ||
|
||
statement ok | ||
drop view v2; | ||
|
||
statement ok | ||
drop view v3; | ||
|
||
statement ok | ||
drop table t; |
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.
51 changes: 51 additions & 0 deletions
51
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,51 @@ | ||
# 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'); | ||
|
||
statement ok | ||
create materialized view v1 as | ||
select rule, lag(rule) over (partition by cat order by at) from t where rule = 'B'; | ||
|
||
statement ok | ||
create materialized view v2 as | ||
select * from (select rule, lag(rule) over (partition by cat order by at) as prev_rule from t) where rule = 'B'; | ||
|
||
statement ok | ||
create materialized view v3 as | ||
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; | ||
|
||
query TT | ||
select * from v1; | ||
---- | ||
B NULL | ||
|
||
query TT | ||
select * from v2; | ||
---- | ||
B A | ||
|
||
query TT | ||
select * from v3; | ||
---- | ||
B 2023-11-23 12:01:15+00:00 2 | ||
|
||
statement ok | ||
drop materialized view v1; | ||
|
||
statement ok | ||
drop materialized view v2; | ||
|
||
statement ok | ||
drop materialized view v3; | ||
|
||
statement ok | ||
drop table t; |
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,49 @@ | ||
# 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'); | ||
|
||
statement ok | ||
create $view_type v1 as | ||
select rule, lag(rule) over (partition by cat order by at) from t where rule = 'B'; | ||
|
||
statement ok | ||
create $view_type v2 as | ||
select * from (select rule, lag(rule) over (partition by cat order by at) as prev_rule from t) where rule = 'B'; | ||
|
||
statement ok | ||
create $view_type v3 as | ||
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; | ||
|
||
query TT | ||
select * from v1; | ||
---- | ||
B NULL | ||
|
||
query TT | ||
select * from v2; | ||
---- | ||
B A | ||
|
||
query TT | ||
select * from v3; | ||
---- | ||
B 2023-11-23 12:01:15+00:00 2 | ||
|
||
statement ok | ||
drop $view_type v1; | ||
|
||
statement ok | ||
drop $view_type v2; | ||
|
||
statement ok | ||
drop $view_type v3; | ||
|
||
statement ok | ||
drop table t; |
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.