cloud-fan commented on a change in pull request #31758:
URL: https://github.com/apache/spark/pull/31758#discussion_r590046506



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -3975,8 +3964,15 @@ object ResolveCreateNamedStruct extends 
Rule[LogicalPlan] {
   override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveExpressions 
{
     case e: CreateNamedStruct if !e.resolved =>
       val children = e.children.grouped(2).flatMap {
-        case Seq(NamePlaceholder, e: NamedExpression) if e.resolved =>
-          Seq(Literal(e.name), e)
+        case Seq(NamePlaceholder, ne: NamedExpression) if ne.resolved =>
+          Seq(Literal(ne.name), ne)
+        case Seq(NamePlaceholder, g @ GetStructField(child, _, Some(name))) if 
child.resolved =>

Review comment:
       This fix is necessary even without the refactor. In some places, we 
remove non-top-level alias when resolving expressions, which breaks this place.
   
   The refactor always removes non-top-level alias and exposes this bug. I can 
backport this fix later if people ask, but there is no bug report for this yet.




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

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