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:10 UTC

[13/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/smb_mapjoin_25.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/smb_mapjoin_25.q.out b/ql/src/test/results/clientpositive/smb_mapjoin_25.q.out
index c0a8959..441338e 100644
--- a/ql/src/test/results/clientpositive/smb_mapjoin_25.q.out
+++ b/ql/src/test/results/clientpositive/smb_mapjoin_25.q.out
@@ -46,6 +46,9 @@ POSTHOOK: query: load data local inpath '../../data/files/smbbucket_3.rc' overwr
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@smb_bucket_3
+Warning: Shuffle Join JOIN[27][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[9][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[22][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-4:MAPRED' is a cross product
 PREHOOK: query: explain 
 select * from (select a.key from smb_bucket_1 a join smb_bucket_2 b on (a.key = b.key) where a.key = 5) t1 left outer join (select c.key from smb_bucket_2 c join smb_bucket_3 d on (c.key = d.key) where c.key=5) t2 on (t1.key=t2.key) where t2.key=5
 PREHOOK: type: QUERY
@@ -68,123 +71,107 @@ STAGE PLANS:
             Filter Operator
               predicate: (key = 5) (type: boolean)
               Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: 5 (type: int)
-                sort order: +
-                Map-reduce partition columns: 5 (type: int)
+              Select Operator
                 Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  sort order: 
+                  Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: b
             Statistics: Num rows: 51 Data size: 206 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (key = 5) (type: boolean)
+              predicate: (5 = key) (type: boolean)
               Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: 5 (type: int)
-                sort order: +
-                Map-reduce partition columns: 5 (type: int)
+              Select Operator
                 Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  sort order: 
+                  Statistics: Num rows: 25 Data size: 100 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 
+            1 
           Statistics: Num rows: 28 Data size: 114 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: 5 (type: int)
-            outputColumnNames: _col0
-            Statistics: Num rows: 28 Data size: 114 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-2
     Map Reduce
       Map Operator Tree:
           TableScan
             Reduce Output Operator
-              key expressions: _col0 (type: int)
-              sort order: +
-              Map-reduce partition columns: _col0 (type: int)
+              sort order: 
               Statistics: Num rows: 28 Data size: 114 Basic stats: COMPLETE Column stats: NONE
           TableScan
             Reduce Output Operator
-              key expressions: _col0 (type: int)
-              sort order: +
-              Map-reduce partition columns: _col0 (type: int)
+              sort order: 
               Statistics: Num rows: 29 Data size: 118 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Left Outer Join0 to 1
+               Inner Join 0 to 1
           keys:
-            0 _col0 (type: int)
-            1 _col0 (type: int)
-          outputColumnNames: _col0, _col1
+            0 
+            1 
           Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
-          Filter Operator
-            predicate: (_col1 = 5) (type: boolean)
-            Statistics: Num rows: 15 Data size: 62 Basic stats: COMPLETE Column stats: NONE
-            Select Operator
-              expressions: _col0 (type: int), 5 (type: int)
-              outputColumnNames: _col0, _col1
-              Statistics: Num rows: 15 Data size: 62 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
-                Statistics: Num rows: 15 Data size: 62 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
+          Select Operator
+            expressions: 5 (type: int), 5 (type: int)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-4
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: c
+            alias: b
             Statistics: Num rows: 51 Data size: 206 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: (key = 5) (type: boolean)
               Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: 5 (type: int)
-                sort order: +
-                Map-reduce partition columns: 5 (type: int)
+              Select Operator
                 Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  sort order: 
+                  Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: d
             Statistics: Num rows: 55 Data size: 222 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (key = 5) (type: boolean)
+              predicate: (5 = key) (type: boolean)
               Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: 5 (type: int)
-                sort order: +
-                Map-reduce partition columns: 5 (type: int)
+              Select Operator
                 Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  sort order: 
+                  Statistics: Num rows: 27 Data size: 108 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 
+            1 
           Statistics: Num rows: 29 Data size: 118 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: 5 (type: int)
-            outputColumnNames: _col0
-            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
+          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
@@ -192,6 +179,11 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
+Warning: Map Join MAPJOIN[56][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[48][bigTable=?] in task 'Stage-6:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[27][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[57][bigTable=?] in task 'Stage-9:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[58][bigTable=?] in task 'Stage-10:MAPRED' is a cross product
 PREHOOK: query: -- explain
 -- select * from smb_bucket_1 a left outer join smb_bucket_2 b on a.key = b.key left outer join src c on a.key=c.value
 
@@ -209,11 +201,41 @@ explain
 select * from (select a.key from smb_bucket_1 a join smb_bucket_2 b on (a.key = b.key) where a.key = 5) t1 left outer join (select c.key from smb_bucket_2 c join smb_bucket_3 d on (c.key = d.key) where c.key=5) t2 on (t1.key=t2.key) where t2.key=5
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
+  Stage-13 is a root stage
+  Stage-9 depends on stages: Stage-13
+  Stage-8 depends on stages: Stage-9, Stage-10 , consists of Stage-11, Stage-12, Stage-2
+  Stage-11 has a backup stage: Stage-2
+  Stage-6 depends on stages: Stage-11
+  Stage-12 has a backup stage: Stage-2
+  Stage-7 depends on stages: Stage-12
+  Stage-2
+  Stage-14 is a root stage
+  Stage-10 depends on stages: Stage-14
+  Stage-0 depends on stages: Stage-6, Stage-7, Stage-2
 
 STAGE PLANS:
-  Stage: Stage-1
+  Stage: Stage-13
+    Map Reduce Local Work
+      Alias -> Map Local Tables:
+        $hdt$_0:$hdt$_1:b 
+          Fetch Operator
+            limit: -1
+      Alias -> Map Local Operator Tree:
+        $hdt$_0:$hdt$_1:b 
+          TableScan
+            alias: b
+            Statistics: Num rows: 51 Data size: 206 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (5 = key) (type: boolean)
+              Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+
+  Stage: Stage-9
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -222,57 +244,183 @@ STAGE PLANS:
             Filter Operator
               predicate: (key = 5) (type: boolean)
               Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 5 (type: int)
-                  1 5 (type: int)
-                Select Operator
-                  expressions: 5 (type: int)
-                  outputColumnNames: _col0
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: int)
+              Select Operator
+                Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 
+                    1 
+                  Statistics: Num rows: 28 Data size: 114 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
+
+  Stage: Stage-8
+    Conditional Operator
+
+  Stage: Stage-11
+    Map Reduce Local Work
+      Alias -> Map Local Tables:
+        $INTNAME1 
+          Fetch Operator
+            limit: -1
+      Alias -> Map Local Operator Tree:
+        $INTNAME1 
           TableScan
-            alias: c
-            Statistics: Num rows: 51 Data size: 206 Basic stats: COMPLETE Column stats: NONE
-            Filter Operator
-              predicate: (key = 5) (type: boolean)
-              Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
-              Sorted Merge Bucket Map Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 5 (type: int)
-                  1 5 (type: int)
-                Select Operator
-                  expressions: 5 (type: int)
-                  outputColumnNames: _col0
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: int)
+            HashTable Sink Operator
+              keys:
+                0 
+                1 
+
+  Stage: Stage-6
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Map Join Operator
+              condition map:
+                   Inner Join 0 to 1
+              keys:
+                0 
+                1 
+              Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: 5 (type: int), 5 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 31 Data size: 129 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
+      Local Work:
+        Map Reduce Local Work
+
+  Stage: Stage-12
+    Map Reduce Local Work
+      Alias -> Map Local Tables:
+        $INTNAME 
+          Fetch Operator
+            limit: -1
+      Alias -> Map Local Operator Tree:
+        $INTNAME 
+          TableScan
+            HashTable Sink Operator
+              keys:
+                0 
+                1 
+
+  Stage: Stage-7
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Map Join Operator
+              condition map:
+                   Inner Join 0 to 1
+              keys:
+                0 
+                1 
+              Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: 5 (type: int), 5 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 31 Data size: 129 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
+      Local Work:
+        Map Reduce Local Work
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              sort order: 
+              Statistics: Num rows: 28 Data size: 114 Basic stats: COMPLETE Column stats: NONE
+          TableScan
+            Reduce Output Operator
+              sort order: 
+              Statistics: Num rows: 29 Data size: 118 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Left Outer Join0 to 1
+               Inner Join 0 to 1
           keys:
-            0 _col0 (type: int)
-            1 _col0 (type: int)
-          outputColumnNames: _col0, _col1
-          Filter Operator
-            predicate: (_col1 = 5) (type: boolean)
-            Select Operator
-              expressions: _col0 (type: int), 5 (type: int)
-              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
+            0 
+            1 
+          Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: 5 (type: int), 5 (type: int)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 31 Data size: 129 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-14
+    Map Reduce Local Work
+      Alias -> Map Local Tables:
+        $hdt$_1:$hdt$_1:$hdt$_1:b 
+          Fetch Operator
+            limit: -1
+      Alias -> Map Local Operator Tree:
+        $hdt$_1:$hdt$_1:$hdt$_1:b 
+          TableScan
+            alias: b
+            Statistics: Num rows: 51 Data size: 206 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (key = 5) (type: boolean)
+              Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                Statistics: Num rows: 25 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+
+  Stage: Stage-10
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: d
+            Statistics: Num rows: 55 Data size: 222 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (5 = key) (type: boolean)
+              Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                Statistics: Num rows: 27 Data size: 108 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 
+                    1 
+                  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
 
   Stage: Stage-0
     Fetch Operator
@@ -280,6 +428,11 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
+Warning: Map Join MAPJOIN[56][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[48][bigTable=?] in task 'Stage-6:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[27][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[57][bigTable=?] in task 'Stage-9:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[58][bigTable=?] in task 'Stage-10:MAPRED' is a cross product
 PREHOOK: query: select * from (select a.key from smb_bucket_1 a join smb_bucket_2 b on (a.key = b.key) where a.key = 5) t1 left outer join (select c.key from smb_bucket_2 c join smb_bucket_3 d on (c.key = d.key) where c.key=5) t2 on (t1.key=t2.key) where t2.key=5
 PREHOOK: type: QUERY
 PREHOOK: Input: default@smb_bucket_1

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join1.q.out b/ql/src/test/results/clientpositive/spark/auto_join1.q.out
index d26a33e..31eebde 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join1.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join1.q.out
@@ -38,8 +38,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), value (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -61,8 +61,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -70,12 +70,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col1, _col2
+                        outputColumnNames: _col0, _col2
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: UDFToInteger(_col2) (type: int), _col1 (type: string)
+                          expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
                           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join10.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join10.q.out b/ql/src/test/results/clientpositive/spark/auto_join10.q.out
index b43e55c..7e814d0 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join10.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join10.q.out
@@ -33,8 +33,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), value (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -58,8 +58,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -67,12 +67,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col1, _col2
                         input vertices:
                           1 Map 3
                         Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: hash(_col0,_col1) (type: int)
+                          expressions: hash(_col1,_col2) (type: int)
                           outputColumnNames: _col0
                           Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
                           Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join11.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join11.q.out b/ql/src/test/results/clientpositive/spark/auto_join11.q.out
index f8fc309..90e272c 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join11.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join11.q.out
@@ -33,8 +33,8 @@ STAGE PLANS:
                     predicate: (UDFToDouble(key) < 100.0) (type: boolean)
                     Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), value (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -58,8 +58,8 @@ STAGE PLANS:
                     predicate: (UDFToDouble(key) < 100.0) (type: boolean)
                     Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -67,12 +67,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col1, _col2
+                        outputColumnNames: _col0, _col2
                         input vertices:
                           1 Map 3
                         Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: hash(_col2,_col1) (type: int)
+                          expressions: hash(_col0,_col2) (type: int)
                           outputColumnNames: _col0
                           Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
                           Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join14.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join14.q.out b/ql/src/test/results/clientpositive/spark/auto_join14.q.out
index 710a316..209eeeb 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join14.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join14.q.out
@@ -29,7 +29,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 2 
+        Map 1 
             Map Operator Tree:
                 TableScan
                   alias: src
@@ -52,7 +52,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 1 
+        Map 2 
             Map Operator Tree:
                 TableScan
                   alias: srcpart
@@ -70,12 +70,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col1, _col3
+                        outputColumnNames: _col0, _col2
                         input vertices:
-                          1 Map 2
+                          0 Map 1
                         Statistics: Num rows: 366 Data size: 3890 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: UDFToInteger(_col3) (type: int), _col1 (type: string)
+                          expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 366 Data size: 3890 Basic stats: COMPLETE Column stats: NONE
                           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join24.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join24.q.out b/ql/src/test/results/clientpositive/spark/auto_join24.q.out
index c714e19..9bc9b93 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join24.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join24.q.out
@@ -37,15 +37,19 @@ STAGE PLANS:
         Map 3 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   Statistics: Num rows: 309 Data size: 1482 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 155 Data size: 743 Basic stats: COMPLETE Column stats: NONE
-                    Spark HashTable Sink Operator
-                      keys:
-                        0 key (type: string)
-                        1 key (type: string)
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 155 Data size: 743 Basic stats: COMPLETE Column stats: NONE
+                      Spark HashTable Sink Operator
+                        keys:
+                          0 _col0 (type: string)
+                          1 _col0 (type: string)
             Local Work:
               Map Reduce Local Work
 
@@ -63,25 +67,29 @@ STAGE PLANS:
                   Filter Operator
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 155 Data size: 743 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: _col1
-                      input vertices:
-                        1 Map 3
-                      Statistics: Num rows: 170 Data size: 817 Basic stats: COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: sum(_col1)
-                        mode: hash
-                        outputColumnNames: _col0
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          sort order: 
+                    Select Operator
+                      expressions: key (type: string), cnt (type: int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 155 Data size: 743 Basic stats: COMPLETE Column stats: NONE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: string)
+                          1 _col0 (type: string)
+                        outputColumnNames: _col1
+                        input vertices:
+                          1 Map 3
+                        Statistics: Num rows: 170 Data size: 817 Basic stats: COMPLETE Column stats: NONE
+                        Group By Operator
+                          aggregations: sum(_col1)
+                          mode: hash
+                          outputColumnNames: _col0
                           Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col0 (type: bigint)
+                          Reduce Output Operator
+                            sort order: 
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                            value expressions: _col0 (type: bigint)
             Local Work:
               Map Reduce Local Work
         Reducer 2 

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join26.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join26.q.out b/ql/src/test/results/clientpositive/spark/auto_join26.q.out
index 3c437a1..71f4338 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join26.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join26.q.out
@@ -29,7 +29,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 3 
+        Map 1 
             Map Operator Tree:
                 TableScan
                   alias: x
@@ -51,10 +51,10 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 2)
+        Reducer 3 <- Map 2 (GROUP, 2)
 #### A masked pattern was here ####
       Vertices:
-        Map 1 
+        Map 2 
             Map Operator Tree:
                 TableScan
                   alias: y
@@ -72,29 +72,25 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col1
+                        outputColumnNames: _col0
                         input vertices:
-                          1 Map 3
+                          0 Map 1
                         Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-                        Select Operator
-                          expressions: _col1 (type: string)
-                          outputColumnNames: _col0
+                        Group By Operator
+                          aggregations: count(1)
+                          keys: _col0 (type: string)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-                          Group By Operator
-                            aggregations: count(1)
-                            keys: _col0 (type: string)
-                            mode: hash
-                            outputColumnNames: _col0, _col1
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string)
+                            sort order: +
+                            Map-reduce partition columns: _col0 (type: string)
                             Statistics: Num rows: 275 Data size: 2921 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: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-                              value expressions: _col1 (type: bigint)
+                            value expressions: _col1 (type: bigint)
             Local Work:
               Map Reduce Local Work
-        Reducer 2 
+        Reducer 3 
             Reduce Operator Tree:
               Group By Operator
                 aggregations: count(VALUE._col0)

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join32.q.out b/ql/src/test/results/clientpositive/spark/auto_join32.q.out
index 679dd79..2dd6cc1 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join32.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join32.q.out
@@ -44,10 +44,14 @@ STAGE PLANS:
                   Filter Operator
                     predicate: name is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                    Spark HashTable Sink Operator
-                      keys:
-                        0 name (type: string)
-                        1 name (type: string)
+                    Select Operator
+                      expressions: name (type: string), registration (type: string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                      Spark HashTable Sink Operator
+                        keys:
+                          0 _col0 (type: string)
+                          1 _col0 (type: string)
             Local Work:
               Map Reduce Local Work
 
@@ -65,44 +69,52 @@ STAGE PLANS:
                   Filter Operator
                     predicate: name is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 name (type: string)
-                        1 name (type: string)
-                      outputColumnNames: _col0, _col8
-                      input vertices:
-                        1 Map 3
+                    Select Operator
+                      expressions: name (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                      Group By Operator
-                        aggregations: count(DISTINCT _col8)
-                        keys: _col0 (type: string), _col8 (type: string)
-                        mode: hash
-                        outputColumnNames: _col0, _col1, _col2
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: string)
+                          1 _col0 (type: string)
+                        outputColumnNames: _col0, _col2
+                        input vertices:
+                          1 Map 3
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string)
-                          sort order: ++
-                          Map-reduce partition columns: _col0 (type: string)
+                        Group By Operator
+                          keys: _col0 (type: string), _col2 (type: string)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string)
+                            sort order: ++
+                            Map-reduce partition columns: _col0 (type: string)
+                            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Local Work:
               Map Reduce Local Work
         Reducer 2 
             Reduce Operator Tree:
               Group By Operator
-                aggregations: count(DISTINCT KEY._col1:0._col0)
-                keys: KEY._col0 (type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Group By Operator
+                  aggregations: count(_col1)
+                  keys: _col0 (type: string)
+                  mode: complete
+                  outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 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
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.TextInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -173,40 +185,48 @@ STAGE PLANS:
                   Filter Operator
                     predicate: name is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                    Sorted Merge Bucket Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 name (type: string)
-                        1 name (type: string)
-                      outputColumnNames: _col0, _col8
+                    Select Operator
+                      expressions: name (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                      Group By Operator
-                        aggregations: count(DISTINCT _col8)
-                        keys: _col0 (type: string), _col8 (type: string)
-                        mode: hash
-                        outputColumnNames: _col0, _col1, _col2
+                      Sorted Merge Bucket Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: string)
+                          1 _col0 (type: string)
+                        outputColumnNames: _col0, _col2
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string)
-                          sort order: ++
-                          Map-reduce partition columns: _col0 (type: string)
+                        Group By Operator
+                          keys: _col0 (type: string), _col2 (type: string)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string)
+                            sort order: ++
+                            Map-reduce partition columns: _col0 (type: string)
+                            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
         Reducer 2 
             Reduce Operator Tree:
               Group By Operator
-                aggregations: count(DISTINCT KEY._col1:0._col0)
-                keys: KEY._col0 (type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Group By Operator
+                  aggregations: count(_col1)
+                  keys: _col0 (type: string)
+                  mode: complete
+                  outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 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
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.TextInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -291,40 +311,48 @@ STAGE PLANS:
                   Filter Operator
                     predicate: name is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                    Sorted Merge Bucket Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 name (type: string)
-                        1 name (type: string)
-                      outputColumnNames: _col0, _col8
+                    Select Operator
+                      expressions: name (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                      Group By Operator
-                        aggregations: count(DISTINCT _col8)
-                        keys: _col0 (type: string), _col8 (type: string)
-                        mode: hash
-                        outputColumnNames: _col0, _col1, _col2
+                      Sorted Merge Bucket Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: string)
+                          1 _col0 (type: string)
+                        outputColumnNames: _col0, _col2
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string)
-                          sort order: ++
-                          Map-reduce partition columns: _col0 (type: string)
+                        Group By Operator
+                          keys: _col0 (type: string), _col2 (type: string)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string)
+                            sort order: ++
+                            Map-reduce partition columns: _col0 (type: string)
+                            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
         Reducer 2 
             Reduce Operator Tree:
               Group By Operator
-                aggregations: count(DISTINCT KEY._col1:0._col0)
-                keys: KEY._col0 (type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Group By Operator
+                  aggregations: count(_col1)
+                  keys: _col0 (type: string)
+                  mode: complete
+                  outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 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
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.TextInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -422,21 +450,20 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 2)
-        Reducer 3 <- Reducer 2 (GROUP, 2)
+        Reducer 2 <- Map 1 (GROUP PARTITION-LEVEL SORT, 2)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: v
+                  alias: s
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
                     predicate: ((p = 'bar') and name is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: name (type: string), registration (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: name (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Sorted Merge Bucket Map Join Operator
                         condition map:
@@ -444,17 +471,17 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col1, _col3
+                        outputColumnNames: _col0, _col3
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                         Group By Operator
-                          keys: _col1 (type: string), _col3 (type: string)
+                          keys: _col0 (type: string), _col3 (type: string)
                           mode: hash
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                           Reduce Output Operator
                             key expressions: _col0 (type: string), _col1 (type: string)
                             sort order: ++
-                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
+                            Map-reduce partition columns: _col0 (type: string)
                             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
         Reducer 2 
             Reduce Operator Tree:
@@ -464,32 +491,18 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Group By Operator
-                  aggregations: count(_col0)
-                  keys: _col1 (type: string)
-                  mode: hash
+                  aggregations: count(_col1)
+                  keys: _col0 (type: string)
+                  mode: complete
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
+                  File Output Operator
+                    compressed: false
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                    value expressions: _col1 (type: bigint)
-        Reducer 3 
-            Reduce Operator Tree:
-              Group By Operator
-                aggregations: count(VALUE._col0)
-                keys: KEY._col0 (type: string)
-                mode: mergepartial
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 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

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out b/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
index b6b89c1..601b27d 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
@@ -14,7 +14,7 @@ POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/in3.txt' INTO TABLE my
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@myinput1
-Warning: Map Join MAPJOIN[19][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[20][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value))  FROM myinput1 a JOIN myinput1 b on a.key > 40 AND a.value > 50 AND a.key = a.value AND b.key > 40 AND b.value > 50 AND b.key = b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1
@@ -24,7 +24,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@myinput1
 #### A masked pattern was here ####
 3078400
-Warning: Map Join MAPJOIN[15][bigTable=a] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[16][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value))  FROM myinput1 a LEFT OUTER JOIN myinput1 b on a.key > 40 AND a.value > 50 AND a.key = a.value AND b.key > 40 AND b.value > 50 AND b.key = b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1
@@ -34,7 +34,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@myinput1
 #### A masked pattern was here ####
 4937935
-Warning: Map Join MAPJOIN[15][bigTable=b] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[16][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value))  FROM myinput1 a RIGHT OUTER JOIN myinput1 b on a.key > 40 AND a.value > 50 AND a.key = a.value AND b.key > 40 AND b.value > 50 AND b.key = b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1
@@ -300,7 +300,7 @@ POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/in2.txt' into table sm
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@smb_input2
-Warning: Map Join MAPJOIN[19][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[20][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value)) FROM myinput1 a JOIN myinput1 b on a.key > 40 AND a.value > 50 AND a.key = a.value AND b.key > 40 AND b.value > 50 AND b.key = b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1
@@ -310,7 +310,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@myinput1
 #### A masked pattern was here ####
 3078400
-Warning: Map Join MAPJOIN[19][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[20][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value)) FROM myinput1 a LEFT OUTER JOIN myinput1 b on a.key > 40 AND a.value > 50 AND a.key = a.value AND b.key > 40 AND b.value > 50 AND b.key = b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1
@@ -320,7 +320,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@myinput1
 #### A masked pattern was here ####
 3078400
-Warning: Map Join MAPJOIN[19][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[20][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value)) FROM myinput1 a RIGHT OUTER JOIN myinput1 b on a.key > 40 AND a.value > 50 AND a.key = a.value AND b.key > 40 AND b.value > 50 AND b.key = b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join_nulls.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join_nulls.q.out b/ql/src/test/results/clientpositive/spark/auto_join_nulls.q.out
index 4b809ce..0024b24 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join_nulls.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join_nulls.q.out
@@ -34,7 +34,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@myinput1
 #### A masked pattern was here ####
 13630578
-Warning: Map Join MAPJOIN[15][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[14][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT sum(hash(a.key,a.value,b.key,b.value)) FROM myinput1 a RIGHT OUTER JOIN myinput1 b
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1

http://git-wip-us.apache.org/repos/asf/hive/blob/7dab21ac/ql/src/test/results/clientpositive/spark/auto_join_reordering_values.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join_reordering_values.q.out b/ql/src/test/results/clientpositive/spark/auto_join_reordering_values.q.out
index 9df55b9..6466c39 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join_reordering_values.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join_reordering_values.q.out
@@ -191,14 +191,18 @@ STAGE PLANS:
                     isSamplingPred: false
                     predicate: (((date is not null and dealid is not null) and cityid is not null) and userid is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: date (type: string)
-                      sort order: +
-                      Map-reduce partition columns: date (type: string)
+                    Select Operator
+                      expressions: dealid (type: int), date (type: string), cityid (type: int), userid (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                      tag: 0
-                      value expressions: dealid (type: int), cityid (type: int), userid (type: int)
-                      auto parallelism: false
+                      Reduce Output Operator
+                        key expressions: _col1 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: string)
+                        Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
+                        tag: 0
+                        value expressions: _col0 (type: int), _col2 (type: int), _col3 (type: int)
+                        auto parallelism: false
             Path -> Alias:
 #### A masked pattern was here ####
             Path -> Partition:
@@ -251,20 +255,24 @@ STAGE PLANS:
         Map 6 
             Map Operator Tree:
                 TableScan
-                  alias: dim_pay_date
+                  alias: orderpayment
                   Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
                   GatherStats: false
                   Filter Operator
                     isSamplingPred: false
                     predicate: date is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: date (type: string)
-                      sort order: +
-                      Map-reduce partition columns: date (type: string)
+                    Select Operator
+                      expressions: date (type: string)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                      tag: 1
-                      auto parallelism: false
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
+                        tag: 1
+                        auto parallelism: false
             Path -> Alias:
 #### A masked pattern was here ####
             Path -> Partition:
@@ -313,24 +321,28 @@ STAGE PLANS:
                     name: default.orderpayment_small
                   name: default.orderpayment_small
             Truncated Path -> Alias:
-              /orderpayment_small [dim_pay_date]
+              /orderpayment_small [orderpayment]
         Map 7 
             Map Operator Tree:
                 TableScan
-                  alias: deal
+                  alias: orderpayment
                   Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
                   GatherStats: false
                   Filter Operator
                     isSamplingPred: false
                     predicate: dealid is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: dealid (type: int)
-                      sort order: +
-                      Map-reduce partition columns: dealid (type: int)
+                    Select Operator
+                      expressions: dealid (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                      tag: 1
-                      auto parallelism: false
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
+                        tag: 1
+                        auto parallelism: false
             Path -> Alias:
 #### A masked pattern was here ####
             Path -> Partition:
@@ -379,24 +391,28 @@ STAGE PLANS:
                     name: default.orderpayment_small
                   name: default.orderpayment_small
             Truncated Path -> Alias:
-              /orderpayment_small [deal]
+              /orderpayment_small [orderpayment]
         Map 8 
             Map Operator Tree:
                 TableScan
-                  alias: order_city
+                  alias: orderpayment
                   Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
                   GatherStats: false
                   Filter Operator
                     isSamplingPred: false
                     predicate: cityid is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: cityid (type: int)
-                      sort order: +
-                      Map-reduce partition columns: cityid (type: int)
+                    Select Operator
+                      expressions: cityid (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
-                      tag: 1
-                      auto parallelism: false
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE Column stats: NONE
+                        tag: 1
+                        auto parallelism: false
             Path -> Alias:
 #### A masked pattern was here ####
             Path -> Partition:
@@ -445,7 +461,7 @@ STAGE PLANS:
                     name: default.orderpayment_small
                   name: default.orderpayment_small
             Truncated Path -> Alias:
-              /orderpayment_small [order_city]
+              /orderpayment_small [orderpayment]
         Map 9 
             Map Operator Tree:
                 TableScan
@@ -456,13 +472,17 @@ STAGE PLANS:
                     isSamplingPred: false
                     predicate: userid is not null (type: boolean)
                     Statistics: Num rows: 50 Data size: 144 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: userid (type: int)
-                      sort order: +
-                      Map-reduce partition columns: userid (type: int)
+                    Select Operator
+                      expressions: userid (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 50 Data size: 144 Basic stats: COMPLETE Column stats: NONE
-                      tag: 1
-                      auto parallelism: false
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 50 Data size: 144 Basic stats: COMPLETE Column stats: NONE
+                        tag: 1
+                        auto parallelism: false
             Path -> Alias:
 #### A masked pattern was here ####
             Path -> Partition:
@@ -519,9 +539,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 date (type: string)
-                  1 date (type: string)
-                outputColumnNames: _col0, _col3, _col4, _col9
+                  0 _col1 (type: string)
+                  1 _col0 (type: string)
+                outputColumnNames: _col0, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 39 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -529,7 +549,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 1 Data size: 39 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col3 (type: int), _col4 (type: int), _col9 (type: string)
+                  value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: string)
                   auto parallelism: false
         Reducer 3 
             Needs Tagging: true
@@ -539,16 +559,16 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 dealid (type: int)
-                outputColumnNames: _col3, _col4, _col9, _col16
+                  1 _col0 (type: int)
+                outputColumnNames: _col2, _col3, _col4, _col5
                 Statistics: Num rows: 1 Data size: 42 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col3 (type: int)
+                  key expressions: _col2 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col3 (type: int)
+                  Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 1 Data size: 42 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col4 (type: int), _col9 (type: string), _col16 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: string), _col5 (type: int)
                   auto parallelism: false
         Reducer 4 
             Needs Tagging: true
@@ -557,17 +577,17 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col3 (type: int)
-                  1 cityid (type: int)
-                outputColumnNames: _col4, _col9, _col16
+                  0 _col2 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col3, _col4, _col5
                 Statistics: Num rows: 1 Data size: 46 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col4 (type: int)
+                  key expressions: _col3 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col4 (type: int)
+                  Map-reduce partition columns: _col3 (type: int)
                   Statistics: Num rows: 1 Data size: 46 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col9 (type: string), _col16 (type: int)
+                  value expressions: _col4 (type: string), _col5 (type: int)
                   auto parallelism: false
         Reducer 5 
             Needs Tagging: true
@@ -576,12 +596,12 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col4 (type: int)
-                  1 userid (type: int)
-                outputColumnNames: _col9, _col16
+                  0 _col3 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col4, _col5
                 Statistics: Num rows: 55 Data size: 158 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col9 (type: string), _col16 (type: int)
+                  expressions: _col4 (type: string), _col5 (type: int)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 55 Data size: 158 Basic stats: COMPLETE Column stats: NONE
                   Limit