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

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


The following commit(s) were added to refs/heads/fe_local_shuffle by this push:
     new 51a2eda72d6 [fix](local shuffle) Fix COREDUMP: don't insert 
PASSTHROUGH LE between Exchange and streaming AGG
51a2eda72d6 is described below

commit 51a2eda72d61e9b34308362a7ce5825b26c6dcf1
Author: 924060929 <[email protected]>
AuthorDate: Sat Apr 11 21:36:55 2026 +0800

    [fix](local shuffle) Fix COREDUMP: don't insert PASSTHROUGH LE between 
Exchange and streaming AGG
    
    When a streaming/distinct-streaming AGG has a serial ExchangeNode child
    (e.g. UNPARTITIONED Exchange from MultiCastDataSinks), the AGG's
    enforceAndDeriveLocalExchange requested PASSTHROUGH. enforceChild then
    inserted a PASSTHROUGH LE between Exchange and AGG, creating a pipeline
    split that disconnected AggSink↔AggSource shared state (source_deps
    empty → DCHECK/SIGSEGV in set_ready_to_read).
    
    Fix: exclude ExchangeNode children from PASSTHROUGH requests in all 3
    AGG branches (distinct-streaming force-passthrough, streaming preagg,
    serialize no-group-key). In BE, need_to_local_exchange sees the serial
    Exchange in the pipeline and skips LE insertion — the FE now mirrors this
    by not requesting PASSTHROUGH when the child is an Exchange.
    
    Reproducer: multi-distinct COUNT/MIN query on table with many buckets
    (non-pooling) where MultiCastDataSinks feed serial UNPARTITIONED
    Exchanges into streaming AGG fragments.
---
 .../org/apache/doris/planner/AggregationNode.java  | 24 ++++++++++++++--------
 .../java/org/apache/doris/planner/PlanNode.java    |  8 +-------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/AggregationNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/AggregationNode.java
index 885d911bc71..ad814c1d4f2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/AggregationNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/AggregationNode.java
@@ -285,7 +285,11 @@ public class AggregationNode extends PlanNode {
                 } else {
                     requireChild = parentRequire.autoRequireHash();
                 }
-            } else if 
(sessionVariable.enableDistinctStreamingAggForcePassthrough) {
+            } else if 
(sessionVariable.enableDistinctStreamingAggForcePassthrough
+                    && !(children.get(0) instanceof ExchangeNode)) {
+                // Don't request PASSTHROUGH for serial ExchangeNode children 
— inserting
+                // PASSTHROUGH between Exchange and streaming AGG breaks 
AggSink↔AggSource
+                // shared state. See streaming preagg branch for detailed 
explanation.
                 requireChild = LocalExchangeTypeRequire.requirePassthrough();
             } else {
                 requireChild = LocalExchangeTypeRequire.noRequire();
@@ -298,14 +302,16 @@ public class AggregationNode extends PlanNode {
                     && 
sessionVariable.enableStreamingAggHashJoinForcePassthrough) {
                 requireChild = LocalExchangeTypeRequire.requirePassthrough();
             } else if (fragment != null && 
fragment.useSerialSource(connectContext)
-                    && children.get(0).isSerialOperator()) {
+                    && children.get(0).isSerialOperator()
+                    && !(children.get(0) instanceof ExchangeNode)) {
                 // Mirrors BE 
StreamingAggOperatorX::required_data_distribution():
                 //   return _child->is_serial_operator() ? PASSTHROUGH : NOOP
-                // Check the IMMEDIATE child's serialness (e.g. pooling 
OlapScan → serial=true,
-                // NLJ (INNER/LEFT) → serial=false).  Using 
fragment.useSerialSource() alone
-                // over-fires when NLJ exchanges have been inserted below — in 
BE, after an
-                // APT exchange is inserted, the new pipeline has 
_use_serial_source=false,
-                // so StreamingAgg returns NOOP in that pipeline.
+                // Only request PASSTHROUGH for serial non-Exchange children 
(e.g. pooling
+                // OlapScan). For serial ExchangeNode (e.g. UNPARTITIONED from 
MultiCast),
+                // don't request PASSTHROUGH: in BE, need_to_local_exchange 
sees the serial
+                // Exchange in the pipeline and skips LE insertion. Inserting 
PASSTHROUGH
+                // between Exchange and streaming AGG creates a pipeline split 
that breaks
+                // AggSink↔AggSource shared state → DCHECK/SIGSEGV crash.
                 requireChild = LocalExchangeTypeRequire.requirePassthrough();
             } else {
                 requireChild = LocalExchangeTypeRequire.noRequire();
@@ -318,7 +324,9 @@ public class AggregationNode extends PlanNode {
                     requireChild = LocalExchangeTypeRequire.noRequire();
                 } else {
                     // Serialize agg, no group key: base class → child serial 
→ PASSTHROUGH, else NOOP
-                    if (fragment != null && 
fragment.useSerialSource(connectContext)) {
+                    // Exclude ExchangeNode children for same reason as 
streaming AGG above.
+                    if (fragment != null && 
fragment.useSerialSource(connectContext)
+                            && !(children.get(0) instanceof ExchangeNode)) {
                         requireChild = 
LocalExchangeTypeRequire.requirePassthrough();
                     } else {
                         requireChild = LocalExchangeTypeRequire.noRequire();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
index 251d81def1a..cad9745c9eb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
@@ -979,13 +979,7 @@ public abstract class PlanNode extends TreeNode<PlanNode> {
         Pair<PlanNode, LocalExchangeType> childOutput = 
deriveAndEnforceChildLocalExchange(
                 translatorContext, originChild, requireChild, childIndex);
         if (!requireChild.satisfy(childOutput.second)) {
-            // Mirrors BE need_to_local_exchange: any_of(operators[idx..end], 
is_serial) → skip.
-            // Check ancestors (hasSerialAncestorInPipeline), self 
(isSerialOperator), AND child.
-            // When the child is serial (e.g. UNPARTITIONED Exchange), 
inserting a PASSTHROUGH LE
-            // creates a pipeline split where AggSink↔AggSource shared state 
becomes disconnected
-            // because the LE boundary puts them in separate pipelines with 
mismatched task counts.
-            if (translatorContext.hasSerialAncestorInPipeline(this) || 
isSerialOperator()
-                    || childOutput.first.isSerialOperator()) {
+            if (translatorContext.hasSerialAncestorInPipeline(this) || 
isSerialOperator()) {
                 return childOutput;
             }
             LocalExchangeType preferType = 
AddLocalExchange.resolveExchangeType(


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

Reply via email to