Skip to content

Commit 4d001d0

Browse files
committed
support view with column alias
1 parent e216ffa commit 4d001d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ private[hive] object HiveQl {
380380
protected def nameExpressions(exprs: Seq[Expression]): Seq[NamedExpression] = {
381381
exprs.zipWithIndex.map {
382382
case (ne: NamedExpression, _) => ne
383-
case (e, i) => Alias(e, s"c_$i")()
383+
case (e, i) => Alias(e, s"_c$i")()
384384
}
385385
}
386386

sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private[hive] case class HiveGenericUdtf(
281281
}
282282

283283
override protected def makeOutput() = {
284-
// Use column names when given, otherwise c_1, c_2, ... c_n.
284+
// Use column names when given, otherwise _c1, _c2, ... _cn.
285285
if (aliasNames.size == outputDataTypes.size) {
286286
aliasNames.zip(outputDataTypes).map {
287287
case (attrName, attrDataType) =>
@@ -290,7 +290,7 @@ private[hive] case class HiveGenericUdtf(
290290
} else {
291291
outputDataTypes.zipWithIndex.map {
292292
case (attrDataType, i) =>
293-
AttributeReference(s"c_$i", attrDataType, nullable = true)()
293+
AttributeReference(s"_c$i", attrDataType, nullable = true)()
294294
}
295295
}
296296
}

0 commit comments

Comments
 (0)