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 2019/10/29 04:29:18 UTC

[GitHub] [spark] alfozan commented on a change in pull request #25028: [SPARK-28227][SQL] Support TRANSFORM with aggregation.

alfozan commented on a change in pull request #25028: [SPARK-28227][SQL] Support TRANSFORM with aggregation.
URL: https://github.com/apache/spark/pull/25028#discussion_r339890074
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -506,12 +511,71 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging
         AttributeReference("value", StringType)()), true)
     }
 
+    val namedExpressions = expressions.map {
+      case e: NamedExpression => e
+      case e: Expression => UnresolvedAlias(e)
+    }
 
 Review comment:
   re discussion in https://github.com/apache/spark/pull/25028#issuecomment-547230458 and https://github.com/apache/spark/pull/25028#issuecomment-547246714 and 
   
   Alternative suggestion:
   ```
      val aliasFunc = (position: Int, e: Expression) => s"gen_alias_${position}"
   
       val namedExpressions = expressions.zipWithIndex.map {
         case (e: NamedExpression, _) => e
         case (e: Expression, index) => UnresolvedAlias(e, Some(aliasFunc(index, _)))
       }
   ```

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


With regards,
Apache Git Services

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