-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(batch): introduce batch AsOf join (#19790)
- Loading branch information
Showing
14 changed files
with
402 additions
and
127 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,43 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t1 (v1 int, v2 int, v3 int primary key); | ||
|
||
statement ok | ||
create table t2 (v1 int, v2 int, v3 int primary key); | ||
|
||
statement ok | ||
insert into t1 values (1, 2, 3), (2, 3, 4), (1, 2, 9); | ||
|
||
statement ok | ||
insert into t2 values (1, NULL, 8), (1, 3, 4), (1, 2, 5), (1, 2, 6); | ||
|
||
# asof inner join | ||
query IIIIII | ||
SELECT t1.v1 t1_v1, t1.v2 t1_v2, t1.v3 t1_v3, t2.v1 t2_v1, t2.v2 t2_v2, t2.v3 t2_v3 FROM t1 ASOF JOIN t2 ON t1.v1 = t2.v1 and t1.v2 < t2.v2 order by t1.v1, t1.v3; | ||
---- | ||
1 2 3 1 3 4 | ||
1 2 9 1 3 4 | ||
|
||
# asof left join | ||
query IIIIII | ||
SELECT t1.v1 t1_v1, t1.v2 t1_v2, t1.v3 t1_v3, t2.v1 t2_v1, t2.v2 t2_v2, t2.v3 t2_v3 FROM t1 ASOF LEFT JOIN t2 ON t1.v1 = t2.v1 and t1.v2 < t2.v2 order by t1.v1, t1.v3; | ||
---- | ||
1 2 3 1 3 4 | ||
1 2 9 1 3 4 | ||
2 3 4 NULL NULL NULL | ||
|
||
# asof left join | ||
query IIIIII | ||
SELECT t1.v1 t1_v1, t1.v2 t1_v2, t1.v3 t1_v3, t2.v1 t2_v1, t2.v2 t2_v2, t2.v3 t2_v3 FROM t1 ASOF LEFT JOIN t2 ON t1.v1 = t2.v1 and t1.v2 > t2.v2 order by t1.v1, t1.v3; | ||
---- | ||
1 2 3 NULL NULL NULL | ||
1 2 9 NULL NULL NULL | ||
2 3 4 NULL NULL NULL | ||
|
||
statement ok | ||
drop table t1; | ||
|
||
statement ok | ||
drop table t2; |
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.