andrej-db commented on code in PR #45293:
URL: https://github.com/apache/spark/pull/45293#discussion_r1506024777


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/executeImmediate.scala:
##########
@@ -122,11 +122,14 @@ class SubstituteExecuteImmediate(val catalogManager: 
CatalogManager)
               resolveArguments(expressions))
           } else {
             val aliases = expressions.collect {
-              case (e: Alias) => e
+              case e: Alias => e
+              case u: UnresolvedAttribute => Alias(u, u.name)()

Review Comment:
   So, the engine converts the child of an Alias (UnresolvedAttribute) to 
VariableReference, which leads to the change of the name (`parm` -> 
`variablereference(system.session.parm='Hello')`). The name of the Alias 
remains, so when converted to an Alias it is rendered correctly.



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