This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new b187c08 Fix bug of null safe equal join (#2193) b187c08 is described below commit b187c0881c55ff0187dfca669c5f5ba4fc100ac8 Author: EmmyMiao87 <522274...@qq.com> AuthorDate: Thu Nov 14 08:52:48 2019 +0800 Fix bug of null safe equal join (#2193) --- be/src/exec/hash_join_node.cpp | 8 +++++--- be/src/exec/hash_table.cpp | 9 +++------ be/src/exec/hash_table.h | 6 ++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/be/src/exec/hash_join_node.cpp b/be/src/exec/hash_join_node.cpp index 9d2a6c2..084e8b9 100644 --- a/be/src/exec/hash_join_node.cpp +++ b/be/src/exec/hash_join_node.cpp @@ -137,13 +137,15 @@ Status HashJoinNode::prepare(RuntimeState* state) { _build_tuple_row_size = num_build_tuples * sizeof(Tuple*); // TODO: default buckets - const bool null_preserved = _join_op == TJoinOp::RIGHT_OUTER_JOIN + const bool stores_nulls = _join_op == TJoinOp::RIGHT_OUTER_JOIN || _join_op == TJoinOp::FULL_OUTER_JOIN || _join_op == TJoinOp::RIGHT_ANTI_JOIN - || _join_op == TJoinOp::RIGHT_SEMI_JOIN; + || _join_op == TJoinOp::RIGHT_SEMI_JOIN + || (std::find(_is_null_safe_eq_join.begin(), _is_null_safe_eq_join.end(), + true) != _is_null_safe_eq_join.end()); _hash_tbl.reset(new HashTable( _build_expr_ctxs, _probe_expr_ctxs, _build_tuple_size, - null_preserved, _is_null_safe_eq_join, id(), mem_tracker(), 1024)); + stores_nulls, _is_null_safe_eq_join, id(), mem_tracker(), 1024)); _probe_batch.reset(new RowBatch(child(0)->row_desc(), state->batch_size(), mem_tracker())); diff --git a/be/src/exec/hash_table.cpp b/be/src/exec/hash_table.cpp index ac94470..0c805f7 100644 --- a/be/src/exec/hash_table.cpp +++ b/be/src/exec/hash_table.cpp @@ -42,18 +42,15 @@ const char* HashTable::_s_llvm_class_name = "class.doris::HashTable"; HashTable::HashTable(const vector<ExprContext*>& build_expr_ctxs, const vector<ExprContext*>& probe_expr_ctxs, - int num_build_tuples, bool null_preserved, + int num_build_tuples, bool stores_nulls, const std::vector<bool>& finds_nulls, int32_t initial_seed, MemTracker* mem_tracker, int64_t num_buckets) : _build_expr_ctxs(build_expr_ctxs), _probe_expr_ctxs(probe_expr_ctxs), _num_build_tuples(num_build_tuples), - _null_preserved(null_preserved), + _stores_nulls(stores_nulls), _finds_nulls(finds_nulls), - _stores_nulls(null_preserved - || (std::find(finds_nulls.begin(), finds_nulls.end(), - true) != finds_nulls.end())), _initial_seed(initial_seed), _node_byte_size(sizeof(Node) + sizeof(Tuple*) * _num_build_tuples), _num_filled_buckets(0), @@ -186,7 +183,7 @@ bool HashTable::equals(TupleRow* build_row) { void* val = _build_expr_ctxs[i]->get_value(build_row); if (val == NULL) { - if (!(_null_preserved && _finds_nulls[i])) { + if (!(_stores_nulls && _finds_nulls[i])) { return false; } diff --git a/be/src/exec/hash_table.h b/be/src/exec/hash_table.h index 1b2c649..0b31688 100644 --- a/be/src/exec/hash_table.h +++ b/be/src/exec/hash_table.h @@ -386,13 +386,11 @@ private: // Number of Tuple* in the build tuple row const int _num_build_tuples; - // the row in hash table is preserved such as RIGHT_OUTER_JOIN - const bool _null_preserved; + // outer join || has null equal join should be true + const bool _stores_nulls; // true: the null-safe equal '<=>' is true. The row with null shoud be judged. // false: the equal '=' is false. The row with null should be filtered. const std::vector<bool> _finds_nulls; - // outer join || has null equal join should be true - const bool _stores_nulls; const int32_t _initial_seed; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org