You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2015/11/30 01:11:40 UTC

[43/91] [abbrv] [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/7dab21ac/ql/src/test/results/clientpositive/bucketsortoptimize_insert_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_6.q.out b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_6.q.out
index a937fb4..b30d90c 100644
--- a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_6.q.out
+++ b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_6.q.out
@@ -87,23 +87,27 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator
@@ -222,23 +226,27 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator
@@ -359,21 +367,25 @@ STAGE PLANS:
   Stage: Stage-7
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        b 
+        $hdt$_1:b 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        b 
+        $hdt$_1:b 
           TableScan
             alias: b
             Statistics: Num rows: 84 Data size: 979 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
 
   Stage: Stage-4
     Map Reduce
@@ -384,21 +396,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: +-
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: +-
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -431,21 +447,25 @@ STAGE PLANS:
   Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        a 
+        $hdt$_0:a 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        a 
+        $hdt$_0:a 
           TableScan
             alias: a
             Statistics: Num rows: 10 Data size: 91 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
 
   Stage: Stage-5
     Map Reduce
@@ -456,21 +476,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: +-
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: +-
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -494,21 +518,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: +-
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: +-
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Reduce Operator Tree:
         Select Operator
           expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int), VALUE._col0 (type: string)
@@ -560,21 +588,25 @@ STAGE PLANS:
   Stage: Stage-7
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        subq1:b 
+        $hdt$_1:b 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        subq1:b 
+        $hdt$_1:b 
           TableScan
             alias: b
             Statistics: Num rows: 84 Data size: 979 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
 
   Stage: Stage-4
     Map Reduce
@@ -585,21 +617,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: +-
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: +-
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -632,21 +668,25 @@ STAGE PLANS:
   Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        subq1:a 
+        $hdt$_0:a 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        subq1:a 
+        $hdt$_0:a 
           TableScan
             alias: a
             Statistics: Num rows: 10 Data size: 91 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
 
   Stage: Stage-5
     Map Reduce
@@ -657,21 +697,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: +-
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: +-
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -695,21 +739,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: +-
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: +-
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Reduce Operator Tree:
         Select Operator
           expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int), VALUE._col0 (type: string)
@@ -765,23 +813,27 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator
@@ -918,23 +970,27 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator
@@ -1083,21 +1139,25 @@ STAGE PLANS:
   Stage: Stage-7
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        subq2:subq1:b 
+        $hdt$_1:b 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        subq2:subq1:b 
+        $hdt$_1:b 
           TableScan
             alias: b
             Statistics: Num rows: 84 Data size: 979 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
 
   Stage: Stage-4
     Map Reduce
@@ -1108,21 +1168,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: --
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: --
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -1155,21 +1219,25 @@ STAGE PLANS:
   Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        subq2:subq1:a 
+        $hdt$_0:a 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        subq2:subq1:a 
+        $hdt$_0:a 
           TableScan
             alias: a
             Statistics: Num rows: 10 Data size: 91 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
 
   Stage: Stage-5
     Map Reduce
@@ -1180,21 +1248,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: --
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21 Data size: 244 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: --
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -1218,21 +1290,25 @@ STAGE PLANS:
             Filter Operator
               predicate: (key is not null and key2 is not null) (type: boolean)
               Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int), key2 (type: int)
-                  1 key (type: int), key2 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col9
-                Select Operator
-                  expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col9) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: --
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                    value expressions: _col2 (type: string)
+              Select Operator
+                expressions: key (type: int), key2 (type: int), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3 Data size: 27 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int), _col1 (type: int)
+                    1 _col0 (type: int), _col1 (type: int)
+                  outputColumnNames: _col0, _col1, _col2, _col6
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: --
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col2 (type: string)
       Reduce Operator Tree:
         Select Operator
           expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int), VALUE._col0 (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/bucketsortoptimize_insert_7.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_7.q.out b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_7.q.out
index 9f530e8..a893147 100644
--- a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_7.q.out
+++ b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_7.q.out
@@ -85,25 +85,29 @@ STAGE PLANS:
             alias: a
             Statistics: Num rows: 10 Data size: 70 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (key is not null and ((key = 0) or (key = 5))) (type: boolean)
-              Statistics: Num rows: 4 Data size: 28 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
-                outputColumnNames: _col0, _col1, _col7
-                Select Operator
-                  expressions: _col0 (type: int), concat(_col1, _col7) (type: string)
-                  outputColumnNames: _col0, _col1
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              predicate: (((key = 0) or (key = 5)) and key is not null) (type: boolean)
+              Statistics: Num rows: 5 Data size: 35 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: key (type: int), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 5 Data size: 35 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col0, _col1, _col4
+                  Select Operator
+                    expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                    outputColumnNames: _col0, _col1
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator
@@ -355,12 +359,12 @@ STAGE PLANS:
             alias: test_table1
             Statistics: Num rows: 10 Data size: 70 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((key < 8) and ((key = 0) or (key = 5))) (type: boolean)
-              Statistics: Num rows: 2 Data size: 14 Basic stats: COMPLETE Column stats: NONE
+              predicate: (((key < 8) and ((key = 0) or (key = 5))) and key is not null) (type: boolean)
+              Statistics: Num rows: 1 Data size: 7 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 2 Data size: 14 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 7 Basic stats: COMPLETE Column stats: NONE
                 Sorted Merge Bucket Map Join Operator
                   condition map:
                        Inner Join 0 to 1

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
index 2b2e7bf..e498500 100644
--- a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
+++ b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
@@ -85,23 +85,27 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 35 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
-                outputColumnNames: _col0, _col1, _col6, _col7
-                Select Operator
-                  expressions: _col0 (type: int), _col6 (type: int), concat(_col1, _col7) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              Select Operator
+                expressions: key (type: int), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 5 Data size: 35 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col0, _col1, _col3, _col4
+                  Select Operator
+                    expressions: _col0 (type: int), _col3 (type: int), concat(_col1, _col4) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator
@@ -214,23 +218,27 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 35 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: int)
-                  1 key (type: int)
-                outputColumnNames: _col0, _col1, _col6, _col7
-                Select Operator
-                  expressions: _col6 (type: int), _col0 (type: int), concat(_col1, _col7) (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  File Output Operator
-                    compressed: false
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                        name: default.test_table3
+              Select Operator
+                expressions: key (type: int), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 5 Data size: 35 Basic stats: COMPLETE Column stats: NONE
+                Sorted Merge Bucket Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col0 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col0, _col1, _col3, _col4
+                  Select Operator
+                    expressions: _col3 (type: int), _col0 (type: int), concat(_col1, _col4) (type: string)
+                    outputColumnNames: _col0, _col1, _col2
+                    File Output Operator
+                      compressed: false
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          name: default.test_table3
 
   Stage: Stage-0
     Move Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/cbo_rp_cross_product_check_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_rp_cross_product_check_2.q.out b/ql/src/test/results/clientpositive/cbo_rp_cross_product_check_2.q.out
index d31c896..a8080b6 100644
--- a/ql/src/test/results/clientpositive/cbo_rp_cross_product_check_2.q.out
+++ b/ql/src/test/results/clientpositive/cbo_rp_cross_product_check_2.q.out
@@ -93,7 +93,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[17][bigTable=?] in task 'Stage-5:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[19][bigTable=?] in task 'Stage-5: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
@@ -118,10 +118,14 @@ STAGE PLANS:
           TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-            HashTable Sink Operator
-              keys:
-                0 
-                1 
+            Select Operator
+              expressions: key (type: string), value (type: string)
+              outputColumnNames: key, value
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              HashTable Sink Operator
+                keys:
+                  0 
+                  1 
         d1 
           TableScan
             alias: d1
@@ -129,10 +133,14 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: string)
-                  1 key (type: string)
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: key, value
+                Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 key (type: string)
+                    1 key (type: string)
 
   Stage: Stage-5
     Map Reduce
@@ -143,25 +151,25 @@ STAGE PLANS:
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: string)
-                  1 key (type: string)
-                outputColumnNames: _col0, _col1, _col5, _col6
-                Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: key, value
+                Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
-                    0 
-                    1 
-                  outputColumnNames: _col0, _col1, _col5, _col6, _col10, _col11
-                  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
+                    0 key (type: string)
+                    1 key (type: string)
+                  outputColumnNames: key, value, key0, value0
+                  Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                  Map Join Operator
+                    condition map:
+                         Inner Join 0 to 1
+                    keys:
+                      0 
+                      1 
+                    outputColumnNames: key, value, key0, value0, key1, value1
                     Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
@@ -179,7 +187,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[25][bigTable=?] in task 'Stage-6:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[26][bigTable=?] in task 'Stage-5: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 
@@ -191,14 +199,14 @@ POSTHOOK: query: explain select * from A join
           where 1 = 1 group by d1.key) od1
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-9 is a root stage
-  Stage-2 depends on stages: Stage-9
-  Stage-8 depends on stages: Stage-2
-  Stage-6 depends on stages: Stage-8
-  Stage-0 depends on stages: Stage-6
+  Stage-8 is a root stage
+  Stage-3 depends on stages: Stage-8
+  Stage-7 depends on stages: Stage-3
+  Stage-5 depends on stages: Stage-7
+  Stage-0 depends on stages: Stage-5
 
 STAGE PLANS:
-  Stage: Stage-9
+  Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
         od1:d1 
@@ -207,67 +215,71 @@ STAGE PLANS:
       Alias -> Map Local Operator Tree:
         od1:d1 
           TableScan
-            alias: d1
+            alias: od1:d1
             Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: string)
-                  1 key (type: string)
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: key
+                Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 key (type: string)
+                    1 key (type: string)
 
-  Stage: Stage-2
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: d2
+            alias: od1:d2
             Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: string)
-                  1 key (type: string)
-                outputColumnNames: _col0
-                Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col0 (type: string)
-                  outputColumnNames: _col0
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: key
+                Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 key (type: string)
+                    1 key (type: string)
+                  outputColumnNames: key
                   Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    keys: _col0 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0
+                  Select Operator
+                    expressions: key (type: string)
+                    outputColumnNames: key
                     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)
+                    Group By Operator
+                      keys: key (type: string)
+                      mode: hash
+                      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
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
         Group By Operator
           keys: KEY._col0 (type: string)
           mode: mergepartial
-          outputColumnNames: _col0
+          outputColumnNames: key
           Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string)
-            outputColumnNames: _col0
-            Statistics: Num rows: 2 Data size: 20 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
+          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-8
+  Stage: Stage-7
     Map Reduce Local Work
       Alias -> Map Local Tables:
         a 
@@ -278,12 +290,16 @@ STAGE PLANS:
           TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-            HashTable Sink Operator
-              keys:
-                0 
-                1 
+            Select Operator
+              expressions: key (type: string), value (type: string)
+              outputColumnNames: key, value
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              HashTable Sink Operator
+                keys:
+                  0 
+                  1 
 
-  Stage: Stage-6
+  Stage: Stage-5
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -293,19 +309,15 @@ STAGE PLANS:
               keys:
                 0 
                 1 
-              outputColumnNames: _col0, _col1, _col5
+              outputColumnNames: key, value, key0
               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
       Local Work:
         Map Reduce Local Work
 
@@ -315,21 +327,21 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[21][bigTable=?] in task 'Stage-6:MAPRED' is a cross product
-Warning: Map Join MAPJOIN[22][bigTable=d2] in task 'Stage-2:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[23][bigTable=?] in task 'Stage-5:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[24][bigTable=?] in task 'Stage-3: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-9 is a root stage
-  Stage-2 depends on stages: Stage-9
-  Stage-8 depends on stages: Stage-2
-  Stage-6 depends on stages: Stage-8
-  Stage-0 depends on stages: Stage-6
+  Stage-8 is a root stage
+  Stage-3 depends on stages: Stage-8
+  Stage-7 depends on stages: Stage-3
+  Stage-5 depends on stages: Stage-7
+  Stage-0 depends on stages: Stage-5
 
 STAGE PLANS:
-  Stage: Stage-9
+  Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
         od1:d1 
@@ -338,61 +350,63 @@ STAGE PLANS:
       Alias -> Map Local Operator Tree:
         od1:d1 
           TableScan
-            alias: d1
+            alias: od1:d1
             Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
-            HashTable Sink Operator
-              keys:
-                0 
-                1 
+            Select Operator
+              expressions: key (type: string)
+              outputColumnNames: key
+              Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
+              HashTable Sink Operator
+                keys:
+                  0 
+                  1 
 
-  Stage: Stage-2
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: d2
+            alias: od1:d2
             Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
-            Map Join Operator
-              condition map:
-                   Inner Join 0 to 1
-              keys:
-                0 
-                1 
-              outputColumnNames: _col0
-              Statistics: Num rows: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
-              Select Operator
-                expressions: _col0 (type: string)
-                outputColumnNames: _col0
+            Select Operator
+              Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 
+                  1 
+                outputColumnNames: key
                 Statistics: Num rows: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
-                Group By Operator
-                  keys: _col0 (type: string)
-                  mode: hash
-                  outputColumnNames: _col0
+                Select Operator
+                  expressions: key (type: string)
+                  outputColumnNames: key
                   Statistics: Num rows: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
+                  Group By Operator
+                    keys: key (type: string)
+                    mode: hash
+                    outputColumnNames: _col0
                     Statistics: Num rows: 11 Data size: 105 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: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
         Group By Operator
           keys: KEY._col0 (type: string)
           mode: mergepartial
-          outputColumnNames: _col0
+          outputColumnNames: key
           Statistics: Num rows: 5 Data size: 47 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string)
-            outputColumnNames: _col0
-            Statistics: Num rows: 5 Data size: 47 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
+          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-8
+  Stage: Stage-7
     Map Reduce Local Work
       Alias -> Map Local Tables:
         a 
@@ -403,12 +417,16 @@ STAGE PLANS:
           TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-            HashTable Sink Operator
-              keys:
-                0 
-                1 
+            Select Operator
+              expressions: key (type: string), value (type: string)
+              outputColumnNames: key, value
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              HashTable Sink Operator
+                keys:
+                  0 
+                  1 
 
-  Stage: Stage-6
+  Stage: Stage-5
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -418,19 +436,15 @@ STAGE PLANS:
               keys:
                 0 
                 1 
-              outputColumnNames: _col0, _col1, _col5
+              outputColumnNames: key, value, key0
               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
       Local Work:
         Map Reduce Local Work
 
@@ -440,9 +454,9 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[47][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
-Warning: Map Join MAPJOIN[39][bigTable=?] in task 'Stage-6:MAPRED' is a cross product
-Warning: Shuffle Join JOIN[21][tables = [ss, od1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[44][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[37][bigTable=?] in task 'Stage-6:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [, ]] 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
@@ -468,7 +482,7 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: a
+            alias: ss:a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: key (type: string)
@@ -488,18 +502,14 @@ STAGE PLANS:
         Group By Operator
           keys: KEY._col0 (type: string)
           mode: mergepartial
-          outputColumnNames: _col0
+          outputColumnNames: key
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string)
-            outputColumnNames: _col0
-            Statistics: Num rows: 250 Data size: 2656 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
+          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-8
     Conditional Operator
@@ -528,19 +538,15 @@ STAGE PLANS:
               keys:
                 0 
                 1 
-              outputColumnNames: _col0, _col1
+              outputColumnNames: key, key0
               Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-              Select Operator
-                expressions: _col0 (type: string), _col1 (type: string)
-                outputColumnNames: _col0, _col1
+              File Output Operator
+                compressed: false
                 Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 275 Data size: 2921 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
       Local Work:
         Map Reduce Local Work
 
@@ -568,19 +574,15 @@ STAGE PLANS:
               keys:
                 0 
                 1 
-              outputColumnNames: _col0, _col1
+              outputColumnNames: key, key0
               Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-              Select Operator
-                expressions: _col0 (type: string), _col1 (type: string)
-                outputColumnNames: _col0, _col1
+              File Output Operator
+                compressed: false
                 Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 275 Data size: 2921 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
       Local Work:
         Map Reduce Local Work
 
@@ -591,12 +593,12 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string)
+              value expressions: key (type: string)
           TableScan
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string)
+              value expressions: key (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -604,19 +606,15 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1
+          outputColumnNames: key, key0
           Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string)
-            outputColumnNames: _col0, _col1
+          File Output Operator
+            compressed: false
             Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 275 Data size: 2921 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-12
     Map Reduce Local Work
@@ -627,65 +625,69 @@ STAGE PLANS:
       Alias -> Map Local Operator Tree:
         od1:d1 
           TableScan
-            alias: d1
+            alias: od1:d1
             Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-              HashTable Sink Operator
-                keys:
-                  0 key (type: string)
-                  1 key (type: string)
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: key
+                Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 key (type: string)
+                    1 key (type: string)
 
   Stage: Stage-4
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: d2
+            alias: od1:d2
             Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-              Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 key (type: string)
-                  1 key (type: string)
-                outputColumnNames: _col0
-                Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col0 (type: string)
-                  outputColumnNames: _col0
+              Select Operator
+                expressions: key (type: string)
+                outputColumnNames: key
+                Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 key (type: string)
+                    1 key (type: string)
+                  outputColumnNames: key
                   Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    keys: _col0 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0
+                  Select Operator
+                    expressions: key (type: string)
+                    outputColumnNames: key
                     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)
+                    Group By Operator
+                      keys: key (type: string)
+                      mode: hash
+                      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
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
         Group By Operator
           keys: KEY._col0 (type: string)
           mode: mergepartial
-          outputColumnNames: _col0
+          outputColumnNames: key
           Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string)
-            outputColumnNames: _col0
-            Statistics: Num rows: 2 Data size: 20 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
+          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-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_rp_join1.q.out b/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
index 69ce6d2..e770028 100644
--- a/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
+++ b/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
@@ -243,44 +243,56 @@ STAGE PLANS:
             Filter Operator
               predicate: (key = 40) (type: boolean)
               Statistics: Num rows: 1 Data size: 11 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: 40 (type: int), value (type: int)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 11 Basic stats: COMPLETE Column stats: NONE
-                value expressions: value (type: int)
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 11 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int)
           TableScan
-            alias: b
+            alias: a
             Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key = 40) (type: boolean)
               Statistics: Num rows: 1 Data size: 11 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: 40 (type: int), value (type: int)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 11 Basic stats: COMPLETE Column stats: NONE
-                value expressions: value (type: int)
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 11 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Outer Join 0 to 1
           keys:
-            0 key (type: int)
-            1 key (type: int)
-          outputColumnNames: _col0, _col1, _col5, _col6
+            0 _col0 (type: int)
+            1 _col0 (type: int)
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            aggregations: sum(hash(_col0,_col1,_col5,_col6))
-            mode: hash
+          Select Operator
+            expressions: hash(_col0,_col1,_col2,_col3) (type: int)
             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
+            Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
+            Group By Operator
+              aggregations: sum(_col0)
+              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