Skip to content

Commit b4068fa

Browse files
authored
Merge pull request #9081 from lichuang/issue_9018
fix: fix right join bug, issue 9018
2 parents ee3ce03 + 71784d5 commit b4068fa

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_state_impl.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ impl HashJoinState for JoinHashTable {
297297
let input_block = DataBlock::concat_blocks(&[blocks, &[rest_block]].concat())?;
298298

299299
if unmatched_build_indexes.is_empty() && self.hash_join_desc.other_predicate.is_none() {
300+
if input_block.is_empty() {
301+
return Ok(vec![]);
302+
}
300303
return Ok(vec![input_block]);
301304
}
302305

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
statement ok
2+
DROP DATABASE IF EXISTS databend1;
3+
4+
statement ok
5+
CREATE DATABASE databend1;
6+
7+
statement ok
8+
USE databend1;
9+
10+
statement ok
11+
CREATE TABLE t0(c0VARCHAR VARCHAR NULL, c1BOOLEAN BOOLEAN NULL, c2BOOLEAN BOOLEAN NULL);
12+
13+
statement ok
14+
CREATE TABLE t1(c0INT INT64 NULL DEFAULT(-273272402), c1INT INT64 NULL);
15+
16+
statement ok
17+
select 1 as count FROM t0 NATURAL RIGHT JOIN t1;

0 commit comments

Comments
 (0)