924060929 commented on code in PR #63366:
URL: https://github.com/apache/doris/pull/63366#discussion_r3413654832
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java:
##########
@@ -740,6 +742,19 @@ protected void distribute(PhysicalPlan physicalPlan,
ExplainLevel explainLevel)
splitFragments(physicalPlan);
doDistribute(canUseNereidsDistributePlanner, explainLevel);
+
+ addLocalExchangeAfterDistribute();
Review Comment:
> @morrySnow just curious, why don't you impl it before translation and
after post process in Nereids?
(Answering the review-summary question here, anchored to where it actually
runs.)
It needs two inputs that only exist **after translation + distribute**, not
on the Nereids physical plan:
1. **PlanNode-level info** — `AddLocalExchange` walks the translated
`PlanNode` / `PlanFragment` tree via `PlanNode.enforceAndDeriveLocalExchange`
(`isSerialNode()` / `isSerialOperatorOnBe()`, the distribute-expr lists
serialized to BE thrift, the fragment sink type, …). Those are the legacy
`PlanNode`s the translator produces — they don't exist on the Nereids physical
operators.
2. **Instance counts** — whether to insert an LE (and the fan-out width)
depends on the per-BE instance count: `addLocalExchange` skips fragments where
`maxPerBeInstances <= 1` (mirroring BE's `_num_instances <= 1` no-op), and the
PASSTHROUGH fan-out targets `_num_instances`. Instance assignment is done by
`DistributePlanner`, which runs **after** translation.
So it runs right here — after `splitFragments()` + `doDistribute()` — the
first point where both the BE-facing PlanNode tree and the instance assignment
exist. Doing it pre-translation in Nereids would mean re-deriving fragment
structure + instance counts that haven't been computed yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]