vladimirg-db commented on code in PR #50769:
URL: https://github.com/apache/spark/pull/50769#discussion_r2068745207


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/resolver/AggregateResolver.scala:
##########
@@ -329,4 +332,17 @@ class AggregateResolver(operatorResolver: Resolver, 
expressionResolver: Expressi
       .candidates
       .isEmpty
   }
+
+  private def getGroupungAttributeIds(aggregate: Aggregate): HashSet[ExprId] = 
{
+    val groupingAttributeIds = new 
HashSet[ExprId](aggregate.groupingExpressions.size)
+    aggregate.groupingExpressions.foreach { rootExpression =>
+      rootExpression.foreach {
+        case attribute: AttributeReference =>
+          groupingAttributeIds.add(attribute.exprId)
+        case _ =>
+      }
+    }
+
+    groupingAttributeIds
+  }

Review Comment:
   Yeah, I don't like this as well. Problem is with ordinals and `ALL` - we 
would have to traverse those trees anyway (since we just substitute the trees 
during ordinal/`ALL` resolution). This is another pass, but it's simple and 
robust. Also, we don't recurse into subqueries, so it should be OK 
performance-wise.



-- 
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-unsubscr...@spark.apache.org

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