Skip to content
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
15 changes: 8 additions & 7 deletions be/src/vec/common/hash_table/join_hash_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ class JoinHashTable {
int probe_idx, uint32_t build_idx, int probe_rows,
uint32_t* __restrict probe_idxs, bool& probe_visited,
uint32_t* __restrict build_idxs) {
if constexpr (JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN) {
if constexpr (JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN ||
JoinOpType == TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN) {
if (_empty_build_side) {
return _process_null_aware_left_anti_join_for_empty_build_side<
JoinOpType, with_other_conjuncts, is_mark_join>(probe_idx, probe_rows,
probe_idxs, build_idxs);
return _process_null_aware_left_half_join_for_empty_build_side<JoinOpType>(
probe_idx, probe_rows, probe_idxs, build_idxs);
}
}

Expand Down Expand Up @@ -247,11 +247,12 @@ class JoinHashTable {
}

private:
template <int JoinOpType, bool with_other_conjuncts, bool is_mark_join>
auto _process_null_aware_left_anti_join_for_empty_build_side(int probe_idx, int probe_rows,
template <int JoinOpType>
auto _process_null_aware_left_half_join_for_empty_build_side(int probe_idx, int probe_rows,
uint32_t* __restrict probe_idxs,
uint32_t* __restrict build_idxs) {
static_assert(JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN);
static_assert(JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN ||
JoinOpType == TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN);
auto matched_cnt = 0;
const auto batch_size = max_batch_size;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@

-- !select_2 --

-- !semi_emtpy_right_false --
\N false
1 false
3 false

Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,15 @@ suite("test_null_aware_left_anti_join") {
FROM test_null_aware_left_anti_join2 AS t2
)
AND t1.`k1` IN (1, 2, 3, 5, 7);"""

// In left semi join, if right side is empty, the result should not be null but false.
qt_semi_emtpy_right_false """
select
t1.k1,
t1.k1 in (
select k1 from ${tableName2} t2 where t2.k1 > 2
) value
from ${tableName1} t1
order by 1, 2;
"""
}