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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new cbe8e5c010e [opt](join) For a mark join without other conjuncts, stop 
probing after matching one row (#34581)
cbe8e5c010e is described below

commit cbe8e5c010e14768e5559bdef98b71216943ab80
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Fri May 10 13:45:00 2024 +0800

    [opt](join) For a mark join without other conjuncts, stop probing after 
matching one row (#34581)
---
 be/src/vec/common/hash_table/join_hash_table.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/common/hash_table/join_hash_table.h 
b/be/src/vec/common/hash_table/join_hash_table.h
index c83f8d17c27..10ca6c9b2dd 100644
--- a/be/src/vec/common/hash_table/join_hash_table.h
+++ b/be/src/vec/common/hash_table/join_hash_table.h
@@ -100,7 +100,12 @@ public:
 
         if constexpr (with_other_conjuncts ||
                       (is_mark_join && JoinOpType != 
TJoinOp::RIGHT_SEMI_JOIN)) {
-            return _find_batch_conjunct<JoinOpType, need_judge_null>(
+            constexpr bool null_aware_without_other_conjuncts =
+                    (JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN ||
+                     JoinOpType == TJoinOp::NULL_AWARE_LEFT_SEMI_JOIN) &&
+                    !with_other_conjuncts;
+            return _find_batch_conjunct<JoinOpType, need_judge_null,
+                                        null_aware_without_other_conjuncts>(
                     keys, build_idx_map, probe_idx, build_idx, probe_rows, 
probe_idxs, build_idxs);
         }
 
@@ -309,7 +314,7 @@ private:
         return std::tuple {probe_idx, 0U, matched_cnt};
     }
 
-    template <int JoinOpType, bool need_judge_null>
+    template <int JoinOpType, bool need_judge_null, bool 
null_aware_without_other_conjuncts>
     auto _find_batch_conjunct(const Key* __restrict keys, const uint32_t* 
__restrict build_idx_map,
                               int probe_idx, uint32_t build_idx, int 
probe_rows,
                               uint32_t* __restrict probe_idxs, uint32_t* 
__restrict build_idxs) {
@@ -339,6 +344,11 @@ private:
                     build_idxs[matched_cnt] = build_idx;
                     probe_idxs[matched_cnt] = probe_idx;
                     matched_cnt++;
+
+                    if constexpr (null_aware_without_other_conjuncts) {
+                        build_idx = 0;
+                        break;
+                    }
                 }
                 build_idx = next[build_idx];
             }


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

Reply via email to