http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query85.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query85.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query85.q.out
index d60751c..c82dcf7 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query85.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query85.q.out
@@ -175,7 +175,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 13 
+        Map 15 
             Map Operator Tree:
                 TableScan
                   alias: reason
@@ -212,21 +212,21 @@ STAGE PLANS:
                       Statistics: Num rows: 4602 Data size: 2696178 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col10 (type: int)
-                          1 _col0 (type: int)
+                          0 _col0 (type: int)
+                          1 _col2 (type: int)
             Local Work:
               Map Reduce Local Work
 
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 28), Map 9 (PARTITION-LEVEL 
SORT, 28)
-        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 98), Reducer 2 
(PARTITION-LEVEL SORT, 98)
-        Reducer 4 <- Map 12 (PARTITION-LEVEL SORT, 5), Reducer 3 
(PARTITION-LEVEL SORT, 5)
-        Reducer 5 <- Map 14 (PARTITION-LEVEL SORT, 11), Reducer 4 
(PARTITION-LEVEL SORT, 11)
-        Reducer 6 <- Map 15 (PARTITION-LEVEL SORT, 7), Reducer 5 
(PARTITION-LEVEL SORT, 7)
-        Reducer 7 <- Reducer 6 (GROUP, 7)
-        Reducer 8 <- Reducer 7 (SORT, 1)
+        Reducer 13 <- Map 12 (PARTITION-LEVEL SORT, 20), Map 14 
(PARTITION-LEVEL SORT, 20)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 90), Map 8 (PARTITION-LEVEL 
SORT, 90)
+        Reducer 3 <- Map 9 (PARTITION-LEVEL SORT, 17), Reducer 2 
(PARTITION-LEVEL SORT, 17)
+        Reducer 4 <- Map 10 (PARTITION-LEVEL SORT, 19), Reducer 3 
(PARTITION-LEVEL SORT, 19)
+        Reducer 5 <- Reducer 13 (PARTITION-LEVEL SORT, 35), Reducer 4 
(PARTITION-LEVEL SORT, 35)
+        Reducer 6 <- Reducer 5 (GROUP, 2)
+        Reducer 7 <- Reducer 6 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -242,32 +242,61 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
                       Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: int), _col5 (type: int)
-                        sort order: ++
-                        Map-reduce partition columns: _col0 (type: int), _col5 
(type: int)
+                        key expressions: _col2 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col2 (type: int)
                         Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: int), _col6 (type: decimal(7,2)), _col7 
(type: decimal(7,2))
+                        value expressions: _col0 (type: int), _col1 (type: 
int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: 
decimal(7,2)), _col7 (type: decimal(7,2))
         Map 10 
             Map Operator Tree:
                 TableScan
-                  alias: customer_address
-                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: cd2
+                  Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((ca_country = 'United States') and (ca_state) 
IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is 
not null) (type: boolean)
-                    Statistics: Num rows: 10000000 Data size: 10148798821 
Basic stats: COMPLETE Column stats: NONE
+                    predicate: (((cd_education_status = '4 yr Degree') or 
(cd_education_status = 'Primary') or (cd_education_status = 'Advanced Degree')) 
and ((cd_marital_status = 'M') or (cd_marital_status = 'D') or 
(cd_marital_status = 'U')) and cd_demo_sk is not null and cd_education_status 
is not null and cd_marital_status is not null) (type: boolean)
+                    Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: 
string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 10000000 Data size: 10148798821 
Basic stats: COMPLETE Column stats: NONE
+                      expressions: cd_demo_sk (type: int), cd_marital_status 
(type: string), cd_education_status (type: string)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 1861800 Data size: 717186159 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: 10000000 Data size: 10148798821 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        key expressions: _col2 (type: string), _col0 (type: 
int), _col1 (type: string)
+                        sort order: +++
+                        Map-reduce partition columns: _col2 (type: string), 
_col0 (type: int), _col1 (type: string)
+                        Statistics: Num rows: 1861800 Data size: 717186159 
Basic stats: COMPLETE Column stats: NONE
         Map 12 
             Map Operator Tree:
                 TableScan
+                  alias: web_sales
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ws_net_profit BETWEEN 100 AND 200 or 
ws_net_profit BETWEEN 150 AND 300 or ws_net_profit BETWEEN 50 AND 250) and 
(ws_sales_price BETWEEN 100 AND 150 or ws_sales_price BETWEEN 50 AND 100 or 
ws_sales_price BETWEEN 150 AND 200) and ws_item_sk is not null and 
ws_order_number is not null and ws_sold_date_sk is not null and ws_web_page_sk 
is not null) (type: boolean)
+                    Statistics: Num rows: 16000296 Data size: 2175577518 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ws_sold_date_sk (type: int), ws_item_sk 
(type: int), ws_web_page_sk (type: int), ws_order_number (type: int), 
ws_quantity (type: int), ws_sales_price (type: decimal(7,2)), ws_net_profit 
(type: decimal(7,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
+                      Statistics: Num rows: 16000296 Data size: 2175577518 
Basic stats: COMPLETE Column stats: NONE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: int)
+                          1 _col2 (type: int)
+                        outputColumnNames: _col1, _col2, _col4, _col5, _col6, 
_col7
+                        input vertices:
+                          0 Map 11
+                        Statistics: Num rows: 17600325 Data size: 2393135321 
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: 17600325 Data size: 2393135321 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col2 (type: int), _col4 (type: 
int), _col5 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2))
+            Local Work:
+              Map Reduce Local Work
+        Map 14 
+            Map Operator Tree:
+                TableScan
                   alias: date_dim
                   Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
@@ -282,28 +311,28 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
-        Map 14 
+        Map 8 
             Map Operator Tree:
                 TableScan
-                  alias: cd1
-                  Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: customer_address
+                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (((cd_education_status = '4 yr Degree') or 
(cd_education_status = 'Primary') or (cd_education_status = 'Advanced Degree')) 
and ((cd_marital_status = 'M') or (cd_marital_status = 'D') or 
(cd_marital_status = 'U')) and cd_demo_sk is not null and cd_education_status 
is not null and cd_marital_status is not null) (type: boolean)
-                    Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: ((ca_country = 'United States') and (ca_state) 
IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is 
not null) (type: boolean)
+                    Statistics: Num rows: 10000000 Data size: 10148798821 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cd_demo_sk (type: int), cd_marital_status 
(type: string), cd_education_status (type: string)
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
+                      expressions: ca_address_sk (type: int), ca_state (type: 
string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 10000000 Data size: 10148798821 
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: 1861800 Data size: 717186159 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string), _col2 (type: 
string)
-        Map 15 
+                        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: cd2
+                  alias: cd1
                   Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: (((cd_education_status = '4 yr Degree') or 
(cd_education_status = 'Primary') or (cd_education_status = 'Advanced Degree')) 
and ((cd_marital_status = 'M') or (cd_marital_status = 'D') or 
(cd_marital_status = 'U')) and cd_demo_sk is not null and cd_education_status 
is not null and cd_marital_status is not null) (type: boolean)
@@ -313,173 +342,145 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 1861800 Data size: 717186159 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: int), _col1 (type: 
string), _col2 (type: string)
-                        sort order: +++
-                        Map-reduce partition columns: _col0 (type: int), _col1 
(type: string), _col2 (type: string)
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 1861800 Data size: 717186159 
Basic stats: COMPLETE Column stats: NONE
-        Map 9 
-            Map Operator Tree:
-                TableScan
-                  alias: web_sales
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: ((ws_net_profit BETWEEN 100 AND 200 or 
ws_net_profit BETWEEN 150 AND 300 or ws_net_profit BETWEEN 50 AND 250) and 
(ws_sales_price BETWEEN 100 AND 150 or ws_sales_price BETWEEN 50 AND 100 or 
ws_sales_price BETWEEN 150 AND 200) and ws_item_sk is not null and 
ws_order_number is not null and ws_sold_date_sk is not null and ws_web_page_sk 
is not null) (type: boolean)
-                    Statistics: Num rows: 16000296 Data size: 2175577518 Basic 
stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_item_sk 
(type: int), ws_web_page_sk (type: int), ws_order_number (type: int), 
ws_quantity (type: int), ws_sales_price (type: decimal(7,2)), ws_net_profit 
(type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
-                      Statistics: Num rows: 16000296 Data size: 2175577518 
Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        key expressions: _col1 (type: int), _col3 (type: int)
-                        sort order: ++
-                        Map-reduce partition columns: _col1 (type: int), _col3 
(type: int)
-                        Statistics: Num rows: 16000296 Data size: 2175577518 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: 
int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                        value expressions: _col1 (type: string), _col2 (type: 
string)
+        Reducer 13 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col2, _col4, _col5, _col6, _col7
+                Statistics: Num rows: 19360357 Data size: 2632448910 Basic 
stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col2 (type: int), _col4 (type: int), _col5 
(type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2))
+                  outputColumnNames: _col4, _col6, _col7, _col8, _col9
+                  Statistics: Num rows: 19360357 Data size: 2632448910 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col4 (type: int), _col6 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col4 (type: int), _col6 
(type: int)
+                    Statistics: Num rows: 19360357 Data size: 2632448910 Basic 
stats: COMPLETE Column stats: NONE
+                    value expressions: _col7 (type: int), _col8 (type: 
decimal(7,2)), _col9 (type: decimal(7,2))
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int), _col5 (type: int)
-                  1 _col1 (type: int), _col3 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col8, _col10, _col12, _col13, _col14
-                Statistics: Num rows: 17600325 Data size: 2393135321 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col2 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6, 
_col7, _col9
+                Statistics: Num rows: 15838314 Data size: 1457713633 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
-                  Statistics: Num rows: 17600325 Data size: 2393135321 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col3 (type: int), 
_col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), 
_col8 (type: int), _col10 (type: int), _col12 (type: int), _col13 (type: 
decimal(7,2)), _col14 (type: decimal(7,2))
+                  Map-reduce partition columns: _col1 (type: int)
+                  Statistics: Num rows: 15838314 Data size: 1457713633 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: int), _col3 (type: int), 
_col4 (type: int), _col5 (type: int), _col6 (type: decimal(7,2)), _col7 (type: 
decimal(7,2)), _col9 (type: string)
         Reducer 3 
-            Local Work:
-              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col2 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col6, _col7, _col8, 
_col10, _col12, _col13, _col14, _col16
-                Statistics: Num rows: 19360357 Data size: 2632448910 Basic 
stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (((_col16) IN ('KY', 'GA', 'NM') and _col14 
BETWEEN 100 AND 200) or ((_col16) IN ('MT', 'OR', 'IN') and _col14 BETWEEN 150 
AND 300) or ((_col16) IN ('WI', 'MO', 'WV') and _col14 BETWEEN 50 AND 250)) 
(type: boolean)
-                  Statistics: Num rows: 3226725 Data size: 438741326 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: _col1, _col3, _col4, _col6, _col7, 
_col8, _col12, _col13
-                    input vertices:
-                      1 Map 11
-                    Statistics: Num rows: 3549397 Data size: 482615469 Basic 
stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col8 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col8 (type: int)
-                      Statistics: Num rows: 3549397 Data size: 482615469 Basic 
stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int), _col3 (type: int), 
_col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), 
_col12 (type: int), _col13 (type: decimal(7,2))
+                outputColumnNames: _col0, _col3, _col4, _col5, _col6, _col7, 
_col9, _col12, _col13
+                Statistics: Num rows: 17422145 Data size: 1603485031 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col13 (type: string), _col3 (type: int), 
_col12 (type: string)
+                  sort order: +++
+                  Map-reduce partition columns: _col13 (type: string), _col3 
(type: int), _col12 (type: string)
+                  Statistics: Num rows: 17422145 Data size: 1603485031 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: int), _col4 (type: int), 
_col5 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), 
_col9 (type: string)
         Reducer 4 
-            Local Work:
-              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col8 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col6, _col7, _col12, 
_col13
-                Statistics: Num rows: 3904336 Data size: 530877027 Basic 
stats: COMPLETE Column stats: NONE
-                Map Join Operator
-                  condition map:
-                       Inner Join 0 to 1
-                  keys:
-                    0 _col4 (type: int)
-                    1 _col0 (type: int)
-                  outputColumnNames: _col1, _col3, _col6, _col7, _col12, 
_col13, _col22
-                  input vertices:
-                    1 Map 13
-                  Statistics: Num rows: 4294769 Data size: 583964742 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: 4294769 Data size: 583964742 Basic 
stats: COMPLETE Column stats: NONE
-                    value expressions: _col3 (type: int), _col6 (type: 
decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col13 (type: 
decimal(7,2)), _col22 (type: string)
+                  0 _col13 (type: string), _col3 (type: int), _col12 (type: 
string)
+                  1 _col2 (type: string), _col0 (type: int), _col1 (type: 
string)
+                outputColumnNames: _col0, _col4, _col5, _col6, _col7, _col9, 
_col12, _col13
+                Statistics: Num rows: 19164359 Data size: 1763833572 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col5 (type: int)
+                  sort order: ++
+                  Map-reduce partition columns: _col0 (type: int), _col5 
(type: int)
+                  Statistics: Num rows: 19164359 Data size: 1763833572 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col4 (type: int), _col6 (type: 
decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: string), _col12 (type: 
string), _col13 (type: string)
         Reducer 5 
+            Local Work:
+              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7, _col12, _col13, 
_col22, _col24, _col25
-                Statistics: Num rows: 4724246 Data size: 642361230 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: int), _col5 (type: int)
+                  1 _col4 (type: int), _col6 (type: int)
+                outputColumnNames: _col4, _col6, _col7, _col9, _col12, _col13, 
_col24, _col25, _col26
+                Statistics: Num rows: 21296393 Data size: 2895693863 Basic 
stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (((_col24 = 'D') and (_col25 = 'Primary') and 
_col13 BETWEEN 50 AND 100) or ((_col24 = 'M') and (_col25 = '4 yr Degree') and 
_col13 BETWEEN 100 AND 150) or ((_col24 = 'U') and (_col25 = 'Advanced Degree') 
and _col13 BETWEEN 150 AND 200)) (type: boolean)
-                  Statistics: Num rows: 393687 Data size: 53530079 Basic 
stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col3 (type: int), _col24 (type: string), 
_col25 (type: string)
-                    sort order: +++
-                    Map-reduce partition columns: _col3 (type: int), _col24 
(type: string), _col25 (type: string)
-                    Statistics: Num rows: 393687 Data size: 53530079 Basic 
stats: COMPLETE Column stats: NONE
-                    value expressions: _col6 (type: decimal(7,2)), _col7 
(type: decimal(7,2)), _col12 (type: int), _col22 (type: string)
+                  predicate: ((((_col12 = 'M') and (_col13 = '4 yr Degree') 
and _col25 BETWEEN 100 AND 150) or ((_col12 = 'D') and (_col13 = 'Primary') and 
_col25 BETWEEN 50 AND 100) or ((_col12 = 'U') and (_col13 = 'Advanced Degree') 
and _col25 BETWEEN 150 AND 200)) and (((_col9) IN ('KY', 'GA', 'NM') and _col26 
BETWEEN 100 AND 200) or ((_col9) IN ('MT', 'OR', 'IN') and _col26 BETWEEN 150 
AND 300) or ((_col9) IN ('WI', 'MO', 'WV') and _col26 BETWEEN 50 AND 250))) 
(type: boolean)
+                  Statistics: Num rows: 295782 Data size: 40217802 Basic 
stats: COMPLETE Column stats: NONE
+                  Map Join Operator
+                    condition map:
+                         Inner Join 0 to 1
+                    keys:
+                      0 _col4 (type: int)
+                      1 _col0 (type: int)
+                    outputColumnNames: _col6, _col7, _col24, _col28
+                    input vertices:
+                      1 Map 15
+                    Statistics: Num rows: 325360 Data size: 44239583 Basic 
stats: COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: sum(_col24), count(_col24), sum(_col7), 
count(_col7), sum(_col6), count(_col6)
+                      keys: _col28 (type: string)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
+                      Statistics: Num rows: 325360 Data size: 44239583 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 325360 Data size: 44239583 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: bigint), _col2 (type: 
bigint), _col3 (type: decimal(17,2)), _col4 (type: bigint), _col5 (type: 
decimal(17,2)), _col6 (type: bigint)
         Reducer 6 
             Reduce Operator Tree:
-              Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col3 (type: int), _col24 (type: string), _col25 (type: 
string)
-                  1 _col0 (type: int), _col1 (type: string), _col2 (type: 
string)
-                outputColumnNames: _col6, _col7, _col12, _col22
-                Statistics: Num rows: 2047980 Data size: 788904791 Basic 
stats: COMPLETE Column stats: NONE
-                Group By Operator
-                  aggregations: sum(_col12), count(_col12), sum(_col7), 
count(_col7), sum(_col6), count(_col6)
-                  keys: _col22 (type: string)
-                  mode: hash
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
-                  Statistics: Num rows: 2047980 Data size: 788904791 Basic 
stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 2047980 Data size: 788904791 Basic 
stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: bigint), _col2 (type: 
bigint), _col3 (type: decimal(17,2)), _col4 (type: bigint), _col5 (type: 
decimal(17,2)), _col6 (type: bigint)
-        Reducer 7 
-            Reduce Operator Tree:
               Group By Operator
                 aggregations: sum(VALUE._col0), count(VALUE._col1), 
sum(VALUE._col2), count(VALUE._col3), sum(VALUE._col4), count(VALUE._col5)
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
-                Statistics: Num rows: 1023990 Data size: 394452395 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 162680 Data size: 22119791 Basic stats: 
COMPLETE Column stats: NONE
                 Select Operator
                   expressions: (_col1 / _col2) (type: double), (_col3 / _col4) 
(type: decimal(37,22)), (_col5 / _col6) (type: decimal(37,22)), substr(_col0, 
1, 20) (type: string)
                   outputColumnNames: _col4, _col5, _col6, _col7
-                  Statistics: Num rows: 1023990 Data size: 394452395 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 162680 Data size: 22119791 Basic 
stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col7 (type: string), _col4 (type: 
double), _col5 (type: decimal(37,22)), _col6 (type: decimal(37,22))
                     sort order: ++++
-                    Statistics: Num rows: 1023990 Data size: 394452395 Basic 
stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 162680 Data size: 22119791 Basic 
stats: COMPLETE Column stats: NONE
                     TopN Hash Memory Usage: 0.1
-        Reducer 8 
+        Reducer 7 
             Reduce Operator Tree:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: string), 
KEY.reducesinkkey1 (type: double), KEY.reducesinkkey2 (type: decimal(37,22)), 
KEY.reducesinkkey3 (type: decimal(37,22))
                 outputColumnNames: _col0, _col1, _col2, _col3
-                Statistics: Num rows: 1023990 Data size: 394452395 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 162680 Data size: 22119791 Basic stats: 
COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
-                  Statistics: Num rows: 100 Data size: 38500 Basic stats: 
COMPLETE Column stats: NONE
+                  Statistics: Num rows: 100 Data size: 13500 Basic stats: 
COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 100 Data size: 38500 Basic stats: 
COMPLETE Column stats: NONE
+                    Statistics: Num rows: 100 Data size: 13500 Basic stats: 
COMPLETE Column stats: NONE
                     table:
                         input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query88.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query88.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query88.q.out
index be44719..f8f2b70 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query88.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query88.q.out
@@ -204,18 +204,18 @@ STAGE PLANS:
         Map 10 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -240,18 +240,18 @@ STAGE PLANS:
         Map 9 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -294,9 +294,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 14
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -304,7 +304,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 15
@@ -346,9 +346,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 19
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -356,7 +356,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 20
@@ -398,9 +398,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 24
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -408,7 +408,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 25
@@ -450,9 +450,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 29
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -460,7 +460,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 30
@@ -502,9 +502,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 34
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -512,7 +512,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 35
@@ -554,9 +554,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 39
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -564,7 +564,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 40
@@ -606,9 +606,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 9
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -616,7 +616,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 10
@@ -791,36 +791,36 @@ STAGE PLANS:
         Map 4 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -857,9 +857,9 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col1 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
-                          outputColumnNames: _col2
+                          outputColumnNames: _col1
                           input vertices:
                             1 Map 4
                           Statistics: Num rows: 696954748 Data size: 
61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -867,7 +867,7 @@ STAGE PLANS:
                             condition map:
                                  Inner Join 0 to 1
                             keys:
-                              0 _col2 (type: int)
+                              0 _col1 (type: int)
                               1 _col0 (type: int)
                             input vertices:
                               1 Map 5
@@ -957,36 +957,36 @@ STAGE PLANS:
         Map 14 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 15 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -1016,36 +1016,36 @@ STAGE PLANS:
         Map 19 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 20 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -1075,36 +1075,36 @@ STAGE PLANS:
         Map 24 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 25 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -1134,36 +1134,36 @@ STAGE PLANS:
         Map 29 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 30 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -1193,36 +1193,36 @@ STAGE PLANS:
         Map 34 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 35 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -1252,36 +1252,36 @@ STAGE PLANS:
         Map 39 
             Map Operator Tree:
                 TableScan
-                  alias: household_demographics
-                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int)
+                      expressions: s_store_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col1 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 40 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: household_demographics
+                  Statistics: Num rows: 7200 Data size: 770400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((s_store_name = 'ese') and s_store_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 852 Data size: 1628138 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: ((((hd_dep_count = 3) and (hd_vehicle_count <= 
5)) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) 
and (hd_vehicle_count <= 3))) and hd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 3600 Data size: 385200 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: hd_demo_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 852 Data size: 1628138 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3600 Data size: 385200 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query89.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query89.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query89.q.out
index c933fe1..815c55d 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query89.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query89.q.out
@@ -185,47 +185,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: string), _col6 (type: string), _col7 
(type: string), _col10 (type: int), _col12 (type: string), _col13 (type: string)
+                    keys: _col12 (type: string), _col13 (type: string), _col10 
(type: int), _col5 (type: string), _col6 (type: string), _col7 (type: string)
                     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: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: int), _col4 (type: string), _col5 
(type: string)
+                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 
(type: string)
                       sort order: ++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: int), _col4 (type: 
string), _col5 (type: string)
+                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: int), _col3 (type: string), _col4 (type: 
string), _col5 (type: string)
                       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: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: int), KEY._col4 (type: string), 
KEY._col5 (type: string)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: int), KEY._col3 (type: string), KEY._col4 (type: string), 
KEY._col5 (type: string)
                 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: _col2 (type: string), _col0 (type: string), 
_col4 (type: string), _col5 (type: string)
+                  key expressions: _col5 (type: string), _col3 (type: string), 
_col0 (type: string), _col1 (type: string)
                   sort order: ++++
-                  Map-reduce partition columns: _col2 (type: string), _col0 
(type: string), _col4 (type: string), _col5 (type: string)
+                  Map-reduce partition columns: _col5 (type: string), _col3 
(type: string), _col0 (type: string), _col1 (type: string)
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col3 (type: int), 
_col6 (type: decimal(17,2))
+                  value expressions: _col2 (type: int), _col4 (type: string), 
_col6 (type: decimal(17,2))
         Reducer 5 
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey1 (type: string), VALUE._col0 
(type: string), KEY.reducesinkkey0 (type: string), VALUE._col1 (type: int), 
KEY.reducesinkkey2 (type: string), KEY.reducesinkkey3 (type: string), 
VALUE._col2 (type: decimal(17,2))
+                expressions: KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), VALUE._col0 (type: int), KEY.reducesinkkey1 
(type: string), VALUE._col1 (type: string), KEY.reducesinkkey0 (type: string), 
VALUE._col2 (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: string, _col1: string, _col2: 
string, _col3: int, _col4: string, _col5: string, _col6: decimal(17,2)
+                        output shape: _col0: string, _col1: string, _col2: 
int, _col3: string, _col4: string, _col5: string, _col6: decimal(17,2)
                         type: WINDOWING
                       Windowing table definition
                         input alias: ptf_1
                         name: windowingtablefunction
-                        order by: _col2 ASC NULLS FIRST, _col0 ASC NULLS 
FIRST, _col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST
-                        partition by: _col2, _col0, _col4, _col5
+                        order by: _col5 ASC NULLS FIRST, _col3 ASC NULLS 
FIRST, _col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST
+                        partition by: _col5, _col3, _col0, _col1
                         raw input shape:
                         window functions:
                             window function definition
@@ -236,14 +236,14 @@ 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: string), _col1 (type: string), _col2 (type: string), _col3 (type: int), 
_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: int), _col3 (type: string), 
_col4 (type: string), _col5 (type: string), _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
                     Filter Operator
                       predicate: CASE WHEN ((avg_window_0 <> 0)) THEN 
(((abs((_col6 - 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: _col2 (type: string), _col1 (type: 
string), _col0 (type: string), _col4 (type: string), _col5 (type: string), 
_col3 (type: int), _col6 (type: decimal(17,2)), avg_window_0 (type: 
decimal(21,6)), (_col6 - avg_window_0) (type: decimal(22,6))
+                        expressions: _col5 (type: string), _col4 (type: 
string), _col3 (type: string), _col0 (type: string), _col1 (type: string), 
_col2 (type: int), _col6 (type: decimal(17,2)), avg_window_0 (type: 
decimal(21,6)), (_col6 - avg_window_0) (type: decimal(22,6))
                         outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8
                         Statistics: Num rows: 191662559 Data size: 16908526602 
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/query90.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query90.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query90.q.out
index 115a2cc..9978b10 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query90.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query90.q.out
@@ -56,18 +56,18 @@ STAGE PLANS:
         Map 10 
             Map Operator Tree:
                 TableScan
-                  alias: time_dim
-                  Statistics: Num rows: 86400 Data size: 40694400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: web_page
+                  Statistics: Num rows: 4602 Data size: 2696178 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (t_hour BETWEEN 14 AND 15 and t_time_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 9600 Data size: 4521600 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: (wp_char_count BETWEEN 5000 AND 5200 and 
wp_web_page_sk is not null) (type: boolean)
+                    Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: t_time_sk (type: int)
+                      expressions: wp_web_page_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 9600 Data size: 4521600 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col0 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -92,18 +92,18 @@ STAGE PLANS:
         Map 9 
             Map Operator Tree:
                 TableScan
-                  alias: web_page
-                  Statistics: Num rows: 4602 Data size: 2696178 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: time_dim
+                  Statistics: Num rows: 86400 Data size: 40694400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (wp_char_count BETWEEN 5000 AND 5200 and 
wp_web_page_sk is not null) (type: boolean)
-                    Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: (t_hour BETWEEN 14 AND 15 and t_time_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 9600 Data size: 4521600 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: wp_web_page_sk (type: int)
+                      expressions: t_time_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
+                      Statistics: Num rows: 9600 Data size: 4521600 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col0 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -130,9 +130,9 @@ STAGE PLANS:
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 _col2 (type: int)
+                          0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col1, _col2
                         input vertices:
                           1 Map 9
                         Statistics: Num rows: 158402938 Data size: 21538218500 
Basic stats: COMPLETE Column stats: NONE
@@ -140,7 +140,7 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col0 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
                           outputColumnNames: _col1
                           input vertices:
@@ -187,36 +187,36 @@ STAGE PLANS:
         Map 4 
             Map Operator Tree:
                 TableScan
-                  alias: web_page
-                  Statistics: Num rows: 4602 Data size: 2696178 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: time_dim
+                  Statistics: Num rows: 86400 Data size: 40694400 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (wp_char_count BETWEEN 5000 AND 5200 and 
wp_web_page_sk is not null) (type: boolean)
-                    Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: (t_hour BETWEEN 6 AND 7 and t_time_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 9600 Data size: 4521600 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: wp_web_page_sk (type: int)
+                      expressions: t_time_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
+                      Statistics: Num rows: 9600 Data size: 4521600 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col0 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
         Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: time_dim
-                  Statistics: Num rows: 86400 Data size: 40694400 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: web_page
+                  Statistics: Num rows: 4602 Data size: 2696178 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (t_hour BETWEEN 6 AND 7 and t_time_sk is not 
null) (type: boolean)
-                    Statistics: Num rows: 9600 Data size: 4521600 Basic stats: 
COMPLETE Column stats: NONE
+                    predicate: (wp_char_count BETWEEN 5000 AND 5200 and 
wp_web_page_sk is not null) (type: boolean)
+                    Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: t_time_sk (type: int)
+                      expressions: wp_web_page_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 9600 Data size: 4521600 Basic 
stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 511 Data size: 299380 Basic stats: 
COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col0 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Local Work:
               Map Reduce Local Work
@@ -262,9 +262,9 @@ STAGE PLANS:
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 _col2 (type: int)
+                          0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col1, _col2
                         input vertices:
                           1 Map 4
                         Statistics: Num rows: 158402938 Data size: 21538218500 
Basic stats: COMPLETE Column stats: NONE
@@ -272,7 +272,7 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 _col0 (type: int)
+                            0 _col2 (type: int)
                             1 _col0 (type: int)
                           outputColumnNames: _col1
                           input vertices:

http://git-wip-us.apache.org/repos/asf/hive/blob/328d3f93/ql/src/test/results/clientpositive/perf/spark/query91.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query91.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query91.q.out
index b4f0650..0ad330f 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query91.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query91.q.out
@@ -234,14 +234,14 @@ STAGE PLANS:
                   Statistics: Num rows: 106480005 Data size: 91574956652 Basic 
stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col5 (type: string), 
_col6 (type: string)
-                    outputColumnNames: _col2, _col7, _col8
+                    outputColumnNames: _col4, _col9, _col10
                     Statistics: Num rows: 106480005 Data size: 91574956652 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col2 (type: int)
+                      key expressions: _col4 (type: int)
                       sort order: +
-                      Map-reduce partition columns: _col2 (type: int)
+                      Map-reduce partition columns: _col4 (type: int)
                       Statistics: Num rows: 106480005 Data size: 91574956652 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: string), _col8 (type: 
string)
+                      value expressions: _col9 (type: string), _col10 (type: 
string)
         Reducer 2 
             Local Work:
               Map Reduce Local Work
@@ -277,12 +277,12 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col1 (type: int)
-                  1 _col2 (type: int)
-                outputColumnNames: _col3, _col8, _col9, _col10, _col18, _col19
+                  1 _col4 (type: int)
+                outputColumnNames: _col3, _col8, _col9, _col10, _col20, _col21
                 Statistics: Num rows: 117128008 Data size: 100732454500 Basic 
stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col3)
-                  keys: _col8 (type: string), _col9 (type: string), _col10 
(type: string), _col18 (type: string), _col19 (type: string)
+                  keys: _col8 (type: string), _col9 (type: string), _col10 
(type: string), _col20 (type: string), _col21 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 117128008 Data size: 100732454500 
Basic stats: COMPLETE Column stats: NONE

Reply via email to