HyukjinKwon commented on a change in pull request #32904:
URL: https://github.com/apache/spark/pull/32904#discussion_r651696949



##########
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:
       But that's what we're already doing:
   
   ```scala
   object EliminateDistinct extends Rule[LogicalPlan] {
       ...
       case ae: AggregateExpression if ae.isDistinct && 
isDuplicateAgnostic(ae.aggregateFunction) =>
         ae.copy(isDistinct = false)
       ...
   ```
   
   




-- 
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

Reply via email to