HyukjinKwon commented on a change in pull request #32904: URL: https://github.com/apache/spark/pull/32904#discussion_r651698103
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RemoveRedundantAggregates.scala ########## @@ -67,4 +67,8 @@ object RemoveRedundantAggregates extends Rule[LogicalPlan] with AliasHelper { upperHasNoDuplicateSensitiveAgg && upperRefsOnlyDeterministicNonAgg } + + private def isDuplicateSensitive(ae: AggregateExpression): Boolean = { + !ae.isDistinct && !EliminateDistinct.isDuplicateAgnostic(ae.aggregateFunction) Review comment: If aggregate expr is distinct, it would make sense to consider it DuplicateAgnostic .. ? -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org