Skip to content
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(query): fix left outer join wrong result #16601

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ impl HashJoinProbeState {

if !next_process_state {
probe_state.process_state = None
} else {
probe_state.probe_unmatched_indexes_count = 0;
}

Ok(result_blocks)
Expand Down
37 changes: 37 additions & 0 deletions tests/sqllogictests/suites/query/join/left_outer.test
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,40 @@ SELECT * FROM t1 LEFT OUTER JOIN t2 ON TRUE AND t1.i=t2.k AND FALSE order by i,
1 2 NULL NULL
2 3 NULL NULL
3 4 NULL NULL

statement ok
CREATE OR REPLACE TABLE t1(a int, b int);

statement ok
CREATE OR REPLACE TABLE t2(a int, b int);

statement ok
INSERT INTO t1 VALUES(1, 2), (2, 3), (3, 4), (4, 5), (5, 6);

statement ok
INSERT INTO t2 VALUES(2, 2), (2, 4), (2, 6), (2, 8), (2, 10);

statement ok
set max_block_size = 2;

query I
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a;
----
2 3 2 10
2 3 2 8
1 2 NULL NULL
2 3 2 6
2 3 2 4
2 3 2 2
3 4 NULL NULL
4 5 NULL NULL
5 6 NULL NULL

statement ok
set max_block_size = 65536;

statement ok
DROP TABLE IF EXISTS t1;

statement ok
DROP TABLE IF EXISTS t2;
Loading