http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query4.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query4.q.out
index 67e8b4f..93e83ef 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query4.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query4.q.out
@@ -237,13 +237,13 @@ STAGE PLANS:
         Reducer 10 <- Map 13 (PARTITION-LEVEL SORT, 398), Map 9 
(PARTITION-LEVEL SORT, 398)
         Reducer 11 <- Map 14 (PARTITION-LEVEL SORT, 975), Reducer 10 
(PARTITION-LEVEL SORT, 975)
         Reducer 12 <- Reducer 11 (GROUP, 481)
-        Reducer 16 <- Map 15 (PARTITION-LEVEL SORT, 306), Map 19 
(PARTITION-LEVEL SORT, 306)
-        Reducer 17 <- Map 20 (PARTITION-LEVEL SORT, 873), Reducer 16 
(PARTITION-LEVEL SORT, 873)
-        Reducer 18 <- Reducer 17 (GROUP, 369)
+        Reducer 16 <- Map 15 (PARTITION-LEVEL SORT, 154), Map 19 
(PARTITION-LEVEL SORT, 154)
+        Reducer 17 <- Map 20 (PARTITION-LEVEL SORT, 706), Reducer 16 
(PARTITION-LEVEL SORT, 706)
+        Reducer 18 <- Reducer 17 (GROUP, 186)
         Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 154), Map 7 (PARTITION-LEVEL 
SORT, 154)
-        Reducer 22 <- Map 21 (PARTITION-LEVEL SORT, 154), Map 25 
(PARTITION-LEVEL SORT, 154)
-        Reducer 23 <- Map 26 (PARTITION-LEVEL SORT, 706), Reducer 22 
(PARTITION-LEVEL SORT, 706)
-        Reducer 24 <- Reducer 23 (GROUP, 186)
+        Reducer 22 <- Map 21 (PARTITION-LEVEL SORT, 306), Map 25 
(PARTITION-LEVEL SORT, 306)
+        Reducer 23 <- Map 26 (PARTITION-LEVEL SORT, 873), Reducer 22 
(PARTITION-LEVEL SORT, 873)
+        Reducer 24 <- Reducer 23 (GROUP, 369)
         Reducer 28 <- Map 27 (PARTITION-LEVEL SORT, 306), Map 31 
(PARTITION-LEVEL SORT, 306)
         Reducer 29 <- Map 32 (PARTITION-LEVEL SORT, 873), Reducer 28 
(PARTITION-LEVEL SORT, 873)
         Reducer 3 <- Map 8 (PARTITION-LEVEL SORT, 706), Reducer 2 
(PARTITION-LEVEL SORT, 706)
@@ -266,16 +266,15 @@ STAGE PLANS:
                     predicate: (ws_bill_customer_sk is not null and 
ws_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), 
ws_bill_customer_sk (type: int), ws_ext_discount_amt (type: decimal(7,2)), 
ws_ext_sales_price (type: decimal(7,2)), ws_ext_wholesale_cost (type: 
decimal(7,2)), ws_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
+                      expressions: ws_sold_date_sk (type: int), 
ws_bill_customer_sk (type: int), ((((ws_ext_list_price - ws_ext_wholesale_cost) 
- ws_ext_discount_amt) + ws_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: 
decimal(14,6))
         Map 13 
             Map Operator Tree:
                 TableScan
@@ -318,23 +317,22 @@ STAGE PLANS:
         Map 15 
             Map Operator Tree:
                 TableScan
-                  alias: catalog_sales
-                  filterExpr: (cs_bill_customer_sk is not null and 
cs_sold_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: web_sales
+                  filterExpr: (ws_bill_customer_sk is not null and 
ws_sold_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (cs_bill_customer_sk is not null and 
cs_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ws_bill_customer_sk is not null and 
ws_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), 
cs_bill_customer_sk (type: int), cs_ext_discount_amt (type: decimal(7,2)), 
cs_ext_sales_price (type: decimal(7,2)), cs_ext_wholesale_cost (type: 
decimal(7,2)), cs_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
-                      Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
+                      expressions: ws_sold_date_sk (type: int), 
ws_bill_customer_sk (type: int), ((((ws_ext_list_price - ws_ext_wholesale_cost) 
- ws_ext_discount_amt) + ws_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(type: decimal(7,2))
-            Execution mode: vectorized
+                        Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
decimal(14,6))
         Map 19 
             Map Operator Tree:
                 TableScan
@@ -377,23 +375,22 @@ STAGE PLANS:
         Map 21 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  filterExpr: (ws_bill_customer_sk is not null and 
ws_sold_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: catalog_sales
+                  filterExpr: (cs_bill_customer_sk is not null and 
cs_sold_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_bill_customer_sk is not null and 
ws_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
+                    predicate: (cs_bill_customer_sk is not null and 
cs_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), 
ws_bill_customer_sk (type: int), ws_ext_discount_amt (type: decimal(7,2)), 
ws_ext_sales_price (type: decimal(7,2)), ws_ext_wholesale_cost (type: 
decimal(7,2)), ws_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
-                      Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
+                      expressions: cs_sold_date_sk (type: int), 
cs_bill_customer_sk (type: int), ((((cs_ext_list_price - cs_ext_wholesale_cost) 
- cs_ext_discount_amt) + cs_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 144002668 Data size: 19580198212 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(type: decimal(7,2))
-            Execution mode: vectorized
+                        Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
decimal(14,6))
         Map 25 
             Map Operator Tree:
                 TableScan
@@ -443,16 +440,15 @@ STAGE PLANS:
                     predicate: (cs_bill_customer_sk is not null and 
cs_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), 
cs_bill_customer_sk (type: int), cs_ext_discount_amt (type: decimal(7,2)), 
cs_ext_sales_price (type: decimal(7,2)), cs_ext_wholesale_cost (type: 
decimal(7,2)), cs_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
+                      expressions: cs_sold_date_sk (type: int), 
cs_bill_customer_sk (type: int), ((((cs_ext_list_price - cs_ext_wholesale_cost) 
- cs_ext_discount_amt) + cs_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 287989836 Data size: 38999608952 
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: 287989836 Data size: 38999608952 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: 
decimal(14,6))
         Map 31 
             Map Operator Tree:
                 TableScan
@@ -502,16 +498,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk 
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_customer_sk 
(type: int), ss_ext_discount_amt (type: decimal(7,2)), ss_ext_sales_price 
(type: decimal(7,2)), ss_ext_wholesale_cost (type: decimal(7,2)), 
ss_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk 
(type: int), ((((ss_ext_list_price - ss_ext_wholesale_cost) - 
ss_ext_discount_amt) + ss_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 
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: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: 
decimal(14,6))
         Map 37 
             Map Operator Tree:
                 TableScan
@@ -600,16 +595,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk 
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_customer_sk 
(type: int), ss_ext_discount_amt (type: decimal(7,2)), ss_ext_sales_price 
(type: decimal(7,2)), ss_ext_wholesale_cost (type: decimal(7,2)), 
ss_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk 
(type: int), ((((ss_ext_list_price - ss_ext_wholesale_cost) - 
ss_ext_discount_amt) + ss_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 
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: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 
(type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: 
decimal(14,6))
         Reducer 10 
             Reduce Operator Tree:
               Join Operator
@@ -618,14 +612,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 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: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 11 
             Reduce Operator Tree:
               Join Operator
@@ -634,24 +628,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, 
_col10, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 
(type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 
2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 
(type: string), _col8 (type: string), _col9 (type: string), _col10 (type: 
string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 
Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 12 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -686,14 +676,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col2
+                Statistics: Num rows: 158402938 Data size: 21538218500 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: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 17 
             Reduce Operator Tree:
               Join Operator
@@ -702,24 +692,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15
-                Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 
(type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 
2) (type: decimal(14,6))
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, 
_col10, _col11
+                Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 
(type: string), _col8 (type: string), _col9 (type: string), _col10 (type: 
string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
-                  Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
-                    Statistics: Num rows: 348467716 Data size: 47189528877 
Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 348467716 Data size: 47189528877 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
+                    Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 18 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -728,24 +714,24 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: string), 
KEY._col5 (type: string), KEY._col6 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
-                Statistics: Num rows: 174233858 Data size: 23594764438 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: string), _col7 (type: 
decimal(24,6))
                   outputColumnNames: _col0, _col7
-                  Statistics: Num rows: 174233858 Data size: 23594764438 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: (_col7 > 0) (type: boolean)
-                    Statistics: Num rows: 58077952 Data size: 7864921389 Basic 
stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 29040539 Data size: 3948673454 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col7 (type: 
decimal(24,6))
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 58077952 Data size: 7864921389 
Basic stats: COMPLETE Column stats: NONE
+                      expressions: _col0 (type: string), _col7 (type: 
decimal(24,6)), _col7 is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 29040539 Data size: 3948673454 
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: 58077952 Data size: 7864921389 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(24,6))
+                        Statistics: Num rows: 29040539 Data size: 3948673454 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: decimal(24,6)), _col2 
(type: boolean)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -754,14 +740,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 158402938 Data size: 21538218500 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: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
@@ -770,14 +756,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col2
+                Statistics: Num rows: 316788826 Data size: 42899570777 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: 158402938 Data size: 21538218500 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 23 
             Reduce Operator Tree:
               Join Operator
@@ -786,24 +772,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15
-                Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 
(type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 
2) (type: decimal(14,6))
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, 
_col10, _col11
+                Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 
(type: string), _col8 (type: string), _col9 (type: string), _col10 (type: 
string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
-                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
-                    Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                  Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
+                    Statistics: Num rows: 348467716 Data size: 47189528877 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 24 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -812,24 +794,24 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: string), 
KEY._col5 (type: string), KEY._col6 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
-                Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 174233858 Data size: 23594764438 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: string), _col7 (type: 
decimal(24,6))
                   outputColumnNames: _col0, _col7
-                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 174233858 Data size: 23594764438 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: (_col7 > 0) (type: boolean)
-                    Statistics: Num rows: 29040539 Data size: 3948673454 Basic 
stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 58077952 Data size: 7864921389 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col7 (type: 
decimal(24,6))
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 29040539 Data size: 3948673454 
Basic stats: COMPLETE Column stats: NONE
+                      expressions: _col0 (type: string), _col7 (type: 
decimal(24,6)), _col7 is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 58077952 Data size: 7864921389 
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: 29040539 Data size: 3948673454 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(24,6))
+                        Statistics: Num rows: 58077952 Data size: 7864921389 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: decimal(24,6)), _col2 
(type: boolean)
         Reducer 28 
             Reduce Operator Tree:
               Join Operator
@@ -838,14 +820,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 316788826 Data size: 42899570777 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: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 29 
             Reduce Operator Tree:
               Join Operator
@@ -854,24 +836,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, 
_col10, _col11
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 
(type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 
2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 
(type: string), _col8 (type: string), _col9 (type: string), _col10 (type: 
string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 348467716 Data size: 47189528877 
Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 348467716 Data size: 47189528877 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -880,24 +858,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, 
_col10, _col11
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 
(type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 
2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 
(type: string), _col8 (type: string), _col9 (type: string), _col10 (type: 
string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic 
stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 30 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -925,14 +899,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 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: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: 
decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 35 
             Reduce Operator Tree:
               Join Operator
@@ -941,24 +915,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, 
_col10, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 
(type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 
2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 
(type: string), _col8 (type: string), _col9 (type: string), _col10 (type: 
string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string), _col5 (type: 
string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 
Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col4 (type: string), 
_col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: 
string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 36 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -1013,13 +983,13 @@ STAGE PLANS:
                   3 _col0 (type: string)
                   4 _col0 (type: string)
                   5 _col0 (type: string)
-                outputColumnNames: _col1, _col3, _col5, _col7, _col9, _col11, 
_col12
+                outputColumnNames: _col1, _col3, _col5, _col6, _col8, _col9, 
_col11, _col13, _col14
                 Statistics: Num rows: 1916625598 Data size: 169085266687 Basic 
stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (CASE WHEN (_col3 is not null) THEN (CASE WHEN 
(_col5 is not null) THEN (((_col9 / _col5) > (_col12 / _col3))) ELSE ((null > 
(_col12 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col9 / 
_col5) > null)) ELSE (null) END) END and CASE WHEN (_col7 is not null) THEN 
(CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > (_col1 / _col7))) ELSE 
((null > (_col1 / _col7))) END) ELSE (CASE WHEN (_col5 is not null) THEN 
(((_col9 / _col5) > null)) ELSE (null) END) END) (type: boolean)
+                  predicate: (CASE WHEN (_col3 is not null) THEN (CASE WHEN 
(_col9) THEN (((_col11 / _col8) > (_col14 / _col3))) ELSE ((null > (_col14 / 
_col3))) END) ELSE (CASE WHEN (_col9) THEN (((_col11 / _col8) > null)) ELSE 
(null) END) END and CASE WHEN (_col6) THEN (CASE WHEN (_col9) THEN (((_col11 / 
_col8) > (_col1 / _col5))) ELSE ((null > (_col1 / _col5))) END) ELSE (CASE WHEN 
(_col9) THEN (((_col11 / _col8) > null)) ELSE (null) END) END) (type: boolean)
                   Statistics: Num rows: 479156399 Data size: 42271316627 Basic 
stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col11 (type: string)
+                    expressions: _col13 (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 479156399 Data size: 42271316627 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query40.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query40.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query40.q.out
index 8508af5..1364cf1 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query40.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query40.q.out
@@ -110,8 +110,8 @@ STAGE PLANS:
                     predicate: (CAST( d_date AS TIMESTAMP) BETWEEN 
TIMESTAMP'1998-03-09 00:00:00' AND TIMESTAMP'1998-05-08 00:00:00' 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), d_date (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int), (CAST( d_date AS 
DATE) < DATE'1998-04-08') (type: boolean), (CAST( d_date AS DATE) >= 
DATE'1998-04-08') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 8116 Data size: 9081804 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -208,7 +208,7 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col2, _col4, _col7, _col9
+                  outputColumnNames: _col1, _col2, _col4, _col7, _col9, _col10
                   input vertices:
                     1 Map 7
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic 
stats: COMPLETE Column stats: NONE
@@ -217,7 +217,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 348467716 Data size: 47189528877 
Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: int), _col4 (type: 
decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: string)
+                    value expressions: _col1 (type: int), _col4 (type: 
decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: boolean), _col10 (type: 
boolean)
         Reducer 3 
             Local Work:
               Map Reduce Local Work
@@ -228,7 +228,7 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col4, _col7, _col9, _col11
+                outputColumnNames: _col1, _col4, _col7, _col9, _col10, _col12
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic 
stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -236,12 +236,12 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col4, _col7, _col9, _col11, _col14
+                  outputColumnNames: _col4, _col7, _col9, _col10, _col12, 
_col14
                   input vertices:
                     1 Map 9
                   Statistics: Num rows: 421645953 Data size: 57099332415 Basic 
stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col14 (type: string), _col11 (type: string), 
CASE WHEN ((CAST( _col9 AS DATE) < DATE'1998-04-08')) THEN ((_col4 - CASE WHEN 
(_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) END (type: 
decimal(13,2)), CASE WHEN ((CAST( _col9 AS DATE) >= DATE'1998-04-08')) THEN 
((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) 
END (type: decimal(13,2))
+                    expressions: _col14 (type: string), _col12 (type: string), 
CASE WHEN (_col9) THEN ((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) 
ELSE (0) END)) ELSE (0) END (type: decimal(13,2)), CASE WHEN (_col10) THEN 
((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) 
END (type: decimal(13,2))
                     outputColumnNames: _col0, _col1, _col2, _col3
                     Statistics: Num rows: 421645953 Data size: 57099332415 
Basic stats: COMPLETE Column stats: NONE
                     Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query42.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query42.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query42.q.out
index d6178e2..f4b4914 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query42.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query42.q.out
@@ -145,11 +145,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: int), _col8 (type: string)
+                  keys: _col5 (type: int), _col6 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query43.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query43.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query43.q.out
index f292196..6144454 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query43.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query43.q.out
@@ -111,15 +111,15 @@ STAGE PLANS:
                     predicate: ((d_year = 1998) and d_date_sk is not null) 
(type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_day_name (type: 
string)
-                      outputColumnNames: _col0, _col2
+                      expressions: d_date_sk (type: int), (d_day_name = 
'Sunday') (type: boolean), (d_day_name = 'Monday') (type: boolean), (d_day_name 
= 'Tuesday') (type: boolean), (d_day_name = 'Wednesday') (type: boolean), 
(d_day_name = 'Thursday') (type: boolean), (d_day_name = 'Friday') (type: 
boolean), (d_day_name = 'Saturday') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
                       Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: string)
+                        value expressions: _col1 (type: boolean), _col2 (type: 
boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), 
_col6 (type: boolean), _col7 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
             Local Work:
@@ -131,7 +131,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col5
+                outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col7, 
_col8, _col9, _col10
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -139,12 +139,12 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col5, _col7, _col8
+                  outputColumnNames: _col2, _col4, _col5, _col6, _col7, _col8, 
_col9, _col10, _col12, _col13
                   input vertices:
                     1 Map 6
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col8 (type: string), _col7 (type: string), 
CASE WHEN ((_col5 = 'Sunday')) THEN (_col2) ELSE (null) END (type: 
decimal(7,2)), CASE WHEN ((_col5 = 'Monday')) THEN (_col2) ELSE (null) END 
(type: decimal(7,2)), CASE WHEN ((_col5 = 'Tuesday')) THEN (_col2) ELSE (null) 
END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Wednesday')) THEN (_col2) ELSE 
(null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Thursday')) THEN (_col2) 
ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Friday')) THEN 
(_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Saturday')) 
THEN (_col2) ELSE (null) END (type: decimal(7,2))
+                    expressions: _col13 (type: string), _col12 (type: string), 
CASE WHEN (_col4) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN 
(_col5) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col6) 
THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col7) THEN 
(_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col8) THEN (_col2) 
ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col9) THEN (_col2) ELSE 
(null) END (type: decimal(7,2)), CASE WHEN (_col10) THEN (_col2) ELSE (null) 
END (type: decimal(7,2))
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8
                     Statistics: Num rows: 696954748 Data size: 61485550191 
Basic stats: COMPLETE Column stats: NONE
                     Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query46.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query46.q.out
index 5016067..3bb29c6 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query46.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query46.q.out
@@ -343,11 +343,11 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col17
+                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col12
                 Statistics: Num rows: 843315281 Data size: 74397518956 Basic 
stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col6), sum(_col7)
-                  keys: _col1 (type: int), _col17 (type: string), _col3 (type: 
int), _col5 (type: int)
+                  keys: _col1 (type: int), _col12 (type: string), _col3 (type: 
int), _col5 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic 
stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/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 f6a2e1b..020ee59 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query47.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query47.q.out
@@ -654,13 +654,13 @@ 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: _col1 (type: string), _col0 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), 
rank_window_0 (type: int)
+                      expressions: _col1 (type: string), _col0 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), 
(rank_window_0 - 1) (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
-                        key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), (_col5 - 1) (type: int)
+                        key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                         sort order: +++++
-                        Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 - 1) 
(type: int)
+                        Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: 
int)
                         Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col4 (type: decimal(17,2))
         Reducer 3 
@@ -744,13 +744,13 @@ 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: _col1 (type: string), _col0 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), 
rank_window_0 (type: int)
+                      expressions: _col1 (type: string), _col0 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), 
(rank_window_0 + 1) (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
-                        key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), (_col5 + 1) (type: int)
+                        key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                         sort order: +++++
-                        Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 + 1) 
(type: int)
+                        Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: 
int)
                         Statistics: Num rows: 383325119 Data size: 33817053293 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col4 (type: decimal(17,2))
         Reducer 6 
@@ -760,9 +760,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 1 to 2
                 keys:
-                  0 _col0 (type: string), _col1 (type: string), _col2 (type: 
string), _col3 (type: string), (_col5 + 1) (type: int)
+                  0 _col0 (type: string), _col1 (type: string), _col2 (type: 
string), _col3 (type: string), _col5 (type: int)
                   1 _col0 (type: string), _col1 (type: string), _col2 (type: 
string), _col3 (type: string), _col8 (type: int)
-                  2 _col0 (type: string), _col1 (type: string), _col2 (type: 
string), _col3 (type: string), (_col5 - 1) (type: int)
+                  2 _col0 (type: string), _col1 (type: string), _col2 (type: 
string), _col3 (type: string), _col5 (type: int)
                 outputColumnNames: _col4, _col6, _col10, _col11, _col12, 
_col13, _col19
                 Statistics: Num rows: 843315280 Data size: 74397518857 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/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 a775c7e..024d205 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query48.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query48.q.out
@@ -150,7 +150,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 1 
+        Map 8 
             Map Operator Tree:
                 TableScan
                   alias: store
@@ -165,8 +165,8 @@ STAGE PLANS:
                       Statistics: Num rows: 1704 Data size: 3256276 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col0 (type: int)
-                          1 _col3 (type: int)
+                          0 _col4 (type: int)
+                          1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -174,13 +174,32 @@ STAGE PLANS:
   Stage: Stage-1
     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, 218), Reducer 4 
(PARTITION-LEVEL SORT, 218)
-        Reducer 6 <- Reducer 5 (GROUP, 1)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 46), Map 6 (PARTITION-LEVEL 
SORT, 46)
+        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 49), Reducer 2 
(PARTITION-LEVEL SORT, 49)
+        Reducer 4 <- Map 9 (PARTITION-LEVEL SORT, 218), Reducer 3 
(PARTITION-LEVEL SORT, 218)
+        Reducer 5 <- Reducer 4 (GROUP, 1)
 #### A masked pattern was here ####
       Vertices:
-        Map 2 
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: customer_demographics
+                  filterExpr: ((cd_marital_status = 'M') and 
(cd_education_status = '4 yr Degree') and cd_demo_sk is not null) (type: 
boolean)
+                  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
+            Execution mode: vectorized
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: store_sales
@@ -190,28 +209,16 @@ STAGE PLANS:
                     predicate: ((ss_net_profit BETWEEN 0 AND 2000 or 
ss_net_profit BETWEEN 150 AND 3000 or ss_net_profit BETWEEN 50 AND 25000) and 
(ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or 
ss_sales_price BETWEEN 150 AND 200) and ss_addr_sk is not null and ss_cdemo_sk 
is not null and ss_sold_date_sk is not null and ss_store_sk is not null) (type: 
boolean)
                     Statistics: Num rows: 63999513 Data size: 5646055611 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_cdemo_sk 
(type: int), ss_addr_sk (type: int), ss_store_sk (type: int), ss_quantity 
(type: int), ss_net_profit (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col6
+                      expressions: ss_sold_date_sk (type: int), ss_cdemo_sk 
(type: int), ss_addr_sk (type: int), ss_store_sk (type: int), ss_quantity 
(type: int), ss_net_profit BETWEEN 0 AND 2000 (type: boolean), ss_net_profit 
BETWEEN 150 AND 3000 (type: boolean), ss_net_profit BETWEEN 50 AND 25000 (type: 
boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
                       Statistics: Num rows: 63999513 Data size: 5646055611 
Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 _col0 (type: int)
-                          1 _col3 (type: int)
-                        outputColumnNames: _col1, _col2, _col3, _col5, _col7
-                        input vertices:
-                          0 Map 1
-                        Statistics: Num rows: 70399465 Data size: 6210661306 
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: 70399465 Data size: 6210661306 
Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col2 (type: int), _col3 (type: 
int), _col5 (type: int), _col7 (type: decimal(7,2))
+                      Reduce Output Operator
+                        key expressions: _col1 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: int)
+                        Statistics: Num rows: 63999513 Data size: 5646055611 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: int), _col5 (type: boolean), _col6 (type: 
boolean), _col7 (type: boolean)
             Execution mode: vectorized
-            Local Work:
-              Map Reduce Local Work
         Map 7 
             Map Operator Tree:
                 TableScan
@@ -231,25 +238,6 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 8 
-            Map Operator Tree:
-                TableScan
-                  alias: customer_demographics
-                  filterExpr: ((cd_marital_status = 'M') and 
(cd_education_status = '4 yr Degree') and cd_demo_sk is not null) (type: 
boolean)
-                  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
-            Execution mode: vectorized
         Map 9 
             Map Operator Tree:
                 TableScan
@@ -260,49 +248,61 @@ STAGE PLANS:
                     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: 20000000 Data size: 20297597642 
Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: 
string)
-                      outputColumnNames: _col0, _col1
+                      expressions: ca_address_sk (type: int), (ca_state) IN 
('KY', 'GA', 'NM') (type: boolean), (ca_state) IN ('MT', 'OR', 'IN') (type: 
boolean), (ca_state) IN ('WI', 'MO', 'WV') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 20000000 Data size: 20297597642 
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: 20000000 Data size: 20297597642 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        value expressions: _col1 (type: boolean), _col2 (type: 
boolean), _col3 (type: boolean)
             Execution mode: vectorized
-        Reducer 3 
+        Reducer 2 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col5, _col7
-                Statistics: Num rows: 77439413 Data size: 6831727584 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: int)
+                  1 _col1 (type: int)
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, 
_col8
+                Statistics: Num rows: 70399465 Data size: 6210661306 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: 77439413 Data size: 6831727584 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col5 (type: int), 
_col7 (type: decimal(7,2))
-        Reducer 4 
+                  Map-reduce partition columns: _col1 (type: int)
+                  Statistics: Num rows: 70399465 Data size: 6210661306 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col3 (type: int), _col4 (type: int), 
_col5 (type: int), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: 
boolean)
+        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: _col3, _col5, _col7
-                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)
+                outputColumnNames: _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 77439413 Data size: 6831727584 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: _col3, _col5, _col6, _col7, _col8
+                  input vertices:
+                    1 Map 8
                   Statistics: Num rows: 85183356 Data size: 7514900505 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col5 (type: int), _col7 (type: 
decimal(7,2))
-        Reducer 5 
+                  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), _col6 (type: 
boolean), _col7 (type: boolean), _col8 (type: boolean)
+        Reducer 4 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -310,15 +310,15 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col5, _col7, _col14
+                outputColumnNames: _col5, _col6, _col7, _col8, _col12, _col13, 
_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: 31233897 Data size: 2755463519 Basic 
stats: COMPLETE Column stats: NONE
+                  predicate: ((_col12 and _col6) or (_col13 and _col7) or 
(_col14 and _col8)) (type: boolean)
+                  Statistics: Num rows: 70276269 Data size: 6199792984 Basic 
stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col5 (type: int)
                     outputColumnNames: _col5
-                    Statistics: Num rows: 31233897 Data size: 2755463519 Basic 
stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 70276269 Data size: 6199792984 Basic 
stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: sum(_col5)
                       mode: hash
@@ -328,7 +328,7 @@ STAGE PLANS:
                         sort order: 
                         Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: NONE
                         value expressions: _col0 (type: bigint)
-        Reducer 6 
+        Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator

Reply via email to