This is an automated email from the ASF dual-hosted git repository.

gabriellee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 215a4c6e02 [Bug](BHJ) Fix wrong result when use broadcast hash join 
for naaj (#14253)
215a4c6e02 is described below

commit 215a4c6e028440c8819c5300b731bf7f99a00078
Author: Gabriel <gabrielleeb...@gmail.com>
AuthorDate: Tue Nov 15 09:40:00 2022 +0800

    [Bug](BHJ) Fix wrong result when use broadcast hash join for naaj (#14253)
---
 be/src/vec/exec/join/vhash_join_node.cpp                       |  6 ++++++
 be/src/vec/runtime/shared_hash_table_controller.h              | 10 ++++++++++
 .../data/correctness_p0/test_null_aware_left_anti_join.out     |  2 ++
 .../correctness_p0/test_null_aware_left_anti_join.groovy       |  3 +++
 run-fe-ut.sh                                                   |  4 ++--
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/exec/join/vhash_join_node.cpp 
b/be/src/vec/exec/join/vhash_join_node.cpp
index a761ca2419..f2712542f3 100644
--- a/be/src/vec/exec/join/vhash_join_node.cpp
+++ b/be/src/vec/exec/join/vhash_join_node.cpp
@@ -657,6 +657,9 @@ Status HashJoinNode::_materialize_build_side(RuntimeState* 
state) {
                               if (!ret.status.ok()) {
                                   return ret.status;
                               }
+                              _short_circuit_for_null_in_probe_side =
+                                      _shared_hashtable_controller
+                                              
->short_circuit_for_null_in_probe_side();
                               arg.hash_table_ptr =
                                       
reinterpret_cast<HashTableType*>(ret.hash_table_ptr);
                               _build_blocks = *ret.blocks;
@@ -677,6 +680,9 @@ Status HashJoinNode::_materialize_build_side(RuntimeState* 
state) {
                                       runtime_filter_build_process(this);
                               auto ret = runtime_filter_build_process(state, 
arg);
                               if (_shared_hashtable_controller) {
+                                  _shared_hashtable_controller
+                                          
->set_short_circuit_for_null_in_probe_side(
+                                                  
_short_circuit_for_null_in_probe_side);
                                   SharedHashTableEntry entry(ret, 
arg.hash_table_ptr,
                                                              &_build_blocks, 
_runtime_filter_slots);
                                   
_shared_hashtable_controller->put_hash_table(std::move(entry),
diff --git a/be/src/vec/runtime/shared_hash_table_controller.h 
b/be/src/vec/runtime/shared_hash_table_controller.h
index 8f45be3bec..9836c3ec3f 100644
--- a/be/src/vec/runtime/shared_hash_table_controller.h
+++ b/be/src/vec/runtime/shared_hash_table_controller.h
@@ -71,6 +71,15 @@ public:
     void put_hash_table(SharedHashTableEntry&& entry, int my_node_id);
     Status wait_for_closable(RuntimeState* state, int my_node_id);
 
+    // Single-thread operation
+    void set_short_circuit_for_null_in_probe_side(bool 
short_circuit_for_null_in_probe_side) {
+        _short_circuit_for_null_in_probe_side = 
short_circuit_for_null_in_probe_side;
+    }
+
+    bool short_circuit_for_null_in_probe_side() const {
+        return _short_circuit_for_null_in_probe_side;
+    }
+
 private:
     // If the fragment instance was supposed to build hash table, but it 
didn't build.
     // To avoid deadlocking other fragment instances,
@@ -83,6 +92,7 @@ private:
     std::map<int /*node id*/, TUniqueId /*fragment id*/> _builder_fragment_ids;
     std::map<int /*node id*/, SharedHashTableEntry> _hash_table_entries;
     std::map<int /*node id*/, std::vector<TUniqueId>> _ref_fragments;
+    bool _short_circuit_for_null_in_probe_side;
 };
 
 } // namespace vectorized
diff --git 
a/regression-test/data/correctness_p0/test_null_aware_left_anti_join.out 
b/regression-test/data/correctness_p0/test_null_aware_left_anti_join.out
index d149258eda..445f07fa65 100644
--- a/regression-test/data/correctness_p0/test_null_aware_left_anti_join.out
+++ b/regression-test/data/correctness_p0/test_null_aware_left_anti_join.out
@@ -8,3 +8,5 @@
 
 -- !select --
 
+-- !select --
+
diff --git 
a/regression-test/suites/correctness_p0/test_null_aware_left_anti_join.groovy 
b/regression-test/suites/correctness_p0/test_null_aware_left_anti_join.groovy
index b25e992cad..e74ed27ba3 100644
--- 
a/regression-test/suites/correctness_p0/test_null_aware_left_anti_join.groovy
+++ 
b/regression-test/suites/correctness_p0/test_null_aware_left_anti_join.groovy
@@ -56,6 +56,9 @@ suite("test_null_aware_left_anti_join") {
 
     qt_select """ select ${tableName2}.k1 from ${tableName2} where k1 not in 
(select ${tableName1}.k1 from ${tableName1}) order by ${tableName2}.k1; """
 
+    sql """ set parallel_fragment_exec_instance_num=2; """
+    qt_select """ select ${tableName2}.k1 from ${tableName2} where k1 not in 
(select ${tableName1}.k1 from ${tableName1}) order by ${tableName2}.k1; """
+
     sql """
         drop table if exists ${tableName2};
     """
diff --git a/run-fe-ut.sh b/run-fe-ut.sh
index bf32af5afb..d78c18c08c 100755
--- a/run-fe-ut.sh
+++ b/run-fe-ut.sh
@@ -29,8 +29,8 @@ usage() {
     echo "
 Usage: $0 <options>
   Optional options:
-     --clean    clean and build ut
-     --run    build and run ut
+     --coverage           build and run coverage statistic
+     --run                build and run ut
 
   Eg.
     $0                      build and run ut


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to