You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2014/12/02 01:09:01 UTC
spark git commit: [SPARK-4529] [SQL] support view with column alias
Repository: spark
Updated Branches:
refs/heads/master 5edbcbfb6 -> 4df60a8cb
[SPARK-4529] [SQL] support view with column alias
Support view definition like
CREATE VIEW view3(valoo)
TBLPROPERTIES ("fear" = "factor")
AS SELECT upper(value) FROM src WHERE key=86;
[valoo as the alias of upper(value)]. This is missing part of SPARK-4239, for a fully view support.
Author: Daoyuan Wang <da...@intel.com>
Closes #3396 from adrian-wang/viewcolumn and squashes the following commits:
4d001d0 [Daoyuan Wang] support view with column alias
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4df60a8c
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4df60a8c
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4df60a8c
Branch: refs/heads/master
Commit: 4df60a8cbc58f2877787245c2a83b2de85579c82
Parents: 5edbcbf
Author: Daoyuan Wang <da...@intel.com>
Authored: Mon Dec 1 16:08:51 2014 -0800
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Mon Dec 1 16:08:51 2014 -0800
----------------------------------------------------------------------
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala | 2 +-
sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/4df60a8c/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
index b9283f6..f4c42bb 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
@@ -379,7 +379,7 @@ private[hive] object HiveQl {
protected def nameExpressions(exprs: Seq[Expression]): Seq[NamedExpression] = {
exprs.zipWithIndex.map {
case (ne: NamedExpression, _) => ne
- case (e, i) => Alias(e, s"c_$i")()
+ case (e, i) => Alias(e, s"_c$i")()
}
}
http://git-wip-us.apache.org/repos/asf/spark/blob/4df60a8c/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala
index b255a2e..fecf8fa 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUdfs.scala
@@ -279,7 +279,7 @@ private[hive] case class HiveGenericUdtf(
}
override protected def makeOutput() = {
- // Use column names when given, otherwise c_1, c_2, ... c_n.
+ // Use column names when given, otherwise _c1, _c2, ... _cn.
if (aliasNames.size == outputDataTypes.size) {
aliasNames.zip(outputDataTypes).map {
case (attrName, attrDataType) =>
@@ -288,7 +288,7 @@ private[hive] case class HiveGenericUdtf(
} else {
outputDataTypes.zipWithIndex.map {
case (attrDataType, i) =>
- AttributeReference(s"c_$i", attrDataType, nullable = true)()
+ AttributeReference(s"_c$i", attrDataType, nullable = true)()
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org