zml1206 commented on code in PR #42531:
URL: https://github.com/apache/spark/pull/42531#discussion_r1297486130
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -644,6 +644,8 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
_.containsAnyPattern(CASE_WHEN, IF), ruleId) {
+ case a @ Aggregate(groupingExpressions, _, _)
+ if !groupingExpressions.forall(_.isInstanceOf[NamedExpression]) => a
Review Comment:
Thanks. In `PhysicalAggregation`,if the expression is not a
NamedExpressions, it add an alias. Also I'm not sure if complex expressions are
generated anywhere else other than `RemoveRedundantAggregates`. So is it safer
to fix `PushFoldableIntoBranches`, and the impact is smaller?
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -644,6 +644,8 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
_.containsAnyPattern(CASE_WHEN, IF), ruleId) {
+ case a @ Aggregate(groupingExpressions, _, _)
+ if !groupingExpressions.forall(_.isInstanceOf[NamedExpression]) => a
Review Comment:
Thanks. In `PhysicalAggregation`,if the expression is not a
NamedExpressions, it add an alias. Also I'm not sure if complex expressions are
generated anywhere else other than `RemoveRedundantAggregates`. So is it safer
to fix `PushFoldableIntoBranches`, and the impact is smaller?
--
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]