You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by zs...@apache.org on 2009/09/14 23:30:54 UTC

svn commit: r814867 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java ql/src/test/queries/clientpositive/join37.q ql/src/test/results/clientpositive/join37.q.out

Author: zshao
Date: Mon Sep 14 21:30:47 2009
New Revision: 814867

URL: http://svn.apache.org/viewvc?rev=814867&view=rev
Log:
HIVE-823. Make table alise in MAPJOIN hint case insensitive. (Namit Jain via zshao)

Added:
    hadoop/hive/trunk/ql/src/test/queries/clientpositive/join37.q
    hadoop/hive/trunk/ql/src/test/results/clientpositive/join37.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=814867&r1=814866&r2=814867&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Mon Sep 14 21:30:47 2009
@@ -107,6 +107,9 @@
     HIVE-812. Hive compiled with ant package works with all supported hadoop versions
     (Zheng Shao via namit)
 
+    HIVE-823. Make table alise in MAPJOIN hint case insensitive.
+    (Namit Jain via zshao)
+
 Release 0.4.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=814867&r1=814866&r2=814867&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Mon Sep 14 21:30:47 2009
@@ -3257,7 +3257,7 @@
         ASTNode hintTblNames = (ASTNode)hint.getChild(1);
         int numCh = hintTblNames.getChildCount();
         for (int tblPos = 0; tblPos < numCh; tblPos++) {
-          String tblName = ((ASTNode)hintTblNames.getChild(tblPos)).getText();
+          String tblName = ((ASTNode)hintTblNames.getChild(tblPos)).getText().toLowerCase();
           if (cols == null)
             cols = new ArrayList<String>();
           if (!cols.contains(tblName))
@@ -3452,11 +3452,11 @@
       for (String mapTbl : mapSideTables) {
         boolean mapTable = false;
         for (String leftAlias : joinTree.getLeftAliases()) {
-          if (mapTbl.equals(leftAlias))
+          if (mapTbl.equalsIgnoreCase(leftAlias))
             mapTable = true;
         }
         for (String rightAlias : joinTree.getRightAliases()) {
-          if (mapTbl.equals(rightAlias))
+          if (mapTbl.equalsIgnoreCase(rightAlias))
             mapTable = true;
         }
         

Added: hadoop/hive/trunk/ql/src/test/queries/clientpositive/join37.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/join37.q?rev=814867&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/join37.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/join37.q Mon Sep 14 21:30:47 2009
@@ -0,0 +1,19 @@
+set hive.mapjoin.numrows = 2;
+
+drop table dest_j1;
+
+CREATE TABLE dest_j1(key INT, value STRING, val2 STRING) STORED AS TEXTFILE;
+
+EXPLAIN
+INSERT OVERWRITE TABLE dest_j1 
+SELECT /*+ MAPJOIN(X) */ x.key, x.value, y.value
+FROM src1 x JOIN src y ON (x.key = y.key);
+
+INSERT OVERWRITE TABLE dest_j1 
+SELECT /*+ MAPJOIN(X) */ x.key, x.value, y.value
+FROM src1 x JOIN src y ON (x.key = y.key);
+
+select * from dest_j1 x order by x.key;
+
+drop table dest_j1;
+

Added: hadoop/hive/trunk/ql/src/test/results/clientpositive/join37.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/join37.q.out?rev=814867&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/join37.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/join37.q.out Mon Sep 14 21:30:47 2009
@@ -0,0 +1,216 @@
+query: drop table dest_j1
+query: CREATE TABLE dest_j1(key INT, value STRING, val2 STRING) STORED AS TEXTFILE
+query: EXPLAIN
+INSERT OVERWRITE TABLE dest_j1 
+SELECT /*+ MAPJOIN(X) */ x.key, x.value, y.value
+FROM src1 x JOIN src y ON (x.key = y.key)
+ABSTRACT SYNTAX TREE:
+  (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF src1 x) (TOK_TABREF src y) (= (. (TOK_TABLE_OR_COL x) key) (. (TOK_TABLE_OR_COL y) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB dest_j1)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST X))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL x) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL x) value)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL y) value)))))
+
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-4 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-4
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Alias -> Map Operator Tree:
+        y 
+          TableScan
+            alias: y
+            Common Join Operator
+              condition map:
+                   Inner Join 0 to 1
+              condition expressions:
+                0 {key} {value}
+                1 {value}
+              keys:
+                0 [Column[key]]
+                1 [Column[key]]
+              outputColumnNames: _col0, _col1, _col3
+              Position of Big Table: 1
+              Select Operator
+                expressions:
+                      expr: _col0
+                      type: string
+                      expr: _col1
+                      type: string
+                      expr: _col3
+                      type: string
+                outputColumnNames: _col0, _col1, _col3
+                Select Operator
+                  expressions:
+                        expr: _col0
+                        type: string
+                        expr: _col1
+                        type: string
+                        expr: _col3
+                        type: string
+                  outputColumnNames: _col0, _col1, _col2
+                  Select Operator
+                    expressions:
+                          expr: UDFToInteger(_col0)
+                          type: int
+                          expr: _col1
+                          type: string
+                          expr: _col2
+                          type: string
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      GlobalTableId: 1
+                      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
+                          name: dest_j1
+      Local Work:
+        Map Reduce Local Work
+          Alias -> Map Local Tables:
+            x 
+              Fetch Operator
+                limit: -1
+          Alias -> Map Local Operator Tree:
+            x 
+              TableScan
+                alias: x
+                Common Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  condition expressions:
+                    0 {key} {value}
+                    1 {value}
+                  keys:
+                    0 [Column[key]]
+                    1 [Column[key]]
+                  outputColumnNames: _col0, _col1, _col3
+                  Position of Big Table: 1
+                  Select Operator
+                    expressions:
+                          expr: _col0
+                          type: string
+                          expr: _col1
+                          type: string
+                          expr: _col3
+                          type: string
+                    outputColumnNames: _col0, _col1, _col3
+                    Select Operator
+                      expressions:
+                            expr: _col0
+                            type: string
+                            expr: _col1
+                            type: string
+                            expr: _col3
+                            type: string
+                      outputColumnNames: _col0, _col1, _col2
+                      Select Operator
+                        expressions:
+                              expr: UDFToInteger(_col0)
+                              type: int
+                              expr: _col1
+                              type: string
+                              expr: _col2
+                              type: string
+                        outputColumnNames: _col0, _col1, _col2
+                        File Output Operator
+                          compressed: false
+                          GlobalTableId: 1
+                          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
+                              name: dest_j1
+
+  Stage: Stage-4
+    Conditional Operator
+      list of dependent Tasks:
+          Move Operator
+            files:
+                hdfs directory: true
+                destination: file:/data/users/njain/hive1/hive1/build/ql/tmp/468428349/10000
+          Map Reduce
+            Alias -> Map Operator Tree:
+              file:/data/users/njain/hive1/hive1/build/ql/tmp/2029373808/10002 
+                  Reduce Output Operator
+                    sort order: 
+                    Map-reduce partition columns:
+                          expr: rand()
+                          type: double
+                    tag: -1
+                    value expressions:
+                          expr: key
+                          type: int
+                          expr: value
+                          type: string
+                          expr: val2
+                          type: string
+            Reduce Operator Tree:
+              Extract
+                File Output Operator
+                  compressed: false
+                  GlobalTableId: 0
+                  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
+                      name: dest_j1
+
+  Stage: Stage-0
+    Move Operator
+      tables:
+          replace: true
+          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
+              name: dest_j1
+
+
+query: INSERT OVERWRITE TABLE dest_j1 
+SELECT /*+ MAPJOIN(X) */ x.key, x.value, y.value
+FROM src1 x JOIN src y ON (x.key = y.key)
+Input: default/src
+Input: default/src1
+Output: default/dest_j1
+query: select * from dest_j1 x order by x.key
+Input: default/dest_j1
+Output: file:/data/users/njain/hive1/hive1/build/ql/tmp/1043653472/10000
+66	val_66	val_66
+98	val_98	val_98
+98	val_98	val_98
+128		val_128
+128		val_128
+128		val_128
+146	val_146	val_146
+146	val_146	val_146
+150	val_150	val_150
+213	val_213	val_213
+213	val_213	val_213
+224		val_224
+224		val_224
+238	val_238	val_238
+238	val_238	val_238
+255	val_255	val_255
+255	val_255	val_255
+273	val_273	val_273
+273	val_273	val_273
+273	val_273	val_273
+278	val_278	val_278
+278	val_278	val_278
+311	val_311	val_311
+311	val_311	val_311
+311	val_311	val_311
+369		val_369
+369		val_369
+369		val_369
+401	val_401	val_401
+401	val_401	val_401
+401	val_401	val_401
+401	val_401	val_401
+401	val_401	val_401
+406	val_406	val_406
+406	val_406	val_406
+406	val_406	val_406
+406	val_406	val_406
+query: drop table dest_j1