diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index df22953202b653..4f246413a3de05 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -556,7 +556,7 @@ SET(CXX_FLAGS_LSAN "${CXX_GCC_FLAGS} -O0 -fsanitize=leak -DLEAK_SANITIZER") # Set the flags to the undefined behavior sanitizer, also known as "ubsan" # Turn on sanitizer and debug symbols to get stack traces: -SET(CXX_FLAGS_UBSAN "${CXX_GCC_FLAGS} -O0 -fno-wrapv -fsanitize=undefined") +SET(CXX_FLAGS_UBSAN "${CXX_GCC_FLAGS} -O0 -fno-wrapv -fsanitize=undefined -DUNDEFINED_BEHAVIOR_SANITIZER") # Set the flags to the thread sanitizer, also known as "tsan" # Turn on sanitizer and debug symbols to get stack traces: diff --git a/be/src/vec/exec/join/vhash_join_node.cpp b/be/src/vec/exec/join/vhash_join_node.cpp index 41332b68502c31..8126e7732d23e5 100644 --- a/be/src/vec/exec/join/vhash_join_node.cpp +++ b/be/src/vec/exec/join/vhash_join_node.cpp @@ -192,12 +192,17 @@ ProcessHashTableProbe::ProcessHashTableProbe(HashJoinNo : _join_node(join_node), _batch_size(batch_size), _build_blocks(join_node->_build_blocks), - _tuple_is_null_left_flags( - reinterpret_cast(*join_node->_tuple_is_null_left_flag_column) - .get_data()), + _tuple_is_null_left_flags(join_node->_is_outer_join + ? &(reinterpret_cast( + *join_node->_tuple_is_null_left_flag_column) + .get_data()) + : nullptr), _tuple_is_null_right_flags( - reinterpret_cast(*join_node->_tuple_is_null_right_flag_column) - .get_data()), + join_node->_is_outer_join + ? &(reinterpret_cast( + *join_node->_tuple_is_null_right_flag_column) + .get_data()) + : nullptr), _rows_returned_counter(join_node->_rows_returned_counter), _search_hashtable_timer(join_node->_search_hashtable_timer), _build_side_output_timer(join_node->_build_side_output_timer), @@ -268,8 +273,8 @@ void ProcessHashTableProbe::build_side_output_column( // Dispose right tuple is null flags columns if constexpr (probe_all && !have_other_join_conjunct) { - _tuple_is_null_right_flags.resize(size); - auto* __restrict null_data = _tuple_is_null_right_flags.data(); + _tuple_is_null_right_flags->resize(size); + auto* __restrict null_data = _tuple_is_null_right_flags->data(); for (int i = 0; i < size; ++i) { null_data[i] = _build_block_rows[i] == -1; } @@ -298,7 +303,7 @@ void ProcessHashTableProbe::probe_side_output_column( } if constexpr (JoinOpType::value == TJoinOp::RIGHT_OUTER_JOIN && !have_other_join_conjunct) { - _tuple_is_null_left_flags.resize_fill(size, 0); + _tuple_is_null_left_flags->resize_fill(size, 0); } } @@ -616,7 +621,7 @@ Status ProcessHashTableProbe::do_process_with_other_joi for (int i = 0; i < column->size(); ++i) { if (filter_map[i]) { - _tuple_is_null_right_flags.emplace_back(null_map_data[i]); + _tuple_is_null_right_flags->emplace_back(null_map_data[i]); } } output_block->get_by_position(result_column_id).column = std::move(new_filter_column); @@ -672,7 +677,7 @@ Status ProcessHashTableProbe::do_process_with_other_joi *visited_map[i] |= result; filter_size += result; } - _tuple_is_null_left_flags.resize_fill(filter_size, 0); + _tuple_is_null_left_flags->resize_fill(filter_size, 0); } else { // inner join do nothing } @@ -741,7 +746,7 @@ Status ProcessHashTableProbe::process_data_in_hashtable for (int i = 0; i < right_col_idx; ++i) { assert_cast(mcol[i].get())->insert_many_defaults(block_size); } - _tuple_is_null_left_flags.resize_fill(block_size, 1); + _tuple_is_null_left_flags->resize_fill(block_size, 1); } *eos = iter == hash_table_ctx.hash_table.end(); diff --git a/be/src/vec/exec/join/vhash_join_node.h b/be/src/vec/exec/join/vhash_join_node.h index 011bc244a57f0f..2be992d5bdfd02 100644 --- a/be/src/vec/exec/join/vhash_join_node.h +++ b/be/src/vec/exec/join/vhash_join_node.h @@ -198,9 +198,9 @@ struct ProcessHashTableProbe { std::vector _build_block_offsets; std::vector _build_block_rows; // only need set the tuple is null in RIGHT_OUTER_JOIN and FULL_OUTER_JOIN - ColumnUInt8::Container& _tuple_is_null_left_flags; + ColumnUInt8::Container* _tuple_is_null_left_flags; // only need set the tuple is null in LEFT_OUTER_JOIN and FULL_OUTER_JOIN - ColumnUInt8::Container& _tuple_is_null_right_flags; + ColumnUInt8::Container* _tuple_is_null_right_flags; RuntimeProfile::Counter* _rows_returned_counter; RuntimeProfile::Counter* _search_hashtable_timer;