You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/08/23 04:37:32 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #42531: [SPARK-44846][SQL] Pull out complex grouping expressions after remove redundant aggregates

cloud-fan commented on code in PR #42531:
URL: https://github.com/apache/spark/pull/42531#discussion_r1302472237


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RemoveRedundantAggregates.scala:
##########
@@ -42,11 +42,12 @@ object RemoveRedundantAggregates extends Rule[LogicalPlan] with AliasHelper {
       )
 
       // We might have introduces non-deterministic grouping expression

Review Comment:
   I have a different idea. I think it's risky to put the new grouping expressions back to the `Aggregate`, as the grouping expression contains things in the SELECT list. This is a long-standing issue and I feel it's better to just create a `Project` below the `Aggregate` to calculate grouping expressions, and other optimizer rules can merge/eliminate this extra `Project` if it only contains `Attributes`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org