github-actions[bot] commented on code in PR #68651:
URL: https://github.com/apache/doris/pull/68651#discussion_r4145545631
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java:
##########
@@ -151,6 +151,19 @@ private boolean
shouldBanOnePhaseAgg(PhysicalHashAggregate<? extends Plan> aggre
// group by key is skew
return skewOnShuffleExpr(aggregate);
} else {
+ // Bucketed hash agg exception: allow one-phase GLOBAL + distribute
+ // pattern so the translator can fuse it into
BucketedAggregationNode.
+ // Only aggregates with the shape the translator actually fuses
qualify;
+ // the others would keep their exchange and stay banned as before.
That
+ // includes a distribute on the parent's keys
(agg_shuffle_use_parent_key),
+ // a strict subset of the GROUP BY keys, which the translator
never fuses.
+ // Gate with data-volume checks using group-level statistics to
avoid
+ // generating this pattern when bucketed agg is unsuitable.
+ DistributionSpec childDistribution
+ = ((PhysicalDistribute<?>)
children.get(0).getPlan()).getDistributionSpec();
+ if (AggregateUtils.isBucketedHashAggFusible(aggregate,
childDistribution)) {
Review Comment:
[P2] Apply the translator's subtree eligibility before exempting this
one-phase plan. For `GlobalAgg(k,SUM(m)) -> Distribute(HASH(k)) ->
GlobalAgg(k,a,MAX(v) AS m) -> Scan`, the exact-key check here admits the outer
aggregate and `CostModel` halves its cost, but `isSingleOlapScanPipeline`
rejects the nested aggregate, so translation keeps an exchange of all inner
rows and a regular aggregate. A projected `CTEConsumer` similarly evades
`childIsCTEConsumer()` and is rejected by the translator's recursive CTE check.
With many input rows and few output groups, the discount can favor these
unfused plans over local preaggregation. Check the full child subtree when
granting this exception and test the default optimizer choice for both shapes.
--
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]