feiniaofeiafei commented on code in PR #64892:
URL: https://github.com/apache/doris/pull/64892#discussion_r4068191549


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/AggregateUtils.java:
##########
@@ -225,6 +214,34 @@ public static boolean 
isOrderKeysMatchGroupKeys(List<OrderKey> orderKeys,
         return true;
     }
 
+    /**
+     * Whether the whole aggregate node consumes raw rows and produces final 
values.
+     *
+     * <p>The node-level mode alone is insufficient: DISTINCT splitting can 
build a
+     * GLOBAL/INPUT_TO_RESULT dedup node whose non-distinct aggregate 
expressions still
+     * produce serialized buffers. Such a node must use the regular 
aggregation path.</p>
+     */
+    public static boolean isFullyFinalizedOnePhaseAgg(
+            PhysicalHashAggregate<? extends Plan> aggregate) {
+        if (aggregate.getAggPhase() != AggPhase.GLOBAL
+                || aggregate.getAggMode() != AggMode.INPUT_TO_RESULT) {
+            return false;
+        }
+        return !ExpressionUtils.deapAnyMatch(aggregate.getOutputExpressions(), 
expression ->

Review Comment:
   return ExpressionUtils.deapNoneMatch(aggregate.getOutputExpressions(), 
expression ->
           expression instanceof AggregateExpression
                   && ((AggregateExpression) 
expression).getAggregateParam().aggMode != AggMode.INPUT_TO_RESULT);



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