hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gop...@apache.org
Subject hive git commit: HIVE-11594: Analyze Table for column names with embedded spaces (Gopal V, reviewed by Ashutosh Chauhan)
Date Thu, 20 Aug 2015 21:03:55 GMT
Repository: hive
Updated Branches:
  refs/heads/master 0012864b8 -> 87930e2de


HIVE-11594: Analyze Table for column names with embedded spaces (Gopal V, reviewed by Ashutosh
Chauhan)


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

Branch: refs/heads/master
Commit: 87930e2debaa795cc7e94f125065da567cde85b9
Parents: 0012864
Author: Gopal V <gopalv@apache.org>
Authored: Thu Aug 20 14:03:09 2015 -0700
Committer: Gopal V <gopalv@apache.org>
Committed: Thu Aug 20 14:03:13 2015 -0700

----------------------------------------------------------------------
 .../ql/parse/ColumnStatsSemanticAnalyzer.java   |   6 +-
 .../clientpositive/columnstats_quoting.q        |   8 ++
 .../clientpositive/columnstats_quoting.q.out    | 114 +++++++++++++++++++
 3 files changed, 125 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/87930e2d/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
b/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
index a5f0a7f..8b7a2e8 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
@@ -175,7 +175,7 @@ public class ColumnStatsSemanticAnalyzer extends SemanticAnalyzer {
         } else {
           whereClause.append(" and ");
         }
-        whereClause.append(partKey).append(" = ").append(genPartValueString(partKey, value));
+        whereClause.append("`").append(partKey).append("` = ").append(genPartValueString(partKey,
value));
       }
     }
 
@@ -308,9 +308,9 @@ public class ColumnStatsSemanticAnalyzer extends SemanticAnalyzer {
       if (i > 0) {
         rewrittenQueryBuilder.append(" , ");
       }
-      rewrittenQueryBuilder.append("compute_stats(");
+      rewrittenQueryBuilder.append("compute_stats(`");
       rewrittenQueryBuilder.append(colNames.get(i));
-      rewrittenQueryBuilder.append(" , ");
+      rewrittenQueryBuilder.append("` , ");
       rewrittenQueryBuilder.append(numBitVectors);
       rewrittenQueryBuilder.append(" )");
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/87930e2d/ql/src/test/queries/clientpositive/columnstats_quoting.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/columnstats_quoting.q b/ql/src/test/queries/clientpositive/columnstats_quoting.q
new file mode 100644
index 0000000..1bf4f91
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/columnstats_quoting.q
@@ -0,0 +1,8 @@
+DROP TABLE IF EXISTS user_web_events;
+create temporary table user_web_events(`user id` bigint, `user name` string);
+
+explain analyze table user_web_events compute statistics for columns;
+analyze table user_web_events compute statistics for columns;
+
+explain analyze table user_web_events compute statistics for columns `user id`;
+analyze table user_web_events compute statistics for columns `user id`;

http://git-wip-us.apache.org/repos/asf/hive/blob/87930e2d/ql/src/test/results/clientpositive/columnstats_quoting.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/columnstats_quoting.q.out b/ql/src/test/results/clientpositive/columnstats_quoting.q.out
new file mode 100644
index 0000000..bd36ef0
--- /dev/null
+++ b/ql/src/test/results/clientpositive/columnstats_quoting.q.out
@@ -0,0 +1,114 @@
+PREHOOK: query: DROP TABLE IF EXISTS user_web_events
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS user_web_events
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create temporary table user_web_events(`user id` bigint, `user name` string)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@user_web_events
+POSTHOOK: query: create temporary table user_web_events(`user id` bigint, `user name` string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@user_web_events
+PREHOOK: query: explain analyze table user_web_events compute statistics for columns
+PREHOOK: type: QUERY
+POSTHOOK: query: explain analyze table user_web_events compute statistics for columns
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+  Stage-1 depends on stages: Stage-0
+
+STAGE PLANS:
+  Stage: Stage-0
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: user_web_events
+            Select Operator
+              expressions: user id (type: bigint), user name (type: string)
+              outputColumnNames: user id, user name
+              Group By Operator
+                aggregations: compute_stats(user id, 16), compute_stats(user name, 16)
+                mode: hash
+                outputColumnNames: _col0, _col1
+                Reduce Output Operator
+                  sort order: 
+                  value expressions: _col0 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:string,numbitvectors:int>),
_col1 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:string,numbitvectors:int>)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: compute_stats(VALUE._col0), compute_stats(VALUE._col1)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.TextInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-1
+    Column Stats Work
+      Column Stats Desc:
+          Columns: user id, user name
+          Column Types: bigint, string
+          Table: default.user_web_events
+
+PREHOOK: query: analyze table user_web_events compute statistics for columns
+PREHOOK: type: QUERY
+PREHOOK: Input: default@user_web_events
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table user_web_events compute statistics for columns
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@user_web_events
+#### A masked pattern was here ####
+PREHOOK: query: explain analyze table user_web_events compute statistics for columns `user
id`
+PREHOOK: type: QUERY
+POSTHOOK: query: explain analyze table user_web_events compute statistics for columns `user
id`
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+  Stage-1 depends on stages: Stage-0
+
+STAGE PLANS:
+  Stage: Stage-0
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: user_web_events
+            Select Operator
+              expressions: user id (type: bigint)
+              outputColumnNames: user id
+              Group By Operator
+                aggregations: compute_stats(user id, 16)
+                mode: hash
+                outputColumnNames: _col0
+                Reduce Output Operator
+                  sort order: 
+                  value expressions: _col0 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:string,numbitvectors:int>)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: compute_stats(VALUE._col0)
+          mode: mergepartial
+          outputColumnNames: _col0
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.TextInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-1
+    Column Stats Work
+      Column Stats Desc:
+          Columns: user id
+          Column Types: bigint
+          Table: default.user_web_events
+
+PREHOOK: query: analyze table user_web_events compute statistics for columns `user id`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@user_web_events
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table user_web_events compute statistics for columns `user id`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@user_web_events
+#### A masked pattern was here ####


Mime
View raw message