http://git-wip-us.apache.org/repos/asf/hive/blob/12a1784d/ql/src/test/results/clientpositive/perf/spark/query75.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query75.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query75.q.out
index f4fca34..4b76570 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query75.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query75.q.out
@@ -144,25 +144,25 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 13 <- Map 12 (PARTITION-LEVEL SORT, 400), Map 16 
(PARTITION-LEVEL SORT, 400)
-        Reducer 14 <- Map 10 (PARTITION-LEVEL SORT, 438), Reducer 13 
(PARTITION-LEVEL SORT, 438)
+        Reducer 13 <- Map 12 (PARTITION-LEVEL SORT, 398), Map 16 
(PARTITION-LEVEL SORT, 398)
+        Reducer 14 <- Map 10 (PARTITION-LEVEL SORT, 440), Reducer 13 
(PARTITION-LEVEL SORT, 440)
         Reducer 15 <- Map 18 (PARTITION-LEVEL SORT, 516), Reducer 14 
(PARTITION-LEVEL SORT, 516)
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 308), Map 16 
(PARTITION-LEVEL SORT, 308)
-        Reducer 20 <- Map 16 (PARTITION-LEVEL SORT, 156), Map 19 
(PARTITION-LEVEL SORT, 156)
-        Reducer 21 <- Map 10 (PARTITION-LEVEL SORT, 169), Reducer 20 
(PARTITION-LEVEL SORT, 169)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 306), Map 16 
(PARTITION-LEVEL SORT, 306)
+        Reducer 20 <- Map 16 (PARTITION-LEVEL SORT, 154), Map 19 
(PARTITION-LEVEL SORT, 154)
+        Reducer 21 <- Map 10 (PARTITION-LEVEL SORT, 171), Reducer 20 
(PARTITION-LEVEL SORT, 171)
         Reducer 22 <- Map 25 (PARTITION-LEVEL SORT, 196), Reducer 21 
(PARTITION-LEVEL SORT, 196)
-        Reducer 27 <- Map 26 (PARTITION-LEVEL SORT, 308), Map 32 
(PARTITION-LEVEL SORT, 308)
-        Reducer 28 <- Map 33 (PARTITION-LEVEL SORT, 336), Reducer 27 
(PARTITION-LEVEL SORT, 336)
+        Reducer 27 <- Map 26 (PARTITION-LEVEL SORT, 306), Map 32 
(PARTITION-LEVEL SORT, 306)
+        Reducer 28 <- Map 33 (PARTITION-LEVEL SORT, 338), Reducer 27 
(PARTITION-LEVEL SORT, 338)
         Reducer 29 <- Map 34 (PARTITION-LEVEL SORT, 393), Reducer 28 
(PARTITION-LEVEL SORT, 393)
-        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 336), Reducer 2 
(PARTITION-LEVEL SORT, 336)
+        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 338), Reducer 2 
(PARTITION-LEVEL SORT, 338)
         Reducer 30 <- Reducer 29 (GROUP, 934), Reducer 38 (GROUP, 934)
         Reducer 31 <- Reducer 30 (GROUP PARTITION-LEVEL SORT, 671), Reducer 45 
(GROUP PARTITION-LEVEL SORT, 671)
-        Reducer 36 <- Map 32 (PARTITION-LEVEL SORT, 400), Map 35 
(PARTITION-LEVEL SORT, 400)
-        Reducer 37 <- Map 33 (PARTITION-LEVEL SORT, 438), Reducer 36 
(PARTITION-LEVEL SORT, 438)
+        Reducer 36 <- Map 32 (PARTITION-LEVEL SORT, 398), Map 35 
(PARTITION-LEVEL SORT, 398)
+        Reducer 37 <- Map 33 (PARTITION-LEVEL SORT, 440), Reducer 36 
(PARTITION-LEVEL SORT, 440)
         Reducer 38 <- Map 41 (PARTITION-LEVEL SORT, 516), Reducer 37 
(PARTITION-LEVEL SORT, 516)
         Reducer 4 <- Map 11 (PARTITION-LEVEL SORT, 393), Reducer 3 
(PARTITION-LEVEL SORT, 393)
-        Reducer 43 <- Map 32 (PARTITION-LEVEL SORT, 156), Map 42 
(PARTITION-LEVEL SORT, 156)
-        Reducer 44 <- Map 33 (PARTITION-LEVEL SORT, 169), Reducer 43 
(PARTITION-LEVEL SORT, 169)
+        Reducer 43 <- Map 32 (PARTITION-LEVEL SORT, 154), Map 42 
(PARTITION-LEVEL SORT, 154)
+        Reducer 44 <- Map 33 (PARTITION-LEVEL SORT, 171), Reducer 43 
(PARTITION-LEVEL SORT, 171)
         Reducer 45 <- Map 48 (PARTITION-LEVEL SORT, 196), Reducer 44 
(PARTITION-LEVEL SORT, 196)
         Reducer 5 <- Reducer 15 (GROUP, 934), Reducer 4 (GROUP, 934)
         Reducer 6 <- Reducer 22 (GROUP PARTITION-LEVEL SORT, 671), Reducer 5 
(GROUP PARTITION-LEVEL SORT, 671)
@@ -183,28 +183,29 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
         Map 10 
             Map Operator Tree:
                 TableScan
-                  alias: date_dim
-                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: item
+                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_year = 2001) and d_date_sk is not null) 
(type: boolean)
-                    Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: ((i_category = 'Sports') and i_brand_id is not 
null and i_category_id is not null and i_class_id is not null and i_item_sk is 
not null and i_manufact_id is not null) (type: boolean)
+                    Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                      expressions: i_item_sk (type: int), i_brand_id (type: 
int), i_class_id (type: int), i_category_id (type: int), i_manufact_id (type: 
int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col5
+                      Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 231000 Data size: 331780228 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col5 (type: int)
         Map 11 
             Map Operator Tree:
                 TableScan
@@ -236,29 +237,28 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
         Map 16 
             Map Operator Tree:
                 TableScan
-                  alias: item
-                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: date_dim
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((i_category = 'Sports') and i_brand_id is not 
null and i_category_id is not null and i_class_id is not null and i_item_sk is 
not null and i_manufact_id is not null) (type: boolean)
-                    Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: ((d_year = 2001) and d_date_sk is not null) 
(type: boolean)
+                    Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: i_item_sk (type: int), i_brand_id (type: 
int), i_class_id (type: int), i_category_id (type: int), i_manufact_id (type: 
int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col5
-                      Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 231000 Data size: 331780228 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col5 (type: int)
+                        Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
         Map 18 
             Map Operator Tree:
                 TableScan
@@ -290,11 +290,11 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
         Map 25 
             Map Operator Tree:
                 TableScan
@@ -326,46 +326,46 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
         Map 32 
             Map Operator Tree:
                 TableScan
-                  alias: item
-                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: date_dim
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((i_category = 'Sports') and i_brand_id is not 
null and i_category_id is not null and i_class_id is not null and i_item_sk is 
not null and i_manufact_id is not null) (type: boolean)
-                    Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: ((d_year = 2002) and d_date_sk is not null) 
(type: boolean)
+                    Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: i_item_sk (type: int), i_brand_id (type: 
int), i_class_id (type: int), i_category_id (type: int), i_manufact_id (type: 
int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col5
-                      Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 231000 Data size: 331780228 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col5 (type: int)
+                        Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
         Map 33 
             Map Operator Tree:
                 TableScan
-                  alias: date_dim
-                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: item
+                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_year = 2002) and d_date_sk is not null) 
(type: boolean)
-                    Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: ((i_category = 'Sports') and i_brand_id is not 
null and i_category_id is not null and i_class_id is not null and i_item_sk is 
not null and i_manufact_id is not null) (type: boolean)
+                    Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                      expressions: i_item_sk (type: int), i_brand_id (type: 
int), i_class_id (type: int), i_category_id (type: int), i_manufact_id (type: 
int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col5
+                      Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 231000 Data size: 331780228 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col5 (type: int)
         Map 34 
             Map Operator Tree:
                 TableScan
@@ -397,11 +397,11 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
         Map 41 
             Map Operator Tree:
                 TableScan
@@ -433,11 +433,11 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: decimal(7,2))
         Map 48 
             Map Operator Tree:
                 TableScan
@@ -462,41 +462,41 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, 
_col7, _col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: int), _col7 (type: 
int), _col8 (type: int), _col10 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), 
_col4 (type: decimal(7,2))
         Reducer 14 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, 
_col10, _col12
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col10 
(type: int)
+                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 
(type: int)
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8, _col10, 
_col15, _col16
+                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, 
_col15, _col16
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: int), _col7 (type: int), _col8 
(type: int), _col10 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
+                  expressions: _col8 (type: int), _col9 (type: int), _col10 
(type: int), _col12 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -515,57 +515,57 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, 
_col7, _col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4
                 Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: int), _col7 (type: 
int), _col8 (type: int), _col10 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), 
_col4 (type: decimal(7,2))
         Reducer 20 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, 
_col7, _col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: int), _col7 (type: 
int), _col8 (type: int), _col10 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), 
_col4 (type: decimal(7,2))
         Reducer 21 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, 
_col10, _col12
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col10 
(type: int)
+                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 
(type: int)
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8, _col10, 
_col15, _col16
+                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, 
_col15, _col16
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: int), _col7 (type: int), _col8 
(type: int), _col10 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
+                  expressions: _col8 (type: int), _col9 (type: int), _col10 
(type: int), _col12 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 191667562 Data size: 26061245514 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -584,41 +584,41 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, 
_col7, _col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4
                 Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: int), _col7 (type: 
int), _col8 (type: int), _col10 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), 
_col4 (type: decimal(7,2))
         Reducer 28 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, 
_col10, _col12
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col10 
(type: int)
+                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 
(type: int)
         Reducer 29 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8, _col10, 
_col15, _col16
+                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, 
_col15, _col16
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: int), _col7 (type: int), _col8 
(type: int), _col10 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
+                  expressions: _col8 (type: int), _col9 (type: int), _col10 
(type: int), _col12 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -637,16 +637,16 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, 
_col10, _col12
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col10 
(type: int)
+                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 
(type: int)
         Reducer 30 
             Reduce Operator Tree:
               Group By Operator
@@ -689,41 +689,41 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, 
_col7, _col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: int), _col7 (type: 
int), _col8 (type: int), _col10 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), 
_col4 (type: decimal(7,2))
         Reducer 37 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, 
_col10, _col12
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col10 
(type: int)
+                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 
(type: int)
         Reducer 38 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8, _col10, 
_col15, _col16
+                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, 
_col15, _col16
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: int), _col7 (type: int), _col8 
(type: int), _col10 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
+                  expressions: _col8 (type: int), _col9 (type: int), _col10 
(type: int), _col12 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -741,10 +741,10 @@ STAGE PLANS:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8, _col10, 
_col15, _col16
+                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, 
_col15, _col16
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: int), _col7 (type: int), _col8 
(type: int), _col10 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
+                  expressions: _col8 (type: int), _col9 (type: int), _col10 
(type: int), _col12 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -763,41 +763,41 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, 
_col7, _col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: int), _col7 (type: 
int), _col8 (type: int), _col10 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), 
_col4 (type: decimal(7,2))
         Reducer 44 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, 
_col10, _col12
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col10 
(type: int)
+                  value expressions: _col3 (type: int), _col4 (type: 
decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 
(type: int)
         Reducer 45 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8, _col10, 
_col15, _col16
+                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, 
_col15, _col16
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: int), _col7 (type: int), _col8 
(type: int), _col10 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
+                  expressions: _col8 (type: int), _col9 (type: int), _col10 
(type: int), _col12 (type: int), (_col3 - COALESCE(_col15,0)) (type: int), 
(_col4 - COALESCE(_col16,0)) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 191667562 Data size: 26061245514 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/12a1784d/ql/src/test/results/clientpositive/perf/spark/query76.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query76.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query76.q.out
index 5e6b208..0e18f35 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query76.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query76.q.out
@@ -56,10 +56,10 @@ STAGE PLANS:
         Reducer 14 <- Map 13 (PARTITION-LEVEL SORT, 158), Map 16 
(PARTITION-LEVEL SORT, 158)
         Reducer 15 <- Map 17 (PARTITION-LEVEL SORT, 169), Reducer 14 
(PARTITION-LEVEL SORT, 169)
         Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 204), Map 6 (PARTITION-LEVEL 
SORT, 204)
-        Reducer 3 <- Map 12 (PARTITION-LEVEL SORT, 219), Reducer 2 
(PARTITION-LEVEL SORT, 219)
+        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 219), Reducer 2 
(PARTITION-LEVEL SORT, 219)
         Reducer 4 <- Reducer 10 (GROUP, 518), Reducer 15 (GROUP, 518), Reducer 
3 (GROUP, 518)
         Reducer 5 <- Reducer 4 (SORT, 1)
-        Reducer 9 <- Map 1 (PARTITION-LEVEL SORT, 82), Map 11 (PARTITION-LEVEL 
SORT, 82)
+        Reducer 9 <- Map 11 (PARTITION-LEVEL SORT, 82), Map 8 (PARTITION-LEVEL 
SORT, 82)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -83,21 +83,21 @@ STAGE PLANS:
         Map 11 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: item
+                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_item_sk is not null and ws_sold_date_sk is 
not null and ws_web_page_sk is null) (type: boolean)
-                    Statistics: Num rows: 72001334 Data size: 9790099106 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: i_item_sk is not null (type: boolean)
+                    Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_item_sk 
(type: int), ws_ext_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col3
-                      Statistics: Num rows: 72001334 Data size: 9790099106 
Basic stats: COMPLETE Column stats: NONE
+                      expressions: i_item_sk (type: int), i_category (type: 
string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
-                        Statistics: Num rows: 72001334 Data size: 9790099106 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col3 (type: 
decimal(7,2))
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 462000 Data size: 663560457 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
         Map 12 
             Map Operator Tree:
                 TableScan
@@ -119,24 +119,6 @@ STAGE PLANS:
         Map 13 
             Map Operator Tree:
                 TableScan
-                  alias: item
-                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: i_item_sk is not null (type: boolean)
-                    Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: i_item_sk (type: int), i_category (type: 
string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 462000 Data size: 663560457 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
-        Map 16 
-            Map Operator Tree:
-                TableScan
                   alias: catalog_sales
                   Statistics: Num rows: 287989836 Data size: 38999608952 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
@@ -152,6 +134,24 @@ STAGE PLANS:
                         Map-reduce partition columns: _col2 (type: int)
                         Statistics: Num rows: 143994918 Data size: 19499804476 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col3 (type: 
decimal(7,2))
+        Map 16 
+            Map Operator Tree:
+                TableScan
+                  alias: item
+                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: i_item_sk is not null (type: boolean)
+                    Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: i_item_sk (type: int), i_category (type: 
string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 462000 Data size: 663560457 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
         Map 17 
             Map Operator Tree:
                 TableScan
@@ -188,15 +188,51 @@ STAGE PLANS:
                         Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 287997817 Data size: 25407250999 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col3 (type: 
decimal(7,2))
+        Map 7 
+            Map Operator Tree:
+                TableScan
+                  alias: date_dim
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: d_date_sk is not null (type: boolean)
+                    Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: d_date_sk (type: int), d_year (type: int), 
d_qoy (type: int)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: int)
+        Map 8 
+            Map Operator Tree:
+                TableScan
+                  alias: web_sales
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (ws_item_sk is not null and ws_sold_date_sk is 
not null and ws_web_page_sk is null) (type: boolean)
+                    Statistics: Num rows: 72001334 Data size: 9790099106 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ws_sold_date_sk (type: int), ws_item_sk 
(type: int), ws_ext_sales_price (type: decimal(7,2))
+                      outputColumnNames: _col0, _col1, _col3
+                      Statistics: Num rows: 72001334 Data size: 9790099106 
Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col1 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: int)
+                        Statistics: Num rows: 72001334 Data size: 9790099106 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: int), _col3 (type: 
decimal(7,2))
         Reducer 10 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
-                outputColumnNames: _col1, _col5, _col7, _col8
+                outputColumnNames: _col3, _col5, _col7, _col8
                 Statistics: Num rows: 87121617 Data size: 11846020431 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 'web' (type: string), 'ws_web_page_sk' (type: 
string), _col7 (type: int), _col8 (type: int), _col1 (type: string), _col5 
(type: decimal(7,2))
+                  expressions: 'web' (type: string), 'ws_web_page_sk' (type: 
string), _col7 (type: int), _col8 (type: int), _col5 (type: string), _col3 
(type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 87121617 Data size: 11846020431 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -218,25 +254,25 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
-                  1 _col2 (type: int)
-                outputColumnNames: _col1, _col2, _col5
+                  0 _col2 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0, _col3, _col5
                 Statistics: Num rows: 158394413 Data size: 21449785388 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col0 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
+                  Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 158394413 Data size: 21449785388 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col5 (type: 
decimal(7,2))
+                  value expressions: _col3 (type: decimal(7,2)), _col5 (type: 
string)
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
-                outputColumnNames: _col1, _col5, _col7, _col8
+                outputColumnNames: _col3, _col5, _col7, _col8
                 Statistics: Num rows: 174233858 Data size: 23594764438 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 'catalog' (type: string), 'cs_warehouse_sk' 
(type: string), _col7 (type: int), _col8 (type: int), _col1 (type: string), 
_col5 (type: decimal(7,2))
+                  expressions: 'catalog' (type: string), 'cs_warehouse_sk' 
(type: string), _col7 (type: int), _col8 (type: int), _col5 (type: string), 
_col3 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 174233858 Data size: 23594764438 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -328,16 +364,16 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
-                  1 _col1 (type: int)
-                outputColumnNames: _col1, _col2, _col5
+                  0 _col1 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0, _col3, _col5
                 Statistics: Num rows: 79201469 Data size: 10769109250 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col0 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
+                  Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 79201469 Data size: 10769109250 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col5 (type: 
decimal(7,2))
+                  value expressions: _col3 (type: decimal(7,2)), _col5 (type: 
string)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/12a1784d/ql/src/test/results/clientpositive/perf/spark/query77.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query77.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query77.q.out
index f30af9f..638bbd9 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query77.q.out
@@ -421,11 +421,11 @@ STAGE PLANS:
         Reducer 11 <- Reducer 10 (GROUP, 43)
         Reducer 15 <- Map 14 (GROUP, 336)
         Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 398), Map 7 (PARTITION-LEVEL 
SORT, 398)
-        Reducer 21 <- Map 12 (PARTITION-LEVEL SORT, 11), Map 20 
(PARTITION-LEVEL SORT, 11)
-        Reducer 22 <- Reducer 21 (GROUP, 13)
+        Reducer 21 <- Map 12 (PARTITION-LEVEL SORT, 154), Map 20 
(PARTITION-LEVEL SORT, 154)
+        Reducer 22 <- Reducer 21 (GROUP, 186)
         Reducer 23 <- Reducer 22 (PARTITION-LEVEL SORT, 99), Reducer 28 
(PARTITION-LEVEL SORT, 99)
-        Reducer 27 <- Map 26 (PARTITION-LEVEL SORT, 154), Map 29 
(PARTITION-LEVEL SORT, 154)
-        Reducer 28 <- Reducer 27 (GROUP, 186)
+        Reducer 27 <- Map 26 (PARTITION-LEVEL SORT, 11), Map 29 
(PARTITION-LEVEL SORT, 11)
+        Reducer 28 <- Reducer 27 (GROUP, 13)
         Reducer 3 <- Reducer 2 (GROUP, 481)
         Reducer 4 <- Reducer 11 (PARTITION-LEVEL SORT, 262), Reducer 3 
(PARTITION-LEVEL SORT, 262)
         Reducer 5 <- Reducer 15 (GROUP, 1009), Reducer 23 (GROUP, 1009), 
Reducer 4 (GROUP, 1009)
@@ -506,38 +506,38 @@ STAGE PLANS:
         Map 20 
             Map Operator Tree:
                 TableScan
-                  alias: web_returns
-                  Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: web_sales
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (wr_returned_date_sk is not null and 
wr_web_page_sk is not null) (type: boolean)
-                    Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: (ws_sold_date_sk is not null and ws_web_page_sk 
is not null) (type: boolean)
+                    Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: wr_returned_date_sk (type: int), 
wr_web_page_sk (type: int), wr_return_amt (type: decimal(7,2)), wr_net_loss 
(type: decimal(7,2))
+                      expressions: ws_sold_date_sk (type: int), ws_web_page_sk 
(type: int), ws_ext_sales_price (type: decimal(7,2)), ws_net_profit (type: 
decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2))
         Map 26 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: web_returns
+                  Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_sold_date_sk is not null and ws_web_page_sk 
is not null) (type: boolean)
-                    Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
+                    predicate: (wr_returned_date_sk is not null and 
wr_web_page_sk is not null) (type: boolean)
+                    Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_web_page_sk 
(type: int), ws_ext_sales_price (type: decimal(7,2)), ws_net_profit (type: 
decimal(7,2))
+                      expressions: wr_returned_date_sk (type: int), 
wr_web_page_sk (type: int), wr_return_amt (type: decimal(7,2)), wr_net_loss 
(type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2))
         Map 29 
             Map Operator Tree:
@@ -721,7 +721,7 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 15838314 Data size: 1457713633 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
@@ -731,18 +731,18 @@ STAGE PLANS:
                   outputColumnNames: _col2, _col3, _col6
                   input vertices:
                     1 Map 25
-                  Statistics: Num rows: 17422145 Data size: 1603485031 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col3)
                     keys: _col6 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 17422145 Data size: 1603485031 Basic 
stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 17422145 Data size: 1603485031 
Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: decimal(17,2)), _col2 
(type: decimal(17,2))
         Reducer 22 
             Reduce Operator Tree:
@@ -751,22 +751,22 @@ STAGE PLANS:
                 keys: KEY._col0 (type: int)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 8711072 Data size: 801742469 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 8711072 Data size: 801742469 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2)), _col2 (type: 
decimal(17,2))
         Reducer 23 
             Reduce Operator Tree:
               Join Operator
                 condition map:
-                     Right Outer Join 0 to 1
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                     Left Outer Join 0 to 1
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5
                 Statistics: Num rows: 95833780 Data size: 13030622681 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 'web channel' (type: string), _col3 (type: 
int), _col4 (type: decimal(17,2)), COALESCE(_col1,0) (type: decimal(17,2)), 
(_col5 - COALESCE(_col2,0)) (type: decimal(18,2))
+                  expressions: 'web channel' (type: string), _col0 (type: 
int), _col1 (type: decimal(17,2)), COALESCE(_col4,0) (type: decimal(17,2)), 
(_col2 - COALESCE(_col5,0)) (type: decimal(18,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 95833780 Data size: 13030622681 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -793,7 +793,7 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 15838314 Data size: 1457713633 Basic 
stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
@@ -803,18 +803,18 @@ STAGE PLANS:
                   outputColumnNames: _col2, _col3, _col6
                   input vertices:
                     1 Map 30
-                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 17422145 Data size: 1603485031 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col3)
                     keys: _col6 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 17422145 Data size: 1603485031 Basic 
stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 17422145 Data size: 1603485031 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: decimal(17,2)), _col2 
(type: decimal(17,2))
         Reducer 28 
             Reduce Operator Tree:
@@ -823,12 +823,12 @@ STAGE PLANS:
                 keys: KEY._col0 (type: int)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 8711072 Data size: 801742469 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 8711072 Data size: 801742469 Basic 
stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2)), _col2 (type: 
decimal(17,2))
         Reducer 3 
             Reduce Operator Tree:

Reply via email to