forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] Fix use wrong hash table when spill left/right outer join ha…
…s other conjuncts (StarRocks#23302) Signed-off-by: stdpain <drfeng08@gmail.com>
- Loading branch information
Showing
6 changed files
with
104 additions
and
22 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-- name: test_spill_hash_join | ||
set enable_spill=true; | ||
-- result: | ||
-- !result | ||
set spill_mode="force"; | ||
-- result: | ||
-- !result | ||
set pipeline_dop=1; | ||
-- result: | ||
-- !result | ||
create table t0 ( | ||
c0 INT, | ||
c1 BIGINT | ||
) DUPLICATE KEY(c0) DISTRIBUTED BY HASH(c0) BUCKETS 1 PROPERTIES('replication_num' = '1'); | ||
-- result: | ||
-- !result | ||
insert into t0 SELECT generate_series, 4096 - generate_series FROM TABLE(generate_series(1, 4096)); | ||
-- result: | ||
-- !result | ||
insert into t0 select * from t0; | ||
-- result: | ||
-- !result | ||
create table t1 like t0; | ||
-- result: | ||
-- !result | ||
insert into t1 SELECT generate_series, 4096 - generate_series FROM TABLE(generate_series(4096, 8192)); | ||
-- result: | ||
-- !result | ||
select count(l.c0), avg(l.c0), count(l.c1), count(l.c0), count(r.c1) from t0 l left join [broadcast] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
-- result: | ||
8192 2048.5 8192 8192 0 | ||
-- !result | ||
select count(l.c0), avg(l.c0), count(l.c1) from t0 l left semi join [broadcast] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
-- result: | ||
0 None 0 | ||
-- !result | ||
select count(l.c0), avg(l.c0), count(l.c1) from t0 l left semi join [broadcast] t1 r on l.c0 = r.c0 and l.c1 >= r.c1; | ||
-- result: | ||
2 4096.0 2 | ||
-- !result | ||
select count(l.c0), avg(l.c0), count(l.c1) from t0 l left anti join [broadcast] t1 r on l.c0 = r.c0 and l.c1 >= r.c1; | ||
-- result: | ||
8190 2048.0 8190 | ||
-- !result | ||
select count(r.c0), avg(r.c0), count(r.c1) from t0 l right semi join [bucket] t1 r on l.c0 = r.c0; | ||
-- result: | ||
1 4096.0 1 | ||
-- !result | ||
select count(r.c0), avg(r.c0), count(r.c1) from t0 l right semi join [bucket] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
-- result: | ||
0 None 0 | ||
-- !result | ||
select count(r.c0), avg(r.c0), count(r.c1) from t0 l right anti join [bucket] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
-- result: | ||
4097 6144.0 4097 | ||
-- !result | ||
select count(l.c0), avg(l.c0), count(l.c1), count(l.c0), count(r.c1) from t0 l right join [bucket] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
-- result: | ||
0 None 0 0 4097 | ||
-- !result |
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,22 @@ | ||
-- name: test_spill_hash_join | ||
set enable_spill=true; | ||
set spill_mode="force"; | ||
set pipeline_dop=1; | ||
-- | ||
create table t0 ( | ||
c0 INT, | ||
c1 BIGINT | ||
) DUPLICATE KEY(c0) DISTRIBUTED BY HASH(c0) BUCKETS 1 PROPERTIES('replication_num' = '1'); | ||
insert into t0 SELECT generate_series, 4096 - generate_series FROM TABLE(generate_series(1, 4096)); | ||
insert into t0 select * from t0; | ||
create table t1 like t0; | ||
insert into t1 SELECT generate_series, 4096 - generate_series FROM TABLE(generate_series(4096, 8192)); | ||
|
||
select count(l.c0), avg(l.c0), count(l.c1), count(l.c0), count(r.c1) from t0 l left join [broadcast] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
select count(l.c0), avg(l.c0), count(l.c1) from t0 l left semi join [broadcast] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
select count(l.c0), avg(l.c0), count(l.c1) from t0 l left semi join [broadcast] t1 r on l.c0 = r.c0 and l.c1 >= r.c1; | ||
select count(l.c0), avg(l.c0), count(l.c1) from t0 l left anti join [broadcast] t1 r on l.c0 = r.c0 and l.c1 >= r.c1; | ||
select count(r.c0), avg(r.c0), count(r.c1) from t0 l right semi join [bucket] t1 r on l.c0 = r.c0; | ||
select count(r.c0), avg(r.c0), count(r.c1) from t0 l right semi join [bucket] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
select count(r.c0), avg(r.c0), count(r.c1) from t0 l right anti join [bucket] t1 r on l.c0 = r.c0 and l.c1 < r.c1; | ||
select count(l.c0), avg(l.c0), count(l.c1), count(l.c0), count(r.c1) from t0 l right join [bucket] t1 r on l.c0 = r.c0 and l.c1 < r.c1; |