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 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org