Skip to content

Commit

Permalink
fix wrong result on mark join + other conjunct
Browse files Browse the repository at this point in the history
  • Loading branch information
BiteTheDDDDt committed Dec 29, 2023
1 parent a14daca commit 5c1e86f
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions be/src/vec/exec/join/process_hash_table_probe_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,41 +278,41 @@ Status ProcessHashTableProbe<JoinOpType, Parent>::do_other_join_conjuncts(
auto new_filter_column = ColumnUInt8::create(row_count);
auto* __restrict filter_map = new_filter_column->get_data().data();

if (is_mark_join) {
auto mark_column =
output_block->get_by_position(orig_columns - 1).column->assume_mutable();
ColumnFilterHelper helper(*mark_column);

if constexpr (JoinOpType == TJoinOp::LEFT_SEMI_JOIN) {
for (size_t i = 0; i < row_count; ++i) {
filter_map[i] = true;
if (has_null_in_build_side &&
(_build_indexs[i] != 0) ^ (JoinOpType == TJoinOp::LEFT_SEMI_JOIN)) {
helper.insert_null();
if (filter_column_ptr[i]) {
filter_map[i] = _parent->_last_probe_match != _probe_indexs[i];
_parent->_last_probe_match = _probe_indexs[i];
} else {
helper.insert_value(filter_column_ptr[i]);
filter_map[i] = false;
}
}
} else {
if constexpr (JoinOpType == TJoinOp::LEFT_SEMI_JOIN) {
for (size_t i = 0; i < row_count; ++i) {
for (size_t i = 0; i < row_count; ++i) {
if (_build_indexs[i]) {
filter_map[i] = false;
if (filter_column_ptr[i]) {
filter_map[i] = _parent->_last_probe_match != _probe_indexs[i];
_parent->_last_probe_match = _probe_indexs[i];
} else {
filter_map[i] = false;
}
} else {
filter_map[i] = _parent->_last_probe_match != _probe_indexs[i];
}
} else {
for (size_t i = 0; i < row_count; ++i) {
if (_build_indexs[i]) {
filter_map[i] = false;
if (filter_column_ptr[i]) {
_parent->_last_probe_match = _probe_indexs[i];
}
} else {
filter_map[i] = _parent->_last_probe_match != _probe_indexs[i];
}
}
}

if (is_mark_join) {
auto mark_column =
output_block->get_by_position(orig_columns - 1).column->assume_mutable();
ColumnFilterHelper helper(*mark_column);
for (size_t i = 0; i < row_count; ++i) {
bool mathced = filter_map[i] &&
((_build_indexs[i] != 0) == (JoinOpType == TJoinOp::LEFT_SEMI_JOIN));
if (has_null_in_build_side && !mathced) {
helper.insert_null();
} else {
helper.insert_value(mathced);
}
filter_map[i] = true;
}
}

Expand Down

0 comments on commit 5c1e86f

Please sign in to comment.