You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by px...@apache.org on 2016/04/24 02:00:09 UTC

hive git commit: HIVE-13553: CTE with upperCase alias throws exception (Pengcheng Xiong, reviewed by Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master 749e27a92 -> 287f0451b


HIVE-13553: CTE with upperCase alias throws exception (Pengcheng Xiong, 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/287f0451
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/287f0451
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/287f0451

Branch: refs/heads/master
Commit: 287f0451bce6173868d5ddf224e30dff8dde2ca5
Parents: 749e27a
Author: Pengcheng Xiong <px...@apache.org>
Authored: Sat Apr 23 16:59:37 2016 -0700
Committer: Pengcheng Xiong <px...@apache.org>
Committed: Sat Apr 23 16:59:37 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java  |  4 +-
 ql/src/test/queries/clientpositive/cte_6.q      | 10 +++
 ql/src/test/results/clientpositive/cte_6.q.out  | 86 ++++++++++++++++++++
 3 files changed, 98 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/287f0451/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 005b53f..9af7749 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -674,7 +674,7 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
 
     ASTNode tableTree = (ASTNode) (tabref.getChild(0));
 
-    String tabIdName = getUnescapedName(tableTree);
+    String tabIdName = getUnescapedName(tableTree).toLowerCase();
 
     String alias;
     if (aliasIndex != 0) {
@@ -1564,7 +1564,7 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
       case HiveParser.TOK_ANALYZE:
         // Case of analyze command
 
-        String table_name = getUnescapedName((ASTNode) ast.getChild(0).getChild(0));
+        String table_name = getUnescapedName((ASTNode) ast.getChild(0).getChild(0)).toLowerCase();
 
 
         qb.setTabAlias(table_name, table_name);

http://git-wip-us.apache.org/repos/asf/hive/blob/287f0451/ql/src/test/queries/clientpositive/cte_6.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/cte_6.q b/ql/src/test/queries/clientpositive/cte_6.q
new file mode 100644
index 0000000..964d1b8
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/cte_6.q
@@ -0,0 +1,10 @@
+explain
+with Q1 as ( select key from sRc where key = '5')
+select CPS.key from Q1 CPS;
+
+-- chaining
+
+explain
+with Q1 as ( select key from q2 where key = '5'),
+Q2 as ( select key from sRc where key = '5')
+select CPS.key from Q1 CPS;

http://git-wip-us.apache.org/repos/asf/hive/blob/287f0451/ql/src/test/results/clientpositive/cte_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cte_6.q.out b/ql/src/test/results/clientpositive/cte_6.q.out
new file mode 100644
index 0000000..8cc433b
--- /dev/null
+++ b/ql/src/test/results/clientpositive/cte_6.q.out
@@ -0,0 +1,86 @@
+PREHOOK: query: explain
+with Q1 as ( select key from sRc where key = '5')
+select CPS.key from Q1 CPS
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+with Q1 as ( select key from sRc where key = '5')
+select CPS.key from Q1 CPS
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (key = '5') (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: '5' (type: string)
+                outputColumnNames: _col0
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: -- chaining
+
+explain
+with Q1 as ( select key from q2 where key = '5'),
+Q2 as ( select key from sRc where key = '5')
+select CPS.key from Q1 CPS
+PREHOOK: type: QUERY
+POSTHOOK: query: -- chaining
+
+explain
+with Q1 as ( select key from q2 where key = '5'),
+Q2 as ( select key from sRc where key = '5')
+select CPS.key from Q1 CPS
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (key = '5') (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: '5' (type: string)
+                outputColumnNames: _col0
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+