You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by om...@apache.org on 2015/11/23 18:24:02 UTC

[39/55] [partial] hive git commit: HIVE-12017: Do not disable CBO by default when number of joins in a query is equal or less than 1 (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/855e43df/ql/src/test/results/clientpositive/correlationoptimizer5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/correlationoptimizer5.q.out b/ql/src/test/results/clientpositive/correlationoptimizer5.q.out
index 7f2e19f..d33ca0f 100644
--- a/ql/src/test/results/clientpositive/correlationoptimizer5.q.out
+++ b/ql/src/test/results/clientpositive/correlationoptimizer5.q.out
@@ -125,29 +125,37 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
                 Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: y
             Statistics: Num rows: 1447 Data size: 5791 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
                 Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 key (type: int)
-            1 key (type: int)
+            0 _col0 (type: int)
+            1 _col0 (type: int)
           outputColumnNames: _col0
           Statistics: Num rows: 799 Data size: 3198 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
@@ -180,10 +188,10 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col3
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col3 (type: string)
+            expressions: _col0 (type: int), _col2 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -217,34 +225,42 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
                 Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: n
             Statistics: Num rows: 2 Data size: 280 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int), val (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
-                value expressions: val (type: string)
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 key (type: int)
-            1 key (type: int)
-          outputColumnNames: _col0, _col6
+            0 _col0 (type: int)
+            1 _col0 (type: int)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 29 Data size: 118 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col6 (type: string)
+            expressions: _col0 (type: int), _col2 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 29 Data size: 118 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -315,45 +331,61 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
                 Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: y
             Statistics: Num rows: 1447 Data size: 5791 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
                 Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: m
             Statistics: Num rows: 54 Data size: 216 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
                 Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: n
             Statistics: Num rows: 2 Data size: 280 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: int)
-                sort order: +
-                Map-reduce partition columns: key (type: int)
+              Select Operator
+                expressions: key (type: int), val (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
-                value expressions: val (type: string)
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Demux Operator
           Statistics: Num rows: 1479 Data size: 6053 Basic stats: COMPLETE Column stats: NONE
@@ -361,8 +393,8 @@ STAGE PLANS:
             condition map:
                  Inner Join 0 to 1
             keys:
-              0 key (type: int)
-              1 key (type: int)
+              0 _col0 (type: int)
+              1 _col0 (type: int)
             outputColumnNames: _col0
             Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
             Mux Operator
@@ -373,10 +405,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col3
+                outputColumnNames: _col0, _col2
                 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col3 (type: string)
+                  expressions: _col0 (type: int), _col2 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
                   File Output Operator
@@ -391,12 +423,12 @@ STAGE PLANS:
             condition map:
                  Inner Join 0 to 1
             keys:
-              0 key (type: int)
-              1 key (type: int)
-            outputColumnNames: _col0, _col6
+              0 _col0 (type: int)
+              1 _col0 (type: int)
+            outputColumnNames: _col0, _col2
             Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
             Select Operator
-              expressions: _col0 (type: int), _col6 (type: string)
+              expressions: _col0 (type: int), _col2 (type: string)
               outputColumnNames: _col0, _col1
               Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
               Mux Operator
@@ -407,10 +439,10 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col3
+                  outputColumnNames: _col0, _col2
                   Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: int), _col3 (type: string)
+                    expressions: _col0 (type: int), _col2 (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
                     File Output Operator
@@ -501,21 +533,25 @@ STAGE PLANS:
   Stage: Stage-14
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        b:y 
+        $hdt$_0:$hdt$_1:y 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        b:y 
+        $hdt$_0:$hdt$_1:y 
           TableScan
             alias: y
             Statistics: Num rows: 1447 Data size: 5791 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 724 Data size: 2897 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
 
   Stage: Stage-10
     Map Reduce
@@ -526,20 +562,24 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
+              Select Operator
+                expressions: key (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 799 Data size: 3198 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
+                Statistics: Num rows: 727 Data size: 2908 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 799 Data size: 3198 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
       Local Work:
         Map Reduce Local Work
 
@@ -570,10 +610,10 @@ STAGE PLANS:
               keys:
                 0 _col0 (type: int)
                 1 _col0 (type: int)
-              outputColumnNames: _col0, _col3
+              outputColumnNames: _col0, _col2
               Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: _col0 (type: int), _col3 (type: string)
+                expressions: _col0 (type: int), _col2 (type: string)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
@@ -624,10 +664,10 @@ STAGE PLANS:
               keys:
                 0 _col0 (type: int)
                 1 _col0 (type: int)
-              outputColumnNames: _col0, _col3
+              outputColumnNames: _col0, _col2
               Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: _col0 (type: int), _col3 (type: string)
+                expressions: _col0 (type: int), _col2 (type: string)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
@@ -664,10 +704,10 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col3
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col3 (type: string)
+            expressions: _col0 (type: int), _col2 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 878 Data size: 3517 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -682,21 +722,25 @@ STAGE PLANS:
   Stage: Stage-15
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        d:m 
+        $hdt$_1:$hdt$_1:m 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        d:m 
+        $hdt$_1:$hdt$_1:m 
           TableScan
             alias: m
             Statistics: Num rows: 54 Data size: 216 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
+              Select Operator
+                expressions: key (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
 
   Stage: Stage-11
     Map Reduce
@@ -707,24 +751,28 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
-                outputColumnNames: _col0, _col6
-                Statistics: Num rows: 29 Data size: 118 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col0 (type: int), _col6 (type: string)
-                  outputColumnNames: _col0, _col1
+              Select Operator
+                expressions: key (type: int), val (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1 Data size: 140 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col0, _col2
                   Statistics: Num rows: 29 Data size: 118 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
+                  Select Operator
+                    expressions: _col0 (type: int), _col2 (type: string)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 29 Data size: 118 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
       Local Work:
         Map Reduce Local Work
 

http://git-wip-us.apache.org/repos/asf/hive/blob/855e43df/ql/src/test/results/clientpositive/correlationoptimizer9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/correlationoptimizer9.q.out b/ql/src/test/results/clientpositive/correlationoptimizer9.q.out
index e00860d..6b88aac 100644
--- a/ql/src/test/results/clientpositive/correlationoptimizer9.q.out
+++ b/ql/src/test/results/clientpositive/correlationoptimizer9.q.out
@@ -54,27 +54,31 @@ STAGE PLANS:
             alias: x
             Statistics: Num rows: 1028 Data size: 22964 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (c1 < 120) (type: boolean)
-              Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-              Group By Operator
-                aggregations: count(1)
-                keys: c1 (type: int)
-                mode: hash
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+              predicate: (((c1 < 120) and (c1 > 100)) and c1 is not null) (type: boolean)
+              Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: c1 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: count(1)
+                  keys: _col0 (type: int)
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint)
       Reduce Operator Tree:
         Group By Operator
           aggregations: count(VALUE._col0)
           keys: KEY._col0 (type: int)
           mode: mergepartial
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 28 Data size: 625 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
             table:
@@ -90,14 +94,14 @@ STAGE PLANS:
               key expressions: _col0 (type: int)
               sort order: +
               Map-reduce partition columns: _col0 (type: int)
-              Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 28 Data size: 625 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col1 (type: bigint)
           TableScan
             Reduce Output Operator
               key expressions: _col0 (type: int)
               sort order: +
               Map-reduce partition columns: _col0 (type: int)
-              Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 28 Data size: 625 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col1 (type: bigint)
       Reduce Operator Tree:
         Join Operator
@@ -107,14 +111,14 @@ STAGE PLANS:
             0 _col0 (type: int)
             1 _col0 (type: int)
           outputColumnNames: _col0, _col1, _col2, _col3
-          Statistics: Num rows: 188 Data size: 4200 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 30 Data size: 687 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col0 (type: int), _col2 (type: int), _col1 (type: bigint), _col3 (type: bigint)
             outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 188 Data size: 4200 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 30 Data size: 687 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 188 Data size: 4200 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 30 Data size: 687 Basic stats: COMPLETE Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.TextInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -124,30 +128,34 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: x1
+            alias: x
             Statistics: Num rows: 1028 Data size: 22964 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (c2 > 100) (type: boolean)
-              Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-              Group By Operator
-                aggregations: count(1)
-                keys: c2 (type: int)
-                mode: hash
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+              predicate: (((c2 > 100) and (c2 < 120)) and c2 is not null) (type: boolean)
+              Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: c2 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: count(1)
+                  keys: _col0 (type: int)
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint)
       Reduce Operator Tree:
         Group By Operator
           aggregations: count(VALUE._col0)
           keys: KEY._col0 (type: int)
           mode: mergepartial
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 28 Data size: 625 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
             table:
@@ -218,49 +226,57 @@ STAGE PLANS:
             alias: x
             Statistics: Num rows: 1028 Data size: 22964 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (c1 < 120) (type: boolean)
-              Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-              Group By Operator
-                aggregations: count(1)
-                keys: c1 (type: int)
-                mode: hash
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+              predicate: (((c1 < 120) and (c1 > 100)) and c1 is not null) (type: boolean)
+              Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: c1 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: count(1)
+                  keys: _col0 (type: int)
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint)
           TableScan
-            alias: x1
+            alias: x
             Statistics: Num rows: 1028 Data size: 22964 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (c2 > 100) (type: boolean)
-              Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-              Group By Operator
-                aggregations: count(1)
-                keys: c2 (type: int)
-                mode: hash
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+              predicate: (((c2 > 100) and (c2 < 120)) and c2 is not null) (type: boolean)
+              Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: c2 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: count(1)
+                  keys: _col0 (type: int)
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint)
       Reduce Operator Tree:
         Demux Operator
-          Statistics: Num rows: 684 Data size: 15278 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 114 Data size: 2546 Basic stats: COMPLETE Column stats: NONE
           Group By Operator
             aggregations: count(VALUE._col0)
             keys: KEY._col0 (type: int)
             mode: mergepartial
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
             Mux Operator
-              Statistics: Num rows: 684 Data size: 15278 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 114 Data size: 2546 Basic stats: COMPLETE Column stats: NONE
               Join Operator
                 condition map:
                      Inner Join 0 to 1
@@ -285,9 +301,9 @@ STAGE PLANS:
             keys: KEY._col0 (type: int)
             mode: mergepartial
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 342 Data size: 7639 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 57 Data size: 1273 Basic stats: COMPLETE Column stats: NONE
             Mux Operator
-              Statistics: Num rows: 684 Data size: 15278 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 114 Data size: 2546 Basic stats: COMPLETE Column stats: NONE
               Join Operator
                 condition map:
                      Inner Join 0 to 1
@@ -373,18 +389,22 @@ STAGE PLANS:
             Filter Operator
               predicate: ((c1 < 120) and c3 is not null) (type: boolean)
               Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
-              Group By Operator
-                aggregations: count(1)
-                keys: c1 (type: int), c3 (type: string)
-                mode: hash
-                outputColumnNames: _col0, _col1, _col2
+              Select Operator
+                expressions: c1 (type: int), c3 (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int), _col1 (type: string)
-                  sort order: ++
-                  Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
+                Group By Operator
+                  aggregations: count(1)
+                  keys: _col0 (type: int), _col1 (type: string)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: bigint)
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: string)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
+                    Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col2 (type: bigint)
       Reduce Operator Tree:
         Group By Operator
           aggregations: count(VALUE._col0)
@@ -414,7 +434,7 @@ STAGE PLANS:
               key expressions: _col0 (type: int), _col1 (type: string)
               sort order: ++
               Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
-              Statistics: Num rows: 43 Data size: 960 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 14 Data size: 312 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col2 (type: bigint)
       Reduce Operator Tree:
         Join Operator
@@ -441,26 +461,26 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: x1
+            alias: x
             Statistics: Num rows: 1028 Data size: 22964 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (((c2 > 100) and c1 is not null) and c3 is not null) (type: boolean)
-              Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+              predicate: ((((c2 > 100) and (c1 < 120)) and c1 is not null) and c3 is not null) (type: boolean)
+              Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: c1 (type: int), c3 (type: string)
-                outputColumnNames: c1, c3
-                Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count(1)
-                  keys: c1 (type: int), c3 (type: string)
+                  keys: _col0 (type: int), _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int), _col1 (type: string)
                     sort order: ++
                     Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
-                    Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col2 (type: bigint)
       Reduce Operator Tree:
         Group By Operator
@@ -468,7 +488,7 @@ STAGE PLANS:
           keys: KEY._col0 (type: int), KEY._col1 (type: string)
           mode: mergepartial
           outputColumnNames: _col0, _col1, _col2
-          Statistics: Num rows: 43 Data size: 960 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 14 Data size: 312 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
             table:
@@ -539,51 +559,55 @@ STAGE PLANS:
             Filter Operator
               predicate: ((c1 < 120) and c3 is not null) (type: boolean)
               Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
-              Group By Operator
-                aggregations: count(1)
-                keys: c1 (type: int), c3 (type: string)
-                mode: hash
-                outputColumnNames: _col0, _col1, _col2
+              Select Operator
+                expressions: c1 (type: int), c3 (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int), _col1 (type: string)
-                  sort order: ++
-                  Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
+                Group By Operator
+                  aggregations: count(1)
+                  keys: _col0 (type: int), _col1 (type: string)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: bigint)
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: string)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
+                    Statistics: Num rows: 171 Data size: 3819 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col2 (type: bigint)
           TableScan
-            alias: x1
+            alias: x
             Statistics: Num rows: 1028 Data size: 22964 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (((c2 > 100) and c1 is not null) and c3 is not null) (type: boolean)
-              Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+              predicate: ((((c2 > 100) and (c1 < 120)) and c1 is not null) and c3 is not null) (type: boolean)
+              Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: c1 (type: int), c3 (type: string)
-                outputColumnNames: c1, c3
-                Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count(1)
-                  keys: c1 (type: int), c3 (type: string)
+                  keys: _col0 (type: int), _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int), _col1 (type: string)
                     sort order: ++
                     Map-reduce partition columns: _col0 (type: int), _col1 (type: string)
-                    Statistics: Num rows: 86 Data size: 1921 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 29 Data size: 647 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col2 (type: bigint)
       Reduce Operator Tree:
         Demux Operator
-          Statistics: Num rows: 257 Data size: 5740 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 200 Data size: 4466 Basic stats: COMPLETE Column stats: NONE
           Group By Operator
             aggregations: count(VALUE._col0)
             keys: KEY._col0 (type: int), KEY._col1 (type: string)
             mode: mergepartial
             outputColumnNames: _col0, _col1, _col2
-            Statistics: Num rows: 128 Data size: 2858 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 100 Data size: 2233 Basic stats: COMPLETE Column stats: NONE
             Mux Operator
-              Statistics: Num rows: 256 Data size: 5716 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 200 Data size: 4466 Basic stats: COMPLETE Column stats: NONE
               Join Operator
                 condition map:
                      Inner Join 0 to 1
@@ -608,9 +632,9 @@ STAGE PLANS:
             keys: KEY._col0 (type: int), KEY._col1 (type: string)
             mode: mergepartial
             outputColumnNames: _col0, _col1, _col2
-            Statistics: Num rows: 128 Data size: 2858 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 100 Data size: 2233 Basic stats: COMPLETE Column stats: NONE
             Mux Operator
-              Statistics: Num rows: 256 Data size: 5716 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 200 Data size: 4466 Basic stats: COMPLETE Column stats: NONE
               Join Operator
                 condition map:
                      Inner Join 0 to 1

http://git-wip-us.apache.org/repos/asf/hive/blob/855e43df/ql/src/test/results/clientpositive/create_view.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/create_view.q.out b/ql/src/test/results/clientpositive/create_view.q.out
index 1038d01..4955c6b 100644
--- a/ql/src/test/results/clientpositive/create_view.q.out
+++ b/ql/src/test/results/clientpositive/create_view.q.out
@@ -559,7 +559,7 @@ POSTHOOK: Input: default@table1
 POSTHOOK: Input: default@view4
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@view5
-Warning: Shuffle Join JOIN[6][tables = [v1, v2]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[7][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT * FROM view5
 PREHOOK: type: QUERY
 PREHOOK: Input: default@table1

http://git-wip-us.apache.org/repos/asf/hive/blob/855e43df/ql/src/test/results/clientpositive/cross_product_check_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cross_product_check_1.q.out b/ql/src/test/results/clientpositive/cross_product_check_1.q.out
index 3ab418a..f0fdfd3 100644
--- a/ql/src/test/results/clientpositive/cross_product_check_1.q.out
+++ b/ql/src/test/results/clientpositive/cross_product_check_1.q.out
@@ -86,7 +86,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[10][tables = [d1, d2, a]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[14][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: explain select * from B d1 join B d2 on d1.key = d2.key join A
 PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from B d1 join B d2 on d1.key = d2.key join A
@@ -106,32 +106,40 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: string)
-                sort order: +
-                Map-reduce partition columns: key (type: string)
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-                value expressions: value (type: string)
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
           TableScan
-            alias: d2
+            alias: d1
             Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: string)
-                sort order: +
-                Map-reduce partition columns: key (type: string)
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-                value expressions: value (type: string)
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 key (type: string)
-            1 key (type: string)
-          outputColumnNames: _col0, _col1, _col5, _col6
+            0 _col0 (type: string)
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -147,14 +155,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
           TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-            Reduce Output Operator
-              sort order: 
+            Select Operator
+              expressions: key (type: string), value (type: string)
+              outputColumnNames: _col0, _col1
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-              value expressions: key (type: string), value (type: string)
+              Reduce Output Operator
+                sort order: 
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -162,19 +174,15 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col5, _col6, _col10, _col11
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string), _col10 (type: string), _col11 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          File Output Operator
+            compressed: false
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 550 Data size: 5843 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
+            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
@@ -182,7 +190,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[16][tables = [a, od1]] in Stage 'Stage-3:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[20][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: explain select * from A join 
          (select d1.key 
           from B d1 join B d2 on d1.key = d2.key
@@ -194,13 +202,13 @@ POSTHOOK: query: explain select * from A join
           where 1 = 1 group by d1.key) od1
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-2 depends on stages: Stage-1
+  Stage-2 is a root stage
   Stage-3 depends on stages: Stage-2
-  Stage-0 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-3
+  Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-1
+  Stage: Stage-2
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -209,29 +217,37 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: string)
-                sort order: +
-                Map-reduce partition columns: key (type: string)
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: _col0
                 Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
           TableScan
-            alias: d2
+            alias: d1
             Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: string)
-                sort order: +
-                Map-reduce partition columns: key (type: string)
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: _col0
                 Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 key (type: string)
-            1 key (type: string)
+            0 _col0 (type: string)
+            1 _col0 (type: string)
           outputColumnNames: _col0
           Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
           Group By Operator
@@ -246,7 +262,7 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-2
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -268,21 +284,25 @@ STAGE PLANS:
                 output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                 serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
+  Stage: Stage-1
     Map Reduce
       Map Operator Tree:
           TableScan
-            Reduce Output Operator
-              sort order: 
-              Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string)
-          TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: key (type: string), value (type: string)
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              Reduce Output Operator
+                sort order: 
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                value expressions: _col0 (type: string), _col1 (type: string)
+          TableScan
             Reduce Output Operator
               sort order: 
-              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-              value expressions: key (type: string), value (type: string)
+              Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -290,19 +310,15 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col5
+          outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string)
-            outputColumnNames: _col0, _col1, _col2
+          File Output Operator
+            compressed: false
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 550 Data size: 5843 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
+            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
@@ -310,35 +326,41 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[14][tables = [a, od1]] in Stage 'Stage-3:MAPRED' is a cross product
-Warning: Shuffle Join JOIN[4][tables = [d1, d2]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[10][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: explain select * from A join (select d1.key from B d1 join B d2 where 1 = 1  group by d1.key) od1
 PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from A join (select d1.key from B d1 join B d2 where 1 = 1  group by d1.key) od1
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-2 depends on stages: Stage-1
+  Stage-2 is a root stage
   Stage-3 depends on stages: Stage-2
-  Stage-0 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-3
+  Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-1
+  Stage: Stage-2
     Map Reduce
       Map Operator Tree:
           TableScan
             alias: d1
             Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
-            Reduce Output Operator
-              sort order: 
+            Select Operator
+              expressions: key (type: string)
+              outputColumnNames: _col0
               Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
-              value expressions: key (type: string)
+              Reduce Output Operator
+                sort order: 
+                Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                value expressions: _col0 (type: string)
           TableScan
-            alias: d2
+            alias: d1
             Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
-            Reduce Output Operator
-              sort order: 
-              Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+              Reduce Output Operator
+                sort order: 
+                Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -360,7 +382,7 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-2
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -382,21 +404,25 @@ STAGE PLANS:
                 output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                 serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
+  Stage: Stage-1
     Map Reduce
       Map Operator Tree:
           TableScan
-            Reduce Output Operator
-              sort order: 
-              Statistics: Num rows: 5 Data size: 51 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string)
-          TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: key (type: string), value (type: string)
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              Reduce Output Operator
+                sort order: 
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                value expressions: _col0 (type: string), _col1 (type: string)
+          TableScan
             Reduce Output Operator
               sort order: 
-              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-              value expressions: key (type: string), value (type: string)
+              Statistics: Num rows: 5 Data size: 51 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -404,19 +430,15 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col5
+          outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string)
-            outputColumnNames: _col0, _col1, _col2
+          File Output Operator
+            compressed: false
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 550 Data size: 5843 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
+            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
@@ -424,7 +446,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[21][tables = [ss, od1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[24][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: explain select * from 
 (select A.key from A  group by key) ss join
 (select d1.key from B d1 join B d2 on d1.key = d2.key where 1 = 1 group by d1.key) od1
@@ -513,29 +535,37 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: string)
-                sort order: +
-                Map-reduce partition columns: key (type: string)
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: _col0
                 Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
           TableScan
-            alias: d2
+            alias: d1
             Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: key (type: string)
-                sort order: +
-                Map-reduce partition columns: key (type: string)
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: _col0
                 Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 key (type: string)
-            1 key (type: string)
+            0 _col0 (type: string)
+            1 _col0 (type: string)
           outputColumnNames: _col0
           Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
           Group By Operator