hemanthboyina commented on code in PR #58544:
URL: https://github.com/apache/spark/pull/58544#discussion_r4247005276


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -3626,6 +3628,16 @@ class Analyzer(
             extractedExprMap.getOrElseUpdate(agg.canonicalized,
               Alias(agg, s"_w${extractedExprMap.size}")()).toAttribute
 
+          // Extracts a non-window sub-expression that matches a grouping 
expression as a whole
+          // (e.g. UPPER(country) when the query groups by UPPER(country)). 
Without this, the
+          // transform would descend into it and extract its underlying 
attributes (e.g. country),
+          // which are not part of the GROUP BY clause and would make the 
child Aggregate invalid
+          // (SPARK-59175). Bare grouping attributes are left to the 
`Attribute` case below.
+          case e: Expression
+              if !e.isInstanceOf[Attribute] && !e.foldable && 
!hasWindowFunction(e) &&
+                groupExpressions.exists(_.semanticEquals(e)) =>

Review Comment:
   done



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

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