924060929 commented on code in PR #66339:
URL: https://github.com/apache/doris/pull/66339#discussion_r3702100377


##########
fe/fe-core/src/main/java/org/apache/doris/planner/AggregationNode.java:
##########
@@ -310,7 +310,11 @@ public Pair<PlanNode, LocalExchangeType> 
enforceAndDeriveLocalExchange(
             }
         } else if (useStreamingPreagg) {
             // StreamingAggOperatorX
-            if (children.get(0) instanceof HashJoinNode
+            // Repeat expands grouping sets before this local preaggregation. 
Use PASSTHROUGH
+            // to distribute the expanded blocks without hashing every row.
+            if (!needsFinalize && children.get(0) instanceof RepeatNode) {

Review Comment:
   This special case unconditionally inserts a local exchange and bypasses the 
opt-out semantics of `enable_local_exchange_before_streaming_agg`.
   
   That dedicated switch was added with a default of `false` specifically so 
StreamingAgg preserves its inherited distribution unless local exchange is 
explicitly enabled. In the BE path, the new Repeat check likewise runs before 
`enable_local_exchange_before_streaming_agg()` is checked. In the FE path, this 
branch also precedes the existing `enableLeBeforeAgg` fallback and does not 
consult the streaming-specific switch at all.
   
   A two-phase grouping-sets query therefore gets `StreamingAgg <- 
LE(PASSTHROUGH) <- Repeat` even when the streaming-agg switch is false. This 
should not change query results because this is partial aggregation followed by 
a final merge, but it makes the extra pipeline boundary, queues, and memory 
overhead impossible to disable, and silently changes the default behavior 
established by #66222.
   
   Please gate the Repeat PASSTHROUGH optimization with 
`enableLocalExchangeBeforeStreamingAgg` here and with 
`enable_local_exchange_before_streaming_agg()` in BE, and add FE-/BE-planned 
tests for both switch values. If Repeat is intentionally meant to ignore the 
existing switch, that needs an explicit separately named switch and documented 
default behavior rather than bypassing the current opt-out.



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