You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/11 07:29:25 UTC

[GitHub] [spark] viirya commented on a change in pull request #31758: [SPARK-34639][SQL] Always remove unnecessary Alias in Analyzer.resolveExpression

viirya commented on a change in pull request #31758:
URL: https://github.com/apache/spark/pull/31758#discussion_r592122159



##########
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:
       Only `GetStructField`, `GetArrayStructFields` and `GetMapValue` are the possible expressions here?
   
   Can it be `case Seq(NamePlaceholder, other expression)`?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org