http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query47.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query47.q.out
index 5175f80..bc97fdf 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query47.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query47.q.out
@@ -397,47 +397,47 @@ STAGE PLANS:
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col5 (type: int), _col6 (type: int), _col8 (type: 
string), _col9 (type: string), _col11 (type: string), _col12 (type: string)
+                    keys: _col11 (type: string), _col12 (type: string), _col8 
(type: string), _col9 (type: string), _col5 (type: int), _col6 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
                     Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col0 (type: int), _col1 (type: int), 
_col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string)
+                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 
(type: int)
                       sort order: ++++++
-                      Map-reduce partition columns: _col0 (type: int), _col1 
(type: int), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string)
+                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
int), _col5 (type: int)
                       Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col6 (type: decimal(17,2))
         Reducer 14 
             Reduce Operator Tree:
               Group By Operator
                 aggregations: sum(VALUE._col0)
-                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 
(type: string), KEY._col3 (type: string), KEY._col4 (type: string), KEY._col5 
(type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: int), 
KEY._col5 (type: int)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col3 (type: string), _col2 (type: string), 
_col4 (type: string), _col5 (type: string), _col0 (type: int)
+                  key expressions: _col3 (type: string), _col2 (type: string), 
_col0 (type: string), _col1 (type: string), _col4 (type: int)
                   sort order: +++++
-                  Map-reduce partition columns: _col3 (type: string), _col2 
(type: string), _col4 (type: string), _col5 (type: string), _col0 (type: int)
+                  Map-reduce partition columns: _col3 (type: string), _col2 
(type: string), _col0 (type: string), _col1 (type: string), _col4 (type: int)
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col6 (type: 
decimal(17,2))
+                  value expressions: _col5 (type: int), _col6 (type: 
decimal(17,2))
         Reducer 15 
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey4 (type: int), VALUE._col0 
(type: int), KEY.reducesinkkey1 (type: string), KEY.reducesinkkey0 (type: 
string), KEY.reducesinkkey2 (type: string), KEY.reducesinkkey3 (type: string), 
VALUE._col1 (type: decimal(17,2))
+                expressions: KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), KEY.reducesinkkey1 (type: string), 
KEY.reducesinkkey0 (type: string), KEY.reducesinkkey4 (type: int), VALUE._col0 
(type: int), VALUE._col1 (type: decimal(17,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 PTF Operator
                   Function definitions:
                       Input definition
                         input alias: ptf_0
-                        output shape: _col0: int, _col1: int, _col2: string, 
_col3: string, _col4: string, _col5: string, _col6: decimal(17,2)
+                        output shape: _col0: string, _col1: string, _col2: 
string, _col3: string, _col4: int, _col5: int, _col6: decimal(17,2)
                         type: WINDOWING
                       Windowing table definition
                         input alias: ptf_1
                         name: windowingtablefunction
-                        order by: _col3 ASC NULLS FIRST, _col2 ASC NULLS 
FIRST, _col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST, _col0 ASC NULLS FIRST
-                        partition by: _col3, _col2, _col4, _col5, _col0
+                        order by: _col3 ASC NULLS FIRST, _col2 ASC NULLS 
FIRST, _col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST, _col4 ASC NULLS FIRST
+                        partition by: _col3, _col2, _col0, _col1, _col4
                         raw input shape:
                         window functions:
                             window function definition
@@ -448,54 +448,54 @@ STAGE PLANS:
                               window frame: ROWS PRECEDING(MAX)~FOLLOWING(MAX)
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: avg_window_0 (type: decimal(21,6)), _col0 
(type: int), _col1 (type: int), _col2 (type: string), _col3 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2))
+                    expressions: avg_window_0 (type: decimal(21,6)), _col0 
(type: string), _col1 (type: string), _col2 (type: string), _col3 (type: 
string), _col4 (type: int), _col5 (type: int), _col6 (type: decimal(17,2))
                     outputColumnNames: avg_window_0, _col0, _col1, _col2, 
_col3, _col4, _col5, _col6
                     Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col3 (type: string), _col2 (type: 
string), _col4 (type: string), _col5 (type: string), _col0 (type: int), _col1 
(type: int)
+                      key expressions: _col3 (type: string), _col2 (type: 
string), _col0 (type: string), _col1 (type: string), _col4 (type: int), _col5 
(type: int)
                       sort order: ++++++
-                      Map-reduce partition columns: _col3 (type: string), 
_col2 (type: string), _col4 (type: string), _col5 (type: string)
+                      Map-reduce partition columns: _col3 (type: string), 
_col2 (type: string), _col0 (type: string), _col1 (type: string)
                       Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: avg_window_0 (type: decimal(21,6)), 
_col6 (type: decimal(17,2))
         Reducer 16 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: decimal(21,6)), 
KEY.reducesinkkey4 (type: int), KEY.reducesinkkey5 (type: int), 
KEY.reducesinkkey1 (type: string), KEY.reducesinkkey0 (type: string), 
KEY.reducesinkkey2 (type: string), KEY.reducesinkkey3 (type: string), 
VALUE._col1 (type: decimal(17,2))
+                expressions: VALUE._col0 (type: decimal(21,6)), 
KEY.reducesinkkey2 (type: string), KEY.reducesinkkey3 (type: string), 
KEY.reducesinkkey1 (type: string), KEY.reducesinkkey0 (type: string), 
KEY.reducesinkkey4 (type: int), KEY.reducesinkkey5 (type: int), VALUE._col1 
(type: decimal(17,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 PTF Operator
                   Function definitions:
                       Input definition
                         input alias: ptf_0
-                        output shape: _col0: decimal(21,6), _col1: int, _col2: 
int, _col3: string, _col4: string, _col5: string, _col6: string, _col7: 
decimal(17,2)
+                        output shape: _col0: decimal(21,6), _col1: string, 
_col2: string, _col3: string, _col4: string, _col5: int, _col6: int, _col7: 
decimal(17,2)
                         type: WINDOWING
                       Windowing table definition
                         input alias: ptf_1
                         name: windowingtablefunction
-                        order by: _col1 ASC NULLS FIRST, _col2 ASC NULLS FIRST
-                        partition by: _col4, _col3, _col5, _col6
+                        order by: _col5 ASC NULLS FIRST, _col6 ASC NULLS FIRST
+                        partition by: _col4, _col3, _col1, _col2
                         raw input shape:
                         window functions:
                             window function definition
                               alias: rank_window_1
-                              arguments: _col1, _col2
+                              arguments: _col5, _col6
                               name: rank
                               window function: GenericUDAFRankEvaluator
                               window frame: ROWS PRECEDING(MAX)~FOLLOWING(MAX)
                               isPivotResult: true
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((_col0 > 0) and (_col1 = 2000) and 
rank_window_1 is not null) (type: boolean)
+                    predicate: ((_col0 > 0) and (_col5 = 2000) and 
rank_window_1 is not null) (type: boolean)
                     Statistics: Num rows: 63887519 Data size: 5636175475 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: rank_window_1 (type: int), _col0 (type: 
decimal(21,6)), _col1 (type: int), _col2 (type: int), _col3 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: 
decimal(17,2))
+                      expressions: rank_window_1 (type: int), _col0 (type: 
decimal(21,6)), _col1 (type: string), _col2 (type: string), _col3 (type: 
string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 
(type: decimal(17,2))
                       outputColumnNames: rank_window_1, _col0, _col1, _col2, 
_col3, _col4, _col5, _col6, _col7
                       Statistics: Num rows: 63887519 Data size: 5636175475 
Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
                         predicate: CASE WHEN ((_col0 > 0)) THEN (((abs((_col7 
- _col0)) / _col0) > 0.1)) ELSE (null) END (type: boolean)
                         Statistics: Num rows: 31943759 Data size: 2818087693 
Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col4 (type: string), _col3 (type: 
string), _col5 (type: string), _col6 (type: string), _col1 (type: int), _col2 
(type: int), _col7 (type: decimal(17,2)), _col0 (type: decimal(21,6)), 
rank_window_1 (type: int)
+                          expressions: _col4 (type: string), _col3 (type: 
string), _col1 (type: string), _col2 (type: string), _col5 (type: int), _col6 
(type: int), _col7 (type: decimal(17,2)), _col0 (type: decimal(21,6)), 
rank_window_1 (type: int)
                           outputColumnNames: _col0, _col1, _col2, _col3, 
_col4, _col5, _col6, _col7, _col8
                           Statistics: Num rows: 31943759 Data size: 2818087693 
Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -560,52 +560,52 @@ STAGE PLANS:
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col5 (type: int), _col6 (type: int), _col8 (type: 
string), _col9 (type: string), _col11 (type: string), _col12 (type: string)
+                    keys: _col11 (type: string), _col12 (type: string), _col8 
(type: string), _col9 (type: string), _col5 (type: int), _col6 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
                     Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col0 (type: int), _col1 (type: int), 
_col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string)
+                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 
(type: int)
                       sort order: ++++++
-                      Map-reduce partition columns: _col0 (type: int), _col1 
(type: int), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string)
+                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
int), _col5 (type: int)
                       Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col6 (type: decimal(17,2))
         Reducer 23 
             Reduce Operator Tree:
               Group By Operator
                 aggregations: sum(VALUE._col0)
-                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 
(type: string), KEY._col3 (type: string), KEY._col4 (type: string), KEY._col5 
(type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: int), 
KEY._col5 (type: int)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col3 (type: string), _col2 (type: string), 
_col4 (type: string), _col5 (type: string), _col0 (type: int), _col1 (type: int)
+                  key expressions: _col3 (type: string), _col2 (type: string), 
_col0 (type: string), _col1 (type: string), _col4 (type: int), _col5 (type: int)
                   sort order: ++++++
-                  Map-reduce partition columns: _col3 (type: string), _col2 
(type: string), _col4 (type: string), _col5 (type: string)
+                  Map-reduce partition columns: _col3 (type: string), _col2 
(type: string), _col0 (type: string), _col1 (type: string)
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                   value expressions: _col6 (type: decimal(17,2))
         Reducer 24 
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey4 (type: int), 
KEY.reducesinkkey5 (type: int), KEY.reducesinkkey1 (type: string), 
KEY.reducesinkkey0 (type: string), KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), VALUE._col0 (type: decimal(17,2))
+                expressions: KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), KEY.reducesinkkey1 (type: string), 
KEY.reducesinkkey0 (type: string), KEY.reducesinkkey4 (type: int), 
KEY.reducesinkkey5 (type: int), VALUE._col0 (type: decimal(17,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 PTF Operator
                   Function definitions:
                       Input definition
                         input alias: ptf_0
-                        output shape: _col0: int, _col1: int, _col2: string, 
_col3: string, _col4: string, _col5: string, _col6: decimal(17,2)
+                        output shape: _col0: string, _col1: string, _col2: 
string, _col3: string, _col4: int, _col5: int, _col6: decimal(17,2)
                         type: WINDOWING
                       Windowing table definition
                         input alias: ptf_1
                         name: windowingtablefunction
-                        order by: _col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST
-                        partition by: _col3, _col2, _col4, _col5
+                        order by: _col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST
+                        partition by: _col3, _col2, _col0, _col1
                         raw input shape:
                         window functions:
                             window function definition
                               alias: rank_window_0
-                              arguments: _col0, _col1
+                              arguments: _col4, _col5
                               name: rank
                               window function: GenericUDAFRankEvaluator
                               window frame: ROWS PRECEDING(MAX)~FOLLOWING(MAX)
@@ -615,7 +615,7 @@ STAGE PLANS:
                     predicate: rank_window_0 is not null (type: boolean)
                     Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col3 (type: string), _col2 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), 
rank_window_0 (type: int)
+                      expressions: _col3 (type: string), _col2 (type: string), 
_col0 (type: string), _col1 (type: string), _col6 (type: decimal(17,2)), 
rank_window_0 (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
                       Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -648,52 +648,52 @@ STAGE PLANS:
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col5 (type: int), _col6 (type: int), _col8 (type: 
string), _col9 (type: string), _col11 (type: string), _col12 (type: string)
+                    keys: _col11 (type: string), _col12 (type: string), _col8 
(type: string), _col9 (type: string), _col5 (type: int), _col6 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
                     Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col0 (type: int), _col1 (type: int), 
_col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string)
+                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 
(type: int)
                       sort order: ++++++
-                      Map-reduce partition columns: _col0 (type: int), _col1 
(type: int), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string)
+                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
int), _col5 (type: int)
                       Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col6 (type: decimal(17,2))
         Reducer 4 
             Reduce Operator Tree:
               Group By Operator
                 aggregations: sum(VALUE._col0)
-                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 
(type: string), KEY._col3 (type: string), KEY._col4 (type: string), KEY._col5 
(type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: int), 
KEY._col5 (type: int)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col3 (type: string), _col2 (type: string), 
_col4 (type: string), _col5 (type: string), _col0 (type: int), _col1 (type: int)
+                  key expressions: _col3 (type: string), _col2 (type: string), 
_col0 (type: string), _col1 (type: string), _col4 (type: int), _col5 (type: int)
                   sort order: ++++++
-                  Map-reduce partition columns: _col3 (type: string), _col2 
(type: string), _col4 (type: string), _col5 (type: string)
+                  Map-reduce partition columns: _col3 (type: string), _col2 
(type: string), _col0 (type: string), _col1 (type: string)
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                   value expressions: _col6 (type: decimal(17,2))
         Reducer 5 
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey4 (type: int), 
KEY.reducesinkkey5 (type: int), KEY.reducesinkkey1 (type: string), 
KEY.reducesinkkey0 (type: string), KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), VALUE._col0 (type: decimal(17,2))
+                expressions: KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), KEY.reducesinkkey1 (type: string), 
KEY.reducesinkkey0 (type: string), KEY.reducesinkkey4 (type: int), 
KEY.reducesinkkey5 (type: int), VALUE._col0 (type: decimal(17,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 PTF Operator
                   Function definitions:
                       Input definition
                         input alias: ptf_0
-                        output shape: _col0: int, _col1: int, _col2: string, 
_col3: string, _col4: string, _col5: string, _col6: decimal(17,2)
+                        output shape: _col0: string, _col1: string, _col2: 
string, _col3: string, _col4: int, _col5: int, _col6: decimal(17,2)
                         type: WINDOWING
                       Windowing table definition
                         input alias: ptf_1
                         name: windowingtablefunction
-                        order by: _col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST
-                        partition by: _col3, _col2, _col4, _col5
+                        order by: _col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST
+                        partition by: _col3, _col2, _col0, _col1
                         raw input shape:
                         window functions:
                             window function definition
                               alias: rank_window_0
-                              arguments: _col0, _col1
+                              arguments: _col4, _col5
                               name: rank
                               window function: GenericUDAFRankEvaluator
                               window frame: ROWS PRECEDING(MAX)~FOLLOWING(MAX)
@@ -703,7 +703,7 @@ STAGE PLANS:
                     predicate: rank_window_0 is not null (type: boolean)
                     Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col3 (type: string), _col2 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), 
rank_window_0 (type: int)
+                      expressions: _col3 (type: string), _col2 (type: string), 
_col0 (type: string), _col1 (type: string), _col6 (type: decimal(17,2)), 
rank_window_0 (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
                       Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query48.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query48.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query48.q.out
index a2b3663..505b178 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query48.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query48.q.out
@@ -161,8 +161,8 @@ STAGE PLANS:
     Spark
       Edges:
         Reducer 3 <- Map 2 (PARTITION-LEVEL SORT, 49), Map 7 (PARTITION-LEVEL 
SORT, 49)
-        Reducer 4 <- Map 8 (PARTITION-LEVEL SORT, 55), Reducer 3 
(PARTITION-LEVEL SORT, 55)
-        Reducer 5 <- Map 9 (PARTITION-LEVEL SORT, 138), Reducer 4 
(PARTITION-LEVEL SORT, 138)
+        Reducer 4 <- Map 8 (PARTITION-LEVEL SORT, 133), Reducer 3 
(PARTITION-LEVEL SORT, 133)
+        Reducer 5 <- Map 9 (PARTITION-LEVEL SORT, 12), Reducer 4 
(PARTITION-LEVEL SORT, 12)
         Reducer 6 <- Reducer 5 (GROUP, 1)
 #### A masked pattern was here ####
       Vertices:
@@ -216,23 +216,6 @@ STAGE PLANS:
         Map 8 
             Map Operator Tree:
                 TableScan
-                  alias: customer_demographics
-                  Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: ((cd_education_status = '4 yr Degree') and 
(cd_marital_status = 'M') and cd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 465450 Data size: 179296539 Basic 
stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: cd_demo_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 465450 Data size: 179296539 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: 465450 Data size: 179296539 
Basic stats: COMPLETE Column stats: NONE
-        Map 9 
-            Map Operator Tree:
-                TableScan
                   alias: customer_address
                   Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
@@ -248,6 +231,23 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 10000000 Data size: 10148798821 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: string)
+        Map 9 
+            Map Operator Tree:
+                TableScan
+                  alias: customer_demographics
+                  Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cd_education_status = '4 yr Degree') and 
(cd_marital_status = 'M') and cd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 465450 Data size: 179296539 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cd_demo_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 465450 Data size: 179296539 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: 465450 Data size: 179296539 
Basic stats: COMPLETE Column stats: NONE
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -259,53 +259,49 @@ STAGE PLANS:
                 outputColumnNames: _col2, _col3, _col5, _col7
                 Statistics: Num rows: 77439413 Data size: 6831727584 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col3 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
+                  Map-reduce partition columns: _col3 (type: int)
                   Statistics: Num rows: 77439413 Data size: 6831727584 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col5 (type: int), 
_col7 (type: decimal(7,2))
+                  value expressions: _col2 (type: int), _col5 (type: int), 
_col7 (type: decimal(7,2))
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col2 (type: int)
+                  0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col5, _col7
+                outputColumnNames: _col2, _col5, _col7, _col11
                 Statistics: Num rows: 85183356 Data size: 7514900505 Basic 
stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col3 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col3 (type: int)
-                  Statistics: Num rows: 85183356 Data size: 7514900505 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col5 (type: int), _col7 (type: 
decimal(7,2))
+                Filter Operator
+                  predicate: (((_col11) IN ('KY', 'GA', 'NM') and _col7 
BETWEEN 0 AND 2000) or ((_col11) IN ('MT', 'OR', 'IN') and _col7 BETWEEN 150 
AND 3000) or ((_col11) IN ('WI', 'MO', 'WV') and _col7 BETWEEN 50 AND 25000)) 
(type: boolean)
+                  Statistics: Num rows: 14197224 Data size: 1252483241 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col2 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col2 (type: int)
+                    Statistics: Num rows: 14197224 Data size: 1252483241 Basic 
stats: COMPLETE Column stats: NONE
+                    value expressions: _col5 (type: int)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col3 (type: int)
+                  0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col5, _col7, _col14
-                Statistics: Num rows: 93701693 Data size: 8266390734 Basic 
stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (((_col14) IN ('KY', 'GA', 'NM') and _col7 
BETWEEN 0 AND 2000) or ((_col14) IN ('MT', 'OR', 'IN') and _col7 BETWEEN 150 
AND 3000) or ((_col14) IN ('WI', 'MO', 'WV') and _col7 BETWEEN 50 AND 25000)) 
(type: boolean)
-                  Statistics: Num rows: 15616947 Data size: 1377731627 Basic 
stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    expressions: _col5 (type: int)
-                    outputColumnNames: _col5
-                    Statistics: Num rows: 15616947 Data size: 1377731627 Basic 
stats: COMPLETE Column stats: NONE
-                    Group By Operator
-                      aggregations: sum(_col5)
-                      mode: hash
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: bigint)
+                outputColumnNames: _col5
+                Statistics: Num rows: 15616946 Data size: 1377731594 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col5)
+                  mode: hash
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                    value expressions: _col0 (type: bigint)
         Reducer 6 
             Reduce Operator Tree:
               Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query5.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query5.q.out
index 90b45c1..a0b70a7 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query5.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query5.q.out
@@ -311,9 +311,9 @@ STAGE PLANS:
         Reducer 10 <- Map 13 (PARTITION-LEVEL SORT, 329), Map 14 
(PARTITION-LEVEL SORT, 329), Map 9 (PARTITION-LEVEL SORT, 329)
         Reducer 11 <- Map 15 (PARTITION-LEVEL SORT, 362), Reducer 10 
(PARTITION-LEVEL SORT, 362)
         Reducer 12 <- Reducer 11 (GROUP, 398)
-        Reducer 17 <- Map 14 (PARTITION-LEVEL SORT, 322), Map 16 
(PARTITION-LEVEL SORT, 322), Reducer 20 (PARTITION-LEVEL SORT, 322)
+        Reducer 17 <- Map 16 (PARTITION-LEVEL SORT, 322), Map 22 
(PARTITION-LEVEL SORT, 322), Reducer 20 (PARTITION-LEVEL SORT, 322)
         Reducer 18 <- Reducer 17 (GROUP, 389)
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 432), Map 6 (PARTITION-LEVEL 
SORT, 432), Map 7 (PARTITION-LEVEL SORT, 432)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 432), Map 14 
(PARTITION-LEVEL SORT, 432), Map 6 (PARTITION-LEVEL SORT, 432)
         Reducer 20 <- Map 19 (PARTITION-LEVEL SORT, 164), Map 21 
(PARTITION-LEVEL SORT, 164)
         Reducer 3 <- Reducer 2 (GROUP, 523)
         Reducer 4 <- Reducer 12 (GROUP, 1009), Reducer 18 (GROUP, 1009), 
Reducer 3 (GROUP, 1009)
@@ -445,6 +445,23 @@ STAGE PLANS:
                         Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
                         Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2))
+        Map 22 
+            Map Operator Tree:
+                TableScan
+                  alias: date_dim
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (CAST( d_date AS TIMESTAMP) BETWEEN 
TIMESTAMP'1998-08-04 00:00:00.0' AND TIMESTAMP'1998-08-18 00:00:00.0' and 
d_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 8116 Data size: 9081804 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 8116 Data size: 9081804 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: 8116 Data size: 9081804 Basic 
stats: COMPLETE Column stats: NONE
         Map 6 
             Map Operator Tree:
                 TableScan
@@ -463,23 +480,6 @@ STAGE PLANS:
                         Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 633586785 Data size: 55276696920 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(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: (CAST( d_date AS TIMESTAMP) BETWEEN 
TIMESTAMP'1998-08-04 00:00:00.0' AND TIMESTAMP'1998-08-18 00:00:00.0' and 
d_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 8116 Data size: 9081804 Basic stats: 
COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 8116 Data size: 9081804 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: 8116 Data size: 9081804 Basic 
stats: COMPLETE Column stats: NONE
         Map 9 
             Map Operator Tree:
                 TableScan

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query50.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query50.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query50.q.out
index fde0c4e..b978201 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query50.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query50.q.out
@@ -124,7 +124,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 10 
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: store
@@ -138,7 +138,7 @@ STAGE PLANS:
                       Statistics: Num rows: 1704 Data size: 3256276 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col10 (type: int)
+                          0 _col3 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -146,16 +146,63 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 36), Map 7 (PARTITION-LEVEL 
SORT, 36)
-        Reducer 3 <- Map 8 (PARTITION-LEVEL SORT, 436), Reducer 2 
(PARTITION-LEVEL SORT, 436)
-        Reducer 4 <- Map 9 (PARTITION-LEVEL SORT, 438), Reducer 3 
(PARTITION-LEVEL SORT, 438)
-        Reducer 5 <- Reducer 4 (GROUP, 529)
-        Reducer 6 <- Reducer 5 (SORT, 1)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 476), Reducer 8 
(PARTITION-LEVEL SORT, 476)
+        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 481), Reducer 2 
(PARTITION-LEVEL SORT, 481)
+        Reducer 4 <- Reducer 3 (GROUP, 529)
+        Reducer 5 <- Reducer 4 (SORT, 1)
+        Reducer 8 <- Map 7 (PARTITION-LEVEL SORT, 36), Map 9 (PARTITION-LEVEL 
SORT, 36)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (ss_customer_sk is not null and ss_item_sk is 
not null and ss_sold_date_sk is not null and ss_store_sk is not null and 
ss_ticket_number is not null) (type: boolean)
+                    Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_sold_date_sk (type: int), ss_item_sk 
(type: int), ss_customer_sk (type: int), ss_store_sk (type: int), 
ss_ticket_number (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col3 (type: int)
+                          1 _col0 (type: int)
+                        outputColumnNames: _col0, _col1, _col2, _col4, _col6, 
_col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15
+                        input vertices:
+                          1 Map 6
+                        Statistics: Num rows: 633595212 Data size: 55895953508 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col1 (type: int), _col2 (type: 
int), _col4 (type: int)
+                          sort order: +++
+                          Map-reduce partition columns: _col1 (type: int), 
_col2 (type: int), _col4 (type: int)
+                          Statistics: Num rows: 633595212 Data size: 
55895953508 Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col0 (type: int), _col6 (type: 
string), _col7 (type: int), _col8 (type: string), _col9 (type: string), _col10 
(type: string), _col11 (type: string), _col12 (type: string), _col13 (type: 
string), _col14 (type: string), _col15 (type: string)
+            Local Work:
+              Map Reduce Local Work
+        Map 10 
+            Map Operator Tree:
+                TableScan
+                  alias: d1
+                  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)
+                      outputColumnNames: _col0
+                      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
+        Map 7 
+            Map Operator Tree:
+                TableScan
                   alias: store_returns
                   Statistics: Num rows: 57591150 Data size: 4462194832 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
@@ -171,7 +218,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 57591150 Data size: 4462194832 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int)
-        Map 7 
+        Map 9 
             Map Operator Tree:
                 TableScan
                   alias: d2
@@ -188,113 +235,50 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 18262 Data size: 20435178 Basic 
stats: COMPLETE Column stats: NONE
-        Map 8 
-            Map Operator Tree:
-                TableScan
-                  alias: store_sales
-                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: (ss_customer_sk is not null and ss_item_sk is 
not null and ss_sold_date_sk is not null and ss_store_sk is not null and 
ss_ticket_number is not null) (type: boolean)
-                    Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_item_sk 
(type: int), ss_customer_sk (type: int), ss_store_sk (type: int), 
ss_ticket_number (type: int)
-                      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), _col2 (type: int), 
_col4 (type: int)
-                        sort order: +++
-                        Map-reduce partition columns: _col1 (type: int), _col2 
(type: int), _col4 (type: int)
-                        Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col3 (type: int)
-        Map 9 
-            Map Operator Tree:
-                TableScan
-                  alias: d1
-                  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)
-                      outputColumnNames: _col0
-                      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
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3
-                Statistics: Num rows: 63350266 Data size: 4908414421 Basic 
stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col1 (type: int), _col2 (type: int), _col3 
(type: int)
-                  sort order: +++
-                  Map-reduce partition columns: _col1 (type: int), _col2 
(type: int), _col3 (type: int)
-                  Statistics: Num rows: 63350266 Data size: 4908414421 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int)
-        Reducer 3 
-            Reduce Operator Tree:
-              Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col1 (type: int), _col2 (type: int), _col3 (type: int)
-                  1 _col1 (type: int), _col2 (type: int), _col4 (type: int)
-                outputColumnNames: _col0, _col7, _col10
-                Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col1 (type: int), _col2 (type: int), _col4 (type: int)
+                  1 _col1 (type: int), _col2 (type: int), _col3 (type: int)
+                outputColumnNames: _col0, _col6, _col7, _col8, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15, _col16
+                Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col7 (type: int)
+                  key expressions: _col0 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col7 (type: int)
-                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col10 (type: int)
-        Reducer 4 
-            Local Work:
-              Map Reduce Local Work
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col6 (type: string), _col7 (type: int), 
_col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 
(type: string), _col12 (type: string), _col13 (type: string), _col14 (type: 
string), _col15 (type: string), _col16 (type: int)
+        Reducer 3 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col7 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col7, _col10
-                Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                Map Join Operator
-                  condition map:
-                       Inner Join 0 to 1
-                  keys:
-                    0 _col10 (type: int)
-                    1 _col0 (type: int)
-                  outputColumnNames: _col0, _col7, _col14, _col15, _col16, 
_col17, _col18, _col19, _col20, _col21, _col22, _col23
-                  input vertices:
-                    1 Map 10
+                outputColumnNames: _col0, _col6, _col7, _col8, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15, _col16
+                Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col6 (type: string), _col7 (type: int), _col8 
(type: string), _col9 (type: string), _col10 (type: string), _col11 (type: 
string), _col12 (type: string), _col13 (type: string), _col14 (type: string), 
_col15 (type: string), CASE WHEN (((_col16 - _col0) <= 30)) THEN (1) ELSE (0) 
END (type: int), CASE WHEN ((((_col16 - _col0) > 30) and ((_col16 - _col0) <= 
60))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col16 - _col0) > 60) 
and ((_col16 - _col0) <= 90))) THEN (1) ELSE (0) END (type: int), CASE WHEN 
((((_col16 - _col0) > 90) and ((_col16 - _col0) <= 120))) THEN (1) ELSE (0) END 
(type: int), CASE WHEN (((_col16 - _col0) > 120)) THEN (1) ELSE (0) END (type: 
int)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    expressions: _col14 (type: string), _col15 (type: int), 
_col16 (type: string), _col17 (type: string), _col18 (type: string), _col19 
(type: string), _col20 (type: string), _col21 (type: string), _col22 (type: 
string), _col23 (type: string), CASE WHEN (((_col0 - _col7) <= 30)) THEN (1) 
ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col7) > 30) and ((_col0 - 
_col7) <= 60))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col7) 
> 60) and ((_col0 - _col7) <= 90))) THEN (1) ELSE (0) END (type: int), CASE 
WHEN ((((_col0 - _col7) > 90) and ((_col0 - _col7) <= 120))) THEN (1) ELSE (0) 
END (type: int), CASE WHEN (((_col0 - _col7) > 120)) THEN (1) ELSE (0) END 
(type: int)
+                  Group By Operator
+                    aggregations: sum(_col10), sum(_col11), sum(_col12), 
sum(_col13), sum(_col14)
+                    keys: _col0 (type: string), _col1 (type: int), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string), _col7 (type: string), _col8 (type: string), 
_col9 (type: string)
+                    mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                     Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
-                    Group By Operator
-                      aggregations: sum(_col10), sum(_col11), sum(_col12), 
sum(_col13), sum(_col14)
-                      keys: _col0 (type: string), _col1 (type: int), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string), _col7 (type: string), _col8 (type: string), 
_col9 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string), _col1 (type: 
int), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 
(type: string), _col6 (type: string), _col7 (type: string), _col8 (type: 
string), _col9 (type: string)
+                      sort order: ++++++++++
+                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: int), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string), _col7 (type: string), 
_col8 (type: string), _col9 (type: string)
                       Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string), _col1 (type: 
int), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 
(type: string), _col6 (type: string), _col7 (type: string), _col8 (type: 
string), _col9 (type: string)
-                        sort order: ++++++++++
-                        Map-reduce partition columns: _col0 (type: string), 
_col1 (type: int), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string), _col7 (type: string), 
_col8 (type: string), _col9 (type: string)
-                        Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
-                        TopN Hash Memory Usage: 0.1
-                        value expressions: _col10 (type: bigint), _col11 
(type: bigint), _col12 (type: bigint), _col13 (type: bigint), _col14 (type: 
bigint)
-        Reducer 5 
+                      TopN Hash Memory Usage: 0.1
+                      value expressions: _col10 (type: bigint), _col11 (type: 
bigint), _col12 (type: bigint), _col13 (type: bigint), _col14 (type: bigint)
+        Reducer 4 
             Reduce Operator Tree:
               Group By Operator
                 aggregations: sum(VALUE._col0), sum(VALUE._col1), 
sum(VALUE._col2), sum(VALUE._col3), sum(VALUE._col4)
@@ -308,7 +292,7 @@ STAGE PLANS:
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                   TopN Hash Memory Usage: 0.1
                   value expressions: _col10 (type: bigint), _col11 (type: 
bigint), _col12 (type: bigint), _col13 (type: bigint), _col14 (type: bigint)
-        Reducer 6 
+        Reducer 5 
             Reduce Operator Tree:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: string), 
KEY.reducesinkkey1 (type: int), KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), KEY.reducesinkkey4 (type: string), 
KEY.reducesinkkey5 (type: string), KEY.reducesinkkey6 (type: string), 
KEY.reducesinkkey7 (type: string), KEY.reducesinkkey8 (type: string), 
KEY.reducesinkkey9 (type: string), VALUE._col0 (type: bigint), VALUE._col1 
(type: bigint), VALUE._col2 (type: bigint), VALUE._col3 (type: bigint), 
VALUE._col4 (type: bigint)
@@ -324,6 +308,22 @@ STAGE PLANS:
                         input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                         serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 8 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 63350266 Data size: 4908414421 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col1 (type: int), _col2 (type: int), _col3 
(type: int)
+                  sort order: +++
+                  Map-reduce partition columns: _col1 (type: int), _col2 
(type: int), _col3 (type: int)
+                  Statistics: Num rows: 63350266 Data size: 4908414421 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: int)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query53.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query53.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query53.q.out
index 3bb21ef..3a1e948 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query53.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query53.q.out
@@ -62,7 +62,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 8 
+        Map 9 
             Map Operator Tree:
                 TableScan
                   alias: store
@@ -84,10 +84,11 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 399), Map 6 (PARTITION-LEVEL 
SORT, 399)
-        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 438), Reducer 2 
(PARTITION-LEVEL SORT, 438)
-        Reducer 4 <- Reducer 3 (GROUP PARTITION-LEVEL SORT, 529)
-        Reducer 5 <- Reducer 4 (SORT, 1)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 399), Map 7 (PARTITION-LEVEL 
SORT, 399)
+        Reducer 3 <- Map 8 (PARTITION-LEVEL SORT, 438), Reducer 2 
(PARTITION-LEVEL SORT, 438)
+        Reducer 4 <- Reducer 3 (GROUP, 529)
+        Reducer 5 <- Reducer 4 (PARTITION-LEVEL SORT, 265)
+        Reducer 6 <- Reducer 5 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -108,7 +109,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col1 (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: decimal(7,2))
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
                   alias: item
@@ -126,7 +127,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 115500 Data size: 165890114 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col4 (type: int)
-        Map 7 
+        Map 8 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
@@ -180,18 +181,18 @@ STAGE PLANS:
                     1 _col0 (type: int)
                   outputColumnNames: _col3, _col8, _col11
                   input vertices:
-                    1 Map 8
+                    1 Map 9
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col8 (type: int), _col11 (type: int)
+                    keys: _col11 (type: int), _col8 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int), _col1 (type: int)
                       sort order: ++
-                      Map-reduce partition columns: _col0 (type: int)
+                      Map-reduce partition columns: _col0 (type: int), _col1 
(type: int)
                       Statistics: Num rows: 766650239 Data size: 67634106676 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col2 (type: decimal(17,2))
         Reducer 4 
@@ -203,46 +204,58 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col2 (type: decimal(17,2))
-                  outputColumnNames: _col0, _col2
+                  expressions: _col1 (type: int), _col2 (type: decimal(17,2))
+                  outputColumnNames: _col1, _col2
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
-                  PTF Operator
-                    Function definitions:
-                        Input definition
-                          input alias: ptf_0
-                          output shape: _col0: int, _col2: decimal(17,2)
-                          type: WINDOWING
-                        Windowing table definition
-                          input alias: ptf_1
-                          name: windowingtablefunction
-                          order by: _col0 ASC NULLS FIRST
-                          partition by: _col0
-                          raw input shape:
-                          window functions:
-                              window function definition
-                                alias: avg_window_0
-                                arguments: _col2
-                                name: avg
-                                window function: 
GenericUDAFAverageEvaluatorDecimal
-                                window frame: ROWS 
PRECEDING(MAX)~FOLLOWING(MAX)
+                  Reduce Output Operator
+                    key expressions: _col1 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col1 (type: int)
                     Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: avg_window_0 (type: decimal(21,6)), _col0 
(type: int), _col2 (type: decimal(17,2))
-                      outputColumnNames: avg_window_0, _col0, _col2
-                      Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
-                      Filter Operator
-                        predicate: CASE WHEN ((avg_window_0 > 0)) THEN 
(((abs((_col2 - avg_window_0)) / avg_window_0) > 0.1)) ELSE (null) END (type: 
boolean)
+                    value expressions: _col2 (type: decimal(17,2))
+        Reducer 5 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), VALUE._col1 
(type: decimal(17,2))
+                outputColumnNames: _col1, _col2
+                Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
+                PTF Operator
+                  Function definitions:
+                      Input definition
+                        input alias: ptf_0
+                        output shape: _col1: int, _col2: decimal(17,2)
+                        type: WINDOWING
+                      Windowing table definition
+                        input alias: ptf_1
+                        name: windowingtablefunction
+                        order by: _col1 ASC NULLS FIRST
+                        partition by: _col1
+                        raw input shape:
+                        window functions:
+                            window function definition
+                              alias: avg_window_0
+                              arguments: _col2
+                              name: avg
+                              window function: 
GenericUDAFAverageEvaluatorDecimal
+                              window frame: ROWS PRECEDING(MAX)~FOLLOWING(MAX)
+                  Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: avg_window_0 (type: decimal(21,6)), _col1 
(type: int), _col2 (type: decimal(17,2))
+                    outputColumnNames: avg_window_0, _col1, _col2
+                    Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: CASE WHEN ((avg_window_0 > 0)) THEN 
(((abs((_col2 - avg_window_0)) / avg_window_0) > 0.1)) ELSE (null) END (type: 
boolean)
+                      Statistics: Num rows: 191662559 Data size: 16908526602 
Basic stats: COMPLETE Column stats: NONE
+                      Select Operator
+                        expressions: _col1 (type: int), _col2 (type: 
decimal(17,2)), avg_window_0 (type: decimal(21,6))
+                        outputColumnNames: _col0, _col1, _col2
                         Statistics: Num rows: 191662559 Data size: 16908526602 
Basic stats: COMPLETE Column stats: NONE
-                        Select Operator
-                          expressions: _col0 (type: int), _col2 (type: 
decimal(17,2)), avg_window_0 (type: decimal(21,6))
-                          outputColumnNames: _col0, _col1, _col2
+                        Reduce Output Operator
+                          key expressions: _col2 (type: decimal(21,6)), _col1 
(type: decimal(17,2)), _col0 (type: int)
+                          sort order: +++
                           Statistics: Num rows: 191662559 Data size: 
16908526602 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col2 (type: decimal(21,6)), 
_col1 (type: decimal(17,2)), _col0 (type: int)
-                            sort order: +++
-                            Statistics: Num rows: 191662559 Data size: 
16908526602 Basic stats: COMPLETE Column stats: NONE
-                            TopN Hash Memory Usage: 0.1
-        Reducer 5 
+                          TopN Hash Memory Usage: 0.1
+        Reducer 6 
             Reduce Operator Tree:
               Select Operator
                 expressions: KEY.reducesinkkey2 (type: int), 
KEY.reducesinkkey1 (type: decimal(17,2)), KEY.reducesinkkey0 (type: 
decimal(21,6))

Reply via email to