-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(stream): left temporal join handle non-matched rows incorrectly (#…
…15327) Signed-off-by: TennyZhuang <[email protected]>
- Loading branch information
1 parent
0c2c2b9
commit 16e3685
Showing
5 changed files
with
469 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table stream(id1 int, a1 int, b1 int) APPEND ONLY; | ||
|
||
statement ok | ||
create table version(id2 int, a2 int, b2 int, primary key (id2)); | ||
|
||
statement ok | ||
create materialized view v as select id1, a1, id2, a2 from stream left join version FOR SYSTEM_TIME AS OF PROCTIME() on id1 = id2 and a1 > a2 | ||
|
||
statement ok | ||
insert into version values(1, 11, 111); | ||
|
||
statement ok | ||
insert into stream values(1, 10, 111); | ||
|
||
query IIII rowsort | ||
select * from v; | ||
---- | ||
1 10 NULL NULL | ||
|
||
statement ok | ||
drop materialized view v; | ||
|
||
statement ok | ||
drop table stream; | ||
|
||
statement ok | ||
drop table version; |
109 changes: 109 additions & 0 deletions
109
e2e_test/streaming/temporal_join/temporal_join_multiple_rows.slt
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,109 @@ | ||
# The suite tests the cases that multiple rows are matched. | ||
|
||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table stream(a1 int, b1 int) APPEND ONLY; | ||
|
||
statement ok | ||
create table version(a2 int, b2 int); | ||
|
||
statement ok | ||
create index idx on version (a2); | ||
|
||
statement ok | ||
create materialized view v as | ||
select a1, a2 from stream left join version FOR SYSTEM_TIME AS OF PROCTIME() on a1 = a2; | ||
|
||
statement ok | ||
insert into stream values | ||
(1,1) | ||
,(2,1) | ||
; | ||
|
||
|
||
statement ok | ||
insert into version values | ||
(1,1) | ||
,(1,2) | ||
,(1,3) | ||
; | ||
|
||
statement ok | ||
insert into stream values | ||
(1,1) | ||
,(2,1) | ||
; | ||
|
||
query II rowsort | ||
select a1, a2 from v; | ||
---- | ||
1 1 | ||
1 1 | ||
1 1 | ||
1 NULL | ||
2 NULL | ||
2 NULL | ||
|
||
statement ok | ||
drop materialized view v; | ||
|
||
statement ok | ||
drop table stream; | ||
|
||
statement ok | ||
drop table version; | ||
|
||
# Test non equal conditions | ||
|
||
statement ok | ||
create table stream(a1 int, b1 int) APPEND ONLY; | ||
|
||
statement ok | ||
create table version(a2 int, b2 int); | ||
|
||
statement ok | ||
create index idx on version (a2); | ||
|
||
statement ok | ||
create materialized view v as | ||
select a1, a2, b2 | ||
from stream left join version FOR SYSTEM_TIME AS OF PROCTIME() | ||
on a1 = a2 and b1 > b2; | ||
|
||
statement ok | ||
insert into version values | ||
(1,1) | ||
,(1,2) | ||
,(1,3) | ||
; | ||
|
||
statement ok | ||
insert into stream values | ||
(1,0) | ||
,(1,3) | ||
,(1,6) | ||
,(2,1) | ||
; | ||
|
||
|
||
query III rowsort | ||
select a1, a2, b2 from v; | ||
---- | ||
1 1 1 | ||
1 1 1 | ||
1 1 2 | ||
1 1 2 | ||
1 1 3 | ||
1 NULL NULL | ||
2 NULL NULL | ||
|
||
statement ok | ||
drop materialized view v; | ||
|
||
statement ok | ||
drop table stream; | ||
|
||
statement ok | ||
drop table version; |
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.