allisonwang-db commented on a change in pull request #33498:
URL: https://github.com/apache/spark/pull/33498#discussion_r676903691



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2553,8 +2553,9 @@ class Analyzer(override val catalogManager: 
CatalogManager)
               // a table `t` has two columns `c1` and `c2`, for query `SELECT 
... FROM t
               // GROUP BY c1 HAVING c2 = 0`, even though we can resolve column 
`c2` here, we
               // should undo it later and fail with "Column c2 not found".
-              agg.child.resolve(u.nameParts, 
resolver).map(TempResolvedColumn(_, u.nameParts))
-                .getOrElse(u)
+              agg.child.resolve(u.nameParts, resolver).map(_.transformUp {
+                case a: Attribute => TempResolvedColumn(a, u.nameParts)

Review comment:
       Here actually we shouldn't transform attributes, because for nested 
fields this `u.nameParts` will not correspond to the attribute. Updated to 
specifically match Alias.




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