aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorDavies Liu <davies@databricks.com>2016-01-04 14:26:56 -0800
committerDavies Liu <davies.liu@gmail.com>2016-01-04 14:26:56 -0800
commitd084a2de3271fd8b0d29ee67e1e214e8b9d96d6d (patch)
tree208d156e5ee567d81ca35acbfcc3c0df929e5386 /sql/hive
parent93ef9b6a2aa1830170cb101f191022f2dda62c41 (diff)
downloadspark-d084a2de3271fd8b0d29ee67e1e214e8b9d96d6d.tar.gz
spark-d084a2de3271fd8b0d29ee67e1e214e8b9d96d6d.tar.bz2
spark-d084a2de3271fd8b0d29ee67e1e214e8b9d96d6d.zip
[SPARK-12541] [SQL] support cube/rollup as function
This PR enable cube/rollup as function, so they can be used as this: ``` select a, b, sum(c) from t group by rollup(a, b) ``` Author: Davies Liu <davies@databricks.com> Closes #10522 from davies/rollup.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala4
1 files changed, 2 insertions, 2 deletions
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 b1d841d1b5..cbfe09b31d 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
@@ -1121,12 +1121,12 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
}),
rollupGroupByClause.map(e => e match {
case Token("TOK_ROLLUP_GROUPBY", children) =>
- Rollup(children.map(nodeToExpr), withLateralView, selectExpressions)
+ Aggregate(Seq(Rollup(children.map(nodeToExpr))), selectExpressions, withLateralView)
case _ => sys.error("Expect WITH ROLLUP")
}),
cubeGroupByClause.map(e => e match {
case Token("TOK_CUBE_GROUPBY", children) =>
- Cube(children.map(nodeToExpr), withLateralView, selectExpressions)
+ Aggregate(Seq(Cube(children.map(nodeToExpr))), selectExpressions, withLateralView)
case _ => sys.error("Expect WITH CUBE")
}),
Some(Project(selectExpressions, withLateralView))).flatten.head