englefly commented on code in PR #65024:
URL: https://github.com/apache/doris/pull/65024#discussion_r3504153068
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModel.java:
##########
@@ -361,25 +362,25 @@ public Cost visitPhysicalHashAggregate(
inputStatistics.getRowCount() / beNumber, 0);
} else {
int factor = aggregate.getGroupByExpressions().isEmpty() ? 1 :
beNumber;
- // global
+ double rowCost = inputStatistics.getRowCount() / factor;
+
+ // Bucketed fusion discount: when the one-phase GLOBAL
INPUT_TO_RESULT
+ // aggregate is generated with a PhysicalDistribute child on
single BE,
+ // the translator will fuse them into a BucketedAggregationNode.
+ // Apply a discount to make this path preferred over two-phase
+ // (local+global) aggregation which requires extra
serialize/deserialize.
+ if (aggregate.getAggMode() == AggMode.INPUT_TO_RESULT
+ && beNumber == 1
+ &&
AggregateUtils.isBucketedHashAggEnabled(aggregate.getGroupByExpressions().size())
+ && inputStatistics.getRowCount()
+ >=
context.getSessionVariable().bucketedAggMinInputRows) {
Review Comment:
done
--
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]