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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 7c93ad9c4a5 branch-4.0: [fix](local exchange) Do global shuffle for 
shuffled join/set operator #60758 (#60763)
7c93ad9c4a5 is described below

commit 7c93ad9c4a5bbb7a95e2049fc66efcd2236eeab2
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Feb 14 21:39:05 2026 +0800

    branch-4.0: [fix](local exchange) Do global shuffle for shuffled join/set 
operator #60758 (#60763)
    
    Cherry-picked from #60758
    
    Co-authored-by: Gabriel <[email protected]>
---
 be/src/pipeline/exec/hashjoin_build_sink.h                  | 4 ++++
 be/src/pipeline/exec/hashjoin_probe_operator.h              | 4 ++++
 be/src/pipeline/exec/operator.h                             | 6 ++++--
 be/src/pipeline/exec/partitioned_hash_join_probe_operator.h | 3 +++
 be/src/pipeline/exec/partitioned_hash_join_sink_operator.h  | 3 +++
 be/src/pipeline/exec/set_probe_sink_operator.h              | 4 ++++
 be/src/pipeline/exec/set_sink_operator.h                    | 4 ++++
 7 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/be/src/pipeline/exec/hashjoin_build_sink.h 
b/be/src/pipeline/exec/hashjoin_build_sink.h
index 2bb9407ef5c..f0cf73a82dd 100644
--- a/be/src/pipeline/exec/hashjoin_build_sink.h
+++ b/be/src/pipeline/exec/hashjoin_build_sink.h
@@ -148,6 +148,10 @@ public:
         return _join_distribution == TJoinDistributionType::BUCKET_SHUFFLE ||
                _join_distribution == TJoinDistributionType::COLOCATE;
     }
+    bool followed_by_shuffled_operator() const override {
+        return (is_shuffled_operator() && !is_colocated_operator()) ||
+               _followed_by_shuffled_operator;
+    }
     std::vector<bool>& is_null_safe_eq_join() { return _is_null_safe_eq_join; }
 
     bool allow_left_semi_direct_return(RuntimeState* state) const {
diff --git a/be/src/pipeline/exec/hashjoin_probe_operator.h 
b/be/src/pipeline/exec/hashjoin_probe_operator.h
index eff32f432ff..6c5232b3720 100644
--- a/be/src/pipeline/exec/hashjoin_probe_operator.h
+++ b/be/src/pipeline/exec/hashjoin_probe_operator.h
@@ -153,6 +153,10 @@ public:
         return _join_distribution == TJoinDistributionType::BUCKET_SHUFFLE ||
                _join_distribution == TJoinDistributionType::COLOCATE;
     }
+    bool followed_by_shuffled_operator() const override {
+        return (is_shuffled_operator() && !is_colocated_operator()) ||
+               _followed_by_shuffled_operator;
+    }
 
     bool need_finalize_variant_column() const { return 
_need_finalize_variant_column; }
 
diff --git a/be/src/pipeline/exec/operator.h b/be/src/pipeline/exec/operator.h
index 5ab3fdf6e7f..875d9ce18ef 100644
--- a/be/src/pipeline/exec/operator.h
+++ b/be/src/pipeline/exec/operator.h
@@ -163,12 +163,14 @@ public:
      */
     [[nodiscard]] virtual bool is_shuffled_operator() const { return false; }
     /**
-     * Return True if this operator is followed by a shuffled operator.
+     * For multiple children's operators, return true if this is a shuffled 
operator or this is followed by a shuffled operator (HASH JOIN and SET 
OPERATION).
+     *
+     * For single child's operators, return true if this operator is followed 
by a shuffled operator.
      * For example, in the plan fragment:
      *   `UNION` -> `SHUFFLED HASH JOIN`
      * The `SHUFFLED HASH JOIN` is a shuffled operator so the UNION operator 
is followed by a shuffled operator.
      */
-    [[nodiscard]] bool followed_by_shuffled_operator() const {
+    [[nodiscard]] virtual bool followed_by_shuffled_operator() const {
         return _followed_by_shuffled_operator;
     }
     /**
diff --git a/be/src/pipeline/exec/partitioned_hash_join_probe_operator.h 
b/be/src/pipeline/exec/partitioned_hash_join_probe_operator.h
index 1532acfda33..6419e4676ce 100644
--- a/be/src/pipeline/exec/partitioned_hash_join_probe_operator.h
+++ b/be/src/pipeline/exec/partitioned_hash_join_probe_operator.h
@@ -164,6 +164,9 @@ public:
     bool is_colocated_operator() const override {
         return _inner_probe_operator->is_colocated_operator();
     }
+    bool followed_by_shuffled_operator() const override {
+        return _inner_probe_operator->followed_by_shuffled_operator();
+    }
 
     void update_operator(const TPlanNode& tnode, bool 
followed_by_shuffled_operator,
                          bool require_bucket_distribution) override {
diff --git a/be/src/pipeline/exec/partitioned_hash_join_sink_operator.h 
b/be/src/pipeline/exec/partitioned_hash_join_sink_operator.h
index e098d071daa..59eed7aac66 100644
--- a/be/src/pipeline/exec/partitioned_hash_join_sink_operator.h
+++ b/be/src/pipeline/exec/partitioned_hash_join_sink_operator.h
@@ -150,6 +150,9 @@ public:
     bool is_shuffled_operator() const override {
         return _inner_sink_operator->is_shuffled_operator();
     }
+    bool followed_by_shuffled_operator() const override {
+        return _inner_sink_operator->followed_by_shuffled_operator();
+    }
 
     void update_operator(const TPlanNode& tnode, bool 
followed_by_shuffled_operator,
                          bool require_bucket_distribution) override {
diff --git a/be/src/pipeline/exec/set_probe_sink_operator.h 
b/be/src/pipeline/exec/set_probe_sink_operator.h
index c0ee8b7731e..896088fce0d 100644
--- a/be/src/pipeline/exec/set_probe_sink_operator.h
+++ b/be/src/pipeline/exec/set_probe_sink_operator.h
@@ -115,6 +115,10 @@ public:
 
     bool is_shuffled_operator() const override { return true; }
     bool is_colocated_operator() const override { return _is_colocate; }
+    bool followed_by_shuffled_operator() const override {
+        return (is_shuffled_operator() && !is_colocated_operator()) ||
+               Base::_followed_by_shuffled_operator;
+    }
 
 private:
     void _finalize_probe(SetProbeSinkLocalState<is_intersect>& local_state);
diff --git a/be/src/pipeline/exec/set_sink_operator.h 
b/be/src/pipeline/exec/set_sink_operator.h
index 513612fb091..11c243ef24d 100644
--- a/be/src/pipeline/exec/set_sink_operator.h
+++ b/be/src/pipeline/exec/set_sink_operator.h
@@ -119,6 +119,10 @@ public:
 
     bool is_shuffled_operator() const override { return true; }
     bool is_colocated_operator() const override { return _is_colocate; }
+    bool followed_by_shuffled_operator() const override {
+        return (is_shuffled_operator() && !is_colocated_operator()) ||
+               Base::_followed_by_shuffled_operator;
+    }
 
 private:
     template <class HashTableContext, bool is_intersected>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to