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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -3253,7 +3254,9 @@ private boolean 
supportsTwoPhaseAgg(PhysicalHashAggregate<? extends Plan> aggreg
                 }
                 if (c instanceof AggregateExpression) {
                     AggregateFunction func = ((AggregateExpression) 
c).getFunction();
-                    if (!func.supportAggregatePhase(AggregatePhase.TWO)) {
+                    if (!func.supportAggregatePhase(AggregatePhase.TWO)
+                            || func instanceof MultiDistinction
+                            || 
func.children().stream().anyMatch(OrderExpression.class::isInstance)) {

Review Comment:
   **[P2] Keep optimizer eligibility aligned with this rejection**
   
   This check runs only after memo optimization, but the earlier bucketed 
decisions still treat these functions as fusible. In automatic phase on one BE 
with multiple instances, `ChildrenPropertiesRegulator` admits the 
normally-banned `GLOBAL + Distribute` one-phase candidate using only 
`isBucketedHashAggEnabled`, `CostModel` applies the 0.5 bucketed discount, and 
`ChildOutputPropertyDeriver` advertises `ANY`. This method then rejects an 
ordered/multi-distinct aggregate and the ordinary translator keeps the 
exchange, so a regular one-phase plan can shuffle raw rows (and gain redundant 
parent exchanges) after being selected under bucketed-fusion assumptions. 
Please share the phase/order/multi-distinct eligibility with the regulator, 
cost model, and output-property derivation, and cover the normal `agg_phase=0` 
selection path; the new `agg_phase=1` test bypasses it.



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