You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/30 17:02:59 UTC

[GitHub] [spark] seanli-rallyhealth commented on a change in pull request #26997: [SPARK-30343][SQL] Skip unnecessary checks in RewriteDistinctAggregates

seanli-rallyhealth commented on a change in pull request #26997: [SPARK-30343][SQL] Skip unnecessary checks in RewriteDistinctAggregates
URL: https://github.com/apache/spark/pull/26997#discussion_r362041105
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteDistinctAggregates.scala
 ##########
 @@ -101,8 +101,17 @@ import org.apache.spark.sql.types.IntegerType
  */
 object RewriteDistinctAggregates extends Rule[LogicalPlan] {
 
+  private def mayNeedtoRewrite(exprs: Seq[Expression]): Boolean = {
+    val distinctAggs = exprs.flatMap { _.collect {
+      case ae: AggregateExpression if ae.isDistinct => ae
+    }}
+    // We need at least two distinct aggregates for this rule because aggregation
 
 Review comment:
   suggest to add unit tests for each case of 0, 1, 2+

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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