beliefer commented on a change in pull request #29135:
URL: https://github.com/apache/spark/pull/29135#discussion_r456363151



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggUtils.scala
##########
@@ -142,19 +142,25 @@ object AggUtils {
 
     val distinctAttributes = 
normalizedNamedDistinctExpressions.map(_.toAttribute)
     val groupingAttributes = groupingExpressions.map(_.toAttribute)
+    val distinctFilterAttributes = 
functionsWithDistinct.flatMap(_.filterAttributes.toSeq)
 
     // 1. Create an Aggregate Operator for partial aggregations.
     val partialAggregate: SparkPlan = {
       val aggregateExpressions = functionsWithoutDistinct.map(_.copy(mode = 
Partial))
       val aggregateAttributes = aggregateExpressions.map(_.resultAttribute)
       // We will group by the original grouping expression, plus an additional 
expression for the
-      // DISTINCT column. For example, for AVG(DISTINCT value) GROUP BY key, 
the grouping
-      // expressions will be [key, value].
+      // DISTINCT column and the referred attributes in the FILTER clause 
associated with each
+      // aggregate function. For example,
+      // 1.for AVG(DISTINCT value) GROUP BY key, the grouping expressions will 
be [key, value].
+      // 2.for AVG (DISTINCT value) Filter (WHERE age > 20) GROUP BY key, the 
grouping expression
+      // will be [key, value, age].

Review comment:
       Thanks for your remind.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to