hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [34/46] hive git commit: HIVE-15981 : Allow empty grouping sets (Zoltan Haindrich via Ashutosh Chauhan)
Date Mon, 13 Mar 2017 19:42:35 GMT
HIVE-15981 : Allow empty grouping sets (Zoltan Haindrich via Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f6d1ac2c
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f6d1ac2c
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f6d1ac2c

Branch: refs/heads/hive-14535
Commit: f6d1ac2c0e90be59df5b42f9c1597b69524812aa
Parents: 1047126
Author: Ashutosh Chauhan <hashutosh@apache.org>
Authored: Fri Mar 10 15:27:39 2017 -0800
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Fri Mar 10 15:27:39 2017 -0800

----------------------------------------------------------------------
 .../hadoop/hive/ql/parse/IdentifiersParser.g    |  8 ++++-
 .../test/queries/clientpositive/groupby_empty.q |  9 +++++
 .../results/clientpositive/groupby_empty.q.out  | 38 ++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/f6d1ac2c/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index c3d3c91..8c4ee8a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -57,9 +57,15 @@ groupByClause
 // support for new and old rollup/cube syntax
 groupby_expression :
  rollupStandard |
- rollupOldSyntax
+ rollupOldSyntax|
+ groupByEmpty
 ;
 
+groupByEmpty
+    :
+    LPAREN RPAREN
+    ;
+
 // standard rollup syntax
 rollupStandard
 @init { gParent.pushMsg("standard rollup syntax", state); }

http://git-wip-us.apache.org/repos/asf/hive/blob/f6d1ac2c/ql/src/test/queries/clientpositive/groupby_empty.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/groupby_empty.q b/ql/src/test/queries/clientpositive/groupby_empty.q
new file mode 100644
index 0000000..2ce33ae
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/groupby_empty.q
@@ -0,0 +1,9 @@
+create table t (a int);
+
+insert into t values (1),(1),(2);
+
+explain select count(*) from t group by ();
+
+select count(*) from t group by ();
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/f6d1ac2c/ql/src/test/results/clientpositive/groupby_empty.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/groupby_empty.q.out b/ql/src/test/results/clientpositive/groupby_empty.q.out
new file mode 100644
index 0000000..7b79a2f
--- /dev/null
+++ b/ql/src/test/results/clientpositive/groupby_empty.q.out
@@ -0,0 +1,38 @@
+PREHOOK: query: create table t (a int)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t
+POSTHOOK: query: create table t (a int)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t
+PREHOOK: query: insert into t values (1),(1),(2)
+PREHOOK: type: QUERY
+PREHOOK: Output: default@t
+POSTHOOK: query: insert into t values (1),(1),(2)
+POSTHOOK: type: QUERY
+POSTHOOK: Output: default@t
+POSTHOOK: Lineage: t.a EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+PREHOOK: query: explain select count(*) from t group by ()
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select count(*) from t group by ()
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: 1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select count(*) from t group by ()
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t
+#### A masked pattern was here ####
+POSTHOOK: query: select count(*) from t group by ()
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t
+#### A masked pattern was here ####
+3


Mime
View raw message