Skip to content

Commit 4533c87

Browse files
authored
Merge pull request #9192 from b41sh/fix-left-join-null
fix(planner): fix left join with empty column
2 parents 6bd5904 + 4c430bb commit 4533c87

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/query/datavalues/src/columns/nullable/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ impl Column for NullableColumn {
108108
}
109109

110110
fn len(&self) -> usize {
111-
self.column.len()
111+
// column length may less than validity length
112+
self.validity.len()
112113
}
113114

114115
fn null_at(&self, row: usize) -> bool {

tests/logictest/suites/mode/cluster/broadcast_join.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ select * from t1 left outer join t2 on t1.a > t2.c order by a,b,c,d;
217217
7 8 6 8
218218

219219

220+
statement query III
221+
select t1.a, t2.c, t2.d from t1 left join t2 on t2.c in ( -t2.c );
222+
223+
----
224+
1 NULL NULL
225+
3 NULL NULL
226+
7 NULL NULL
227+
228+
220229
statement ok
221230
drop table t1;
222231

tests/logictest/suites/query/join.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ select * from t1 left outer join t2 on t1.a > t2.c order by a,b,c,d;
214214
7 8 6 8
215215

216216

217+
statement query III
218+
select t1.a, t2.c, t2.d from t1 left join t2 on t2.c in ( -t2.c );
219+
220+
----
221+
1 NULL NULL
222+
3 NULL NULL
223+
7 NULL NULL
224+
225+
217226
statement ok
218227
drop table t1;
219228

0 commit comments

Comments
 (0)