github-actions[bot] commented on code in PR #62347:
URL: https://github.com/apache/doris/pull/62347#discussion_r3063556092
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java:
##########
@@ -229,9 +230,24 @@ private boolean requireGather(PhysicalProperties
requiredChildProperty) {
* no matter x.ndv is high or not, it is not worthwhile to shuffle A and B
by x
* and hence we forbid one phase agg */
private boolean banAggUnionAll(PhysicalHashAggregate<? extends Plan>
aggregate) {
- return aggregate.getAggMode() == AggMode.INPUT_TO_RESULT
- && children.get(0).getPlan() instanceof PhysicalUnion
- && !((PhysicalUnion) children.get(0).getPlan()).isDistinct();
+ if (aggregate.getAggMode() == AggMode.INPUT_TO_RESULT &&
children.get(0).getPlan() instanceof PhysicalUnion
+ && !((PhysicalUnion) children.get(0).getPlan()).isDistinct()) {
+ GroupExpression gExprUnion = children.get(0);
Review Comment:
`groupExpression.getPlan() instanceof PhysicalDistribute` is too narrow
here. A UNION ALL branch can still be explicitly shuffled for the outer agg
even when the branch root is a pass-through node such as `PhysicalProject` or
`PhysicalFilter`: `RequestPropertyDeriver` propagates the hash requirement
through those nodes, and `ChildOutputPropertyDeriver` preserves the child
distribution. In that case the best plan for `pair.second.get(i)` is the
wrapper node rather than the `PhysicalDistribute`, so this check returns
`false` and one-phase agg is incorrectly allowed again. A query like `SELECT k
FROM (SELECT a AS k FROM t1 WHERE p = 1 UNION ALL SELECT a AS k FROM t2 WHERE p
= 2) u GROUP BY k` can hit that shape.
--
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]