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 d5a383d6a71 [fix](local shuffle) Fix NLJ COREDUMP: restrict 
childUsePoolingScan to ScanNode probe child
d5a383d6a71 is described below

commit d5a383d6a716e51387370271e9990056df20a02f
Author: 924060929 <[email protected]>
AuthorDate: Mon Apr 13 13:13:40 2026 +0800

    [fix](local shuffle) Fix NLJ COREDUMP: restrict childUsePoolingScan to 
ScanNode probe child
    
    NestedLoopJoinBuildSinkOperatorX::sink crashed in set_ready_to_read()
    with empty source_deps. Root cause: fragment.useSerialSource() returned
    true for fragments with serial Exchange children (not actual pooling
    scan), causing NLJ to request APT for probe + BROADCAST for build.
    The insertLocalExchange guard skips APT (serial non-Scan), but BROADCAST
    is exempted → probe has 1 task, build has N tasks → shared state mismatch.
    
    Fix: add `&& children.get(0) instanceof ScanNode` to childUsePoolingScan
    so NLJ only requests APT/BROADCAST when the probe child is an actual
    pooling scan. For serial non-Scan children, both sides get noRequire,
    matching BE-native behavior.
---
 .../org/apache/doris/planner/NestedLoopJoinNode.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/NestedLoopJoinNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/NestedLoopJoinNode.java
index e8fdd638143..62e2163a7b7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/NestedLoopJoinNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/NestedLoopJoinNode.java
@@ -179,13 +179,15 @@ public class NestedLoopJoinNode extends JoinNodeBase {
     public Pair<PlanNode, LocalExchangeType> 
enforceAndDeriveLocalExchange(PlanTranslatorContext translatorContext,
             PlanNode parent, LocalExchangeTypeRequire parentRequire) {
 
-        // Use fragment.useSerialSource() directly instead of also checking
-        // (children instanceof ScanNode).  When NLJs are nested, the outer 
NLJ's
-        // children are inner NLJ / ExchangeNode (not ScanNode), but pooling 
scan
-        // handling is still needed — without it, the serial Exchange on the 
build
-        // side won't get a BROADCAST local exchange, causing "must set shared
-        // state, in CROSS_JOIN_OPERATOR" for instances 1+.
-        boolean childUsePoolingScan = 
fragment.useSerialSource(translatorContext.getConnectContext());
+        // Only request APT/BROADCAST when the probe child is an actual serial 
ScanNode
+        // (pooling scan). For serial non-Scan children (Exchange, AGG, NLJ), 
the
+        // insertLocalExchange guard skips APT on probe side (serial non-Scan 
→ no LE),
+        // but BROADCAST on build side would still be inserted → probe has 1 
task but
+        // build has N tasks → NLJ source_deps empty for tasks 1..N-1 → crash.
+        // Original comment: nested NLJs need pooling handling — but that case 
is now
+        // covered by the serial NLJ branch (isSerialOperator) which skips 
both sides.
+        boolean childUsePoolingScan = 
fragment.useSerialSource(translatorContext.getConnectContext())
+                && children.get(0) instanceof ScanNode;
 
         LocalExchangeTypeRequire probeSideRequire;
         LocalExchangeTypeRequire buildSideRequire;


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

Reply via email to