hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1628474 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java test/queries/clientpositive/join_merge_multi_expressions.q test/results/clientpositive/join_merge_multi_expressions.q.out
Date Tue, 30 Sep 2014 15:55:37 GMT
Author: hashutosh
Date: Tue Sep 30 15:55:37 2014
New Revision: 1628474

URL: http://svn.apache.org/r1628474
Log:
HIVE-8298 : Incorrect results for n-way join when join expressions are not in same order across
joins (Ashutosh Chauhan via Gunther Hagleitner, Harish Butani)

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

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1628474&r1=1628473&r2=1628474&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Tue Sep 30
15:55:37 2014
@@ -8028,7 +8028,7 @@ public class SemanticAnalyzer extends Ba
       List<ASTNode> nodeConds = node.getExpressions().get(i + 1);
       ArrayList<ASTNode> reordereNodeConds = new ArrayList<ASTNode>();
       for(int k=0; k < tgtToNodeExprMap.length; k++) {
-        reordereNodeConds.add(nodeConds.get(k));
+        reordereNodeConds.add(nodeConds.get(tgtToNodeExprMap[k]));
       }
       expr.add(reordereNodeConds);
     }

Added: hive/trunk/ql/src/test/queries/clientpositive/join_merge_multi_expressions.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/join_merge_multi_expressions.q?rev=1628474&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/join_merge_multi_expressions.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/join_merge_multi_expressions.q Tue Sep 30
15:55:37 2014
@@ -0,0 +1,3 @@
+explain
+select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr = b.hr join srcpart
c on a.hr = c.hr and a.key = c.key;
+select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr = b.hr join srcpart
c on a.hr = c.hr and a.key = c.key;

Added: hive/trunk/ql/src/test/results/clientpositive/join_merge_multi_expressions.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/join_merge_multi_expressions.q.out?rev=1628474&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/join_merge_multi_expressions.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/join_merge_multi_expressions.q.out Tue Sep
30 15:55:37 2014
@@ -0,0 +1,121 @@
+PREHOOK: query: explain
+select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr = b.hr join srcpart
c on a.hr = c.hr and a.key = c.key
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr = b.hr join srcpart
c on a.hr = c.hr and a.key = c.key
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: b
+            Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats:
NONE
+            Filter Operator
+              predicate: key is not null (type: boolean)
+              Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column stats:
NONE
+              Reduce Output Operator
+                key expressions: key (type: string), hr (type: string)
+                sort order: ++
+                Map-reduce partition columns: key (type: string), hr (type: string)
+                Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column
stats: NONE
+          TableScan
+            alias: c
+            Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats:
NONE
+            Filter Operator
+              predicate: key is not null (type: boolean)
+              Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column stats:
NONE
+              Reduce Output Operator
+                key expressions: key (type: string), hr (type: string)
+                sort order: ++
+                Map-reduce partition columns: key (type: string), hr (type: string)
+                Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column
stats: NONE
+          TableScan
+            alias: a
+            Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats:
NONE
+            Filter Operator
+              predicate: key is not null (type: boolean)
+              Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column stats:
NONE
+              Reduce Output Operator
+                key expressions: key (type: string), hr (type: string)
+                sort order: ++
+                Map-reduce partition columns: key (type: string), hr (type: string)
+                Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column
stats: NONE
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+               Inner Join 0 to 2
+          condition expressions:
+            0 
+            1 
+            2 
+          Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats:
NONE
+          Select Operator
+            Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats:
NONE
+            Group By Operator
+              aggregations: count()
+              mode: hash
+              outputColumnNames: _col0
+              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              sort order: 
+              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: bigint)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: count(VALUE._col0)
+          mode: mergepartial
+          outputColumnNames: _col0
+          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: _col0 (type: bigint)
+            outputColumnNames: _col0
+            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+              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-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr =
b.hr join srcpart c on a.hr = c.hr and a.key = c.key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@srcpart
+PREHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
+PREHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
+PREHOOK: Input: default@srcpart@ds=2008-04-09/hr=11
+PREHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
+#### A masked pattern was here ####
+POSTHOOK: query: select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr
= b.hr join srcpart c on a.hr = c.hr and a.key = c.key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@srcpart
+POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
+POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
+POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=11
+POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
+#### A masked pattern was here ####
+42464



Mime
View raw message