github-actions[bot] commented on code in PR #67433:
URL: https://github.com/apache/doris/pull/67433#discussion_r4430010750


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -3386,6 +3405,301 @@ private PlanFragment connectJoinNode(HashJoinNode 
hashJoinNode, PlanFragment lef
         return leftFragment;
     }
 
+    private PlanFragment connectGroupJoinNode(GroupJoinNode groupJoinNode, 
PlanFragment leftFragment,
+            PlanFragment rightFragment, PlanTranslatorContext context, 
AbstractPlan groupJoin) {
+        groupJoinNode.setChild(0, leftFragment.getPlanRoot());
+        groupJoinNode.setChild(1, rightFragment.getPlanRoot());
+        setPlanRoot(leftFragment, groupJoinNode, groupJoin);
+        context.mergePlanFragment(rightFragment, leftFragment);
+        for (PlanFragment rightChild : rightFragment.getChildren()) {
+            leftFragment.addChild(rightChild);
+        }
+        return leftFragment;
+    }
+
+    /**
+     * V2: Try to fuse HashAggregate(HashJoin) into GroupJoin directly in the 
translator stage.
+     * <p>
+     * When the aggregate's child is an INNER hash join with compatible 
group-by/join-key,
+     * generate a GroupJoinNode instead of separate AggregationNode + 
HashJoinNode.
+     * Returns null if conditions are not met — caller falls through to normal 
translation.
+     */
+    private PlanFragment maybeTranslateToGroupJoin(
+            Plan aggregate,
+            PlanTranslatorContext context) {
+        // Gate: session variable. Fusion requires the Nereids distribute 
planner. The legacy
+        // Coordinator assigns fragments with BucketShuffleJoinController, 
whose detector only
+        // recognizes HashJoinNode, so a fused BUCKET_SHUFFLE GroupJoin would 
get generic scan
+        // assignment and then fail its bucket-shuffle sink check. Forcing the 
legacy distributor
+        // therefore falls back to the ordinary hash join + aggregation plan.
+        ConnectContext connectContext = ConnectContext.get();
+        if (connectContext == null

Review Comment:
   [P1] Disable GroupJoin fusion when force spill is enabled. The gate checks 
only `enableSpill`, but BE `RuntimeState::enable_spill()` also becomes true for 
`enable_force_spill`. GroupJoin has no spill sink/source or 
revocable-memory/revoke path, so a force-spill query can still receive 
GROUP_JOIN_NODE and stall or hit the memory limit instead of using the 
supported hash join plus aggregate path. Gate on the effective spill setting 
(`enableSpill || enableForceSpill`) or add GroupJoin spill support, and cover 
`enable_spill=false, enable_force_spill=true`.



-- 
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]

Reply via email to