This is an automated email from the ASF dual-hosted git repository.
924060929 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 4f37b1a6de0 [fix](local shuffle) Fix serial ancestor flag propagation
for pipeline-splitting operators
4f37b1a6de0 is described below
commit 4f37b1a6de09ad1b65158f0a66006770fcbee011
Author: 924060929 <[email protected]>
AuthorDate: Thu Apr 23 12:55:04 2026 +0800
[fix](local shuffle) Fix serial ancestor flag propagation for
pipeline-splitting operators
For pipeline-splitting operators like non-streaming AGG, the child
(e.g. Exchange) is in the sink pipeline while the parent is in the
source pipeline. The serial ancestor flag should:
- Drop inherited serial flag from parent (different pipeline boundary)
- Keep the node's own serial status (child shares pipeline with sink)
Before this fix, shouldResetSerialFlagForChild=true would discard
both the inherited flag AND the node's own isSerialNode(), causing
Exchange to not see AGG_Sink's serial status. This led Exchange to
incorrectly insert a PASSTHROUGH LE between itself and AGG_Sink,
creating AGG paired pipeline num_tasks mismatch (sink=4 vs source=1)
and crashing with "must set shared state" / "source_deps_size=0".
Also remove debug logging added during investigation.
---
be/src/exec/pipeline/pipeline_fragment_context.cpp | 5 +++--
.../main/java/org/apache/doris/planner/AggregationNode.java | 7 +++++++
.../main/java/org/apache/doris/planner/ExchangeNode.java | 1 -
.../src/main/java/org/apache/doris/planner/PlanNode.java | 13 ++++++++++---
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/be/src/exec/pipeline/pipeline_fragment_context.cpp
b/be/src/exec/pipeline/pipeline_fragment_context.cpp
index 739330bd7ab..8cfe3fc3cee 100644
--- a/be/src/exec/pipeline/pipeline_fragment_context.cpp
+++ b/be/src/exec/pipeline/pipeline_fragment_context.cpp
@@ -1177,10 +1177,11 @@ Status PipelineFragmentContext::_plan_local_exchange(
do_local_exchange = false;
// Plan local exchange for each operator.
for (; idx < ops.size();) {
- if
(ops[idx]->required_data_distribution(_runtime_state.get()).need_local_exchange())
{
+ auto _le_req =
ops[idx]->required_data_distribution(_runtime_state.get());
+ if (_le_req.need_local_exchange()) {
RETURN_IF_ERROR(_add_local_exchange(
pip_idx, idx, ops[idx]->node_id(),
_runtime_state->obj_pool(), pip,
-
ops[idx]->required_data_distribution(_runtime_state.get()),
+ _le_req,
&do_local_exchange, num_buckets,
bucket_seq_to_instance_idx,
shuffle_idx_to_instance_idx));
}
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 42e2186db1e..562199a2e89 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
@@ -287,6 +287,9 @@ public class AggregationNode extends PlanNode {
}
} else if
(sessionVariable.enableDistinctStreamingAggForcePassthrough) {
requireChild = LocalExchangeTypeRequire.requirePassthrough();
+ } else if (children.get(0).isSerialOperatorOnBe(connectContext)) {
+ // BE base class: _child->is_serial_operator() ? PASSTHROUGH :
NOOP
+ requireChild = LocalExchangeTypeRequire.requirePassthrough();
} else {
requireChild = LocalExchangeTypeRequire.noRequire();
}
@@ -352,6 +355,10 @@ public class AggregationNode extends PlanNode {
@Override
protected boolean shouldResetSerialFlagForChild(int childIndex) {
+ // Non-streaming AGG is a pipeline breaker: child is in AGG_Sink
pipeline,
+ // parent is in AGG_Source pipeline. Reset inherited serial flag from
parent
+ // (different pipeline), but enforceRequire still adds this node's own
+ // isSerialNode() so the child sees AGG_Sink's serial status correctly.
return !useStreamingPreagg;
}
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java
index 0b58ff52852..dd86be8fbde 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java
@@ -102,7 +102,6 @@ public class ExchangeNode extends PlanNode {
@Override
protected void toThrift(TPlanNode msg) {
- // Reuse isSerialOperatorOnBe() — single source of truth for BE serial
condition.
msg.setIsSerialOperator(isSerialOperatorOnBe(ConnectContext.get()));
msg.node_type = TPlanNodeType.EXCHANGE_NODE;
msg.exchange_node = new TExchangeNode();
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 a567b1d9d15..effcc48edc0 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
@@ -983,9 +983,16 @@ public abstract class PlanNode extends TreeNode<PlanNode> {
protected Pair<PlanNode, LocalExchangeType> enforceRequire(
PlanTranslatorContext translatorContext, PlanNode child, int
childIndex,
LocalExchangeTypeRequire require) {
- // 1. Propagate serial-ancestor flag to child
- boolean childHasSerialAncestor =
shouldResetSerialFlagForChild(childIndex)
- ? false : translatorContext.hasSerialAncestorInPipeline(this)
|| isSerialNode();
+ // 1. Propagate serial-ancestor flag to child.
+ // For pipeline-splitting operators (shouldReset=true, e.g.
non-streaming AGG):
+ // Drop inherited serial flag from parent (parent is in a different
pipeline),
+ // but keep this node's own serial status (child is in the same
pipeline as this
+ // node's sink, e.g. Exchange is in AGG_Sink pipeline).
+ // For non-splitting operators (shouldReset=false, e.g. streaming AGG):
+ // Inherit parent's serial flag + this node's own.
+ boolean inheritedSerial = shouldResetSerialFlagForChild(childIndex)
+ ? false : translatorContext.hasSerialAncestorInPipeline(this);
+ boolean childHasSerialAncestor = inheritedSerial || isSerialNode();
translatorContext.setHasSerialAncestorInPipeline(child,
childHasSerialAncestor);
// 2. Recurse child (Layer 2: child declares its own require/output)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]