shrirangmhalgi commented on code in PR #55892:
URL: https://github.com/apache/spark/pull/55892#discussion_r3284562574


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -3260,9 +3260,11 @@ class Analyzer(
       // The star will be expanded differently if we insert `Generate` under 
`Project` too early.
       case p @ Project(projectList, child) if 
!projectList.exists(_.exists(_.isInstanceOf[Star])) =>
         val (resolvedGenerator, newProjectList) = projectList
-          .map(trimNonTopLevelAliases)
           .foldLeft((None: Option[Generate], Nil: Seq[NamedExpression])) { 
(res, e) =>
-            e match {
+            // SPARK-48091: Only trim aliases on the generator expression 
itself. Trimming
+            // non-generator expressions strips aliases inside lambda 
functions (e.g.,
+            // struct(x.as("data"))) before they can be resolved into struct 
field names.

Review Comment:
   Having a broader solution makes more sense. Added the same in the followup 
commit. This is no longer relevant. 



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