From 8e1e0a2ea956697c46060b9c43a7203a541ca703 Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Tue, 26 May 2020 09:11:12 +0900 Subject: [PATCH] Address comments --- .../spark/sql/catalyst/expressions/complexTypeCreator.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala index 9f522ec7cef48..5212ef3930bc9 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala @@ -313,7 +313,7 @@ case object NamePlaceholder extends LeafExpression with Unevaluable { */ object CreateStruct { /** - * Returns a named struct with generating names or using the names when available. + * Returns a named struct with generated names or using the names when available. * It should not be used for `struct` expressions or functions explicitly called * by users. */ @@ -449,6 +449,9 @@ case class CreateNamedStruct(children: Seq[Expression]) extends Expression { """.stripMargin, isNull = FalseLiteral) } + // There is an alias set at `CreateStruct.create`. If there is an alias, + // this is the struct function explicitly called by a user and we should + // respect it in the SQL string as `struct(...)`. override def prettyName: String = getTagValue(FUNC_ALIAS).getOrElse("named_struct") override def sql: String = getTagValue(FUNC_ALIAS).map { alias =>