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

yiguolei 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 93a865c3e8 [improvement](join) Avoid reading from left child while 
hash table is empty(right join) (#17655)
93a865c3e8 is described below

commit 93a865c3e88f5d483ae413c74e8e8bcb8816e904
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Mon Mar 13 09:03:17 2023 +0800

    [improvement](join) Avoid reading from left child while hash table is 
empty(right join) (#17655)
    
    When the right (build) side is empty in a right outer join, there is no 
need to read data from the left child.
---
 be/src/vec/exec/join/vhash_join_node.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/be/src/vec/exec/join/vhash_join_node.cpp 
b/be/src/vec/exec/join/vhash_join_node.cpp
index face23f898..45847960f7 100644
--- a/be/src/vec/exec/join/vhash_join_node.cpp
+++ b/be/src/vec/exec/join/vhash_join_node.cpp
@@ -598,6 +598,22 @@ Status HashJoinNode::get_next(RuntimeState* state, Block* 
output_block, bool* eo
         *eos = true;
         return Status::OK();
     }
+
+    if (_join_op == TJoinOp::RIGHT_OUTER_JOIN) {
+        const auto hash_table_empty = std::visit(
+                Overload {[&](std::monostate&) -> bool {
+                              LOG(FATAL) << "FATAL: uninited hash table";
+                              __builtin_unreachable();
+                          },
+                          [&](auto&& arg) -> bool { return 
arg.hash_table.size() == 0; }},
+                *_hash_table_variants);
+
+        if (hash_table_empty) {
+            *eos = true;
+            return Status::OK();
+        }
+    }
+
     while (need_more_input_data()) {
         prepare_for_next();
         SCOPED_TIMER(_probe_next_timer);


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

Reply via email to