cloud-fan commented on code in PR #49202:
URL: https://github.com/apache/spark/pull/49202#discussion_r1906666096
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1831,9 +1855,15 @@ object PushPredicateThroughNonJoin extends
Rule[LogicalPlan] with PredicateHelpe
}
if (pushDown.nonEmpty) {
- val pushDownPredicate = pushDown.reduce(And)
- val replaced = replaceAlias(pushDownPredicate, aliasMap)
- val newAggregate = aggregate.copy(child = Filter(replaced,
aggregate.child))
+ // Different from Project, Aggregate is not suitable for using With to
push down, because
+ // propagate the attributes directly need add the groupingExpressions
may cause regression.
+ // So Aggregate only need inline common expression from parent for
original project
+ // inheritance.
+ val newAggregateExpressions =
+ aggregate.aggregateExpressions ++ getWithAlias(pushDown.reduce(And))
Review Comment:
```suggestion
aggregate.aggregateExpressions ++
replaceAlias(getWithAlias(pushDown.reduce(And)), aliasMap)
```
--
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]