Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
BiteTheDDDDt committed Dec 20, 2024
1 parent 2066a05 commit 30b7650
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions be/src/pipeline/exec/join/process_hash_table_probe_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ Status ProcessHashTableProbe<JoinOpType>::do_mark_join_conjuncts(vectorized::Blo
JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN;
constexpr bool is_null_aware_join = JoinOpType == TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN ||
JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN;

DCHECK_EQ(_parent->_mark_join_conjuncts.empty(), is_null_aware_join);
const auto row_count = output_block->rows();
if (!row_count) {
return Status::OK();
Expand All @@ -386,7 +386,7 @@ Status ProcessHashTableProbe<JoinOpType>::do_mark_join_conjuncts(vectorized::Blo
uint8_t* mark_filter_data = nullptr;
uint8_t* mark_null_map = nullptr;

if (_parent->_mark_join_conjuncts.empty()) {
if constexpr (is_null_aware_join) {
// For null aware anti/semi join, if the equal conjuncts was not matched and the build side has null value,
// the result should be null. Like:
// select 4 not in (2, 3, null) => null, select 4 not in (2, 3) => true
Expand All @@ -400,25 +400,20 @@ Status ProcessHashTableProbe<JoinOpType>::do_mark_join_conjuncts(vectorized::Blo
int last_probe_matched = -1;
for (size_t i = 0; i != row_count; ++i) {
mark_filter_data[i] = _build_indexs[i] != 0;
if constexpr (is_null_aware_join) {
if constexpr (with_other_conjuncts) {
mark_null_map[i] = _null_flags[i];
if constexpr (with_other_conjuncts) {
mark_null_map[i] = _null_flags[i];
} else {
if (mark_filter_data[i]) {
last_probe_matched = _probe_indexs[i];
mark_null_map[i] = false;
} else {
if (mark_filter_data[i]) {
last_probe_matched = _probe_indexs[i];
mark_null_map[i] = false;
} else {
mark_null_map[i] = (should_be_null_if_build_side_has_null &&
last_probe_matched != _probe_indexs[i]);
}
mark_null_map[i] = (should_be_null_if_build_side_has_null &&
last_probe_matched != _probe_indexs[i]);
}
} else {
// mark_null_map will be reused, so it needs to be reset every time
mark_null_map[i] = false;
}
}

if (is_null_aware_join && null_map) {
if (null_map) {
// null_map[_probe_indexs[i]] is null, which means that the probe side of the line is null, so the mark sign should also be null.
for (size_t i = 0; i != row_count; ++i) {
mark_null_map[i] |= null_map[_probe_indexs[i]];
Expand Down

0 comments on commit 30b7650

Please sign in to comment.