http://git-wip-us.apache.org/repos/asf/hive/blob/0f7163fa/ql/src/test/results/clientpositive/perf/spark/query54.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query54.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query54.q.out
index 241d6d8..a66ad45 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query54.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query54.q.out
@@ -1,7 +1,7 @@
-Warning: Shuffle Join JOIN[84][tables = [$hdt$_0, $hdt$_1, $hdt$_2, $hdt$_3, 
$hdt$_4]] in Work 'Reducer 4' is a cross product
-Warning: Shuffle Join JOIN[115][tables = [$hdt$_0, $hdt$_1]] in Work 'Reducer 
5' is a cross product
-Warning: Map Join MAPJOIN[145][bigTable=?] in task 'Stage-1:MAPRED' is a cross 
product
+Warning: Shuffle Join JOIN[83][tables = [$hdt$_1, $hdt$_2, $hdt$_3, $hdt$_0, 
$hdt$_4, $hdt$_5, $hdt$_6]] in Work 'Reducer 5' is a cross product
+Warning: Shuffle Join JOIN[114][tables = [$hdt$_0, $hdt$_1]] in Work 'Reducer 
6' is a cross product
 Warning: Map Join MAPJOIN[144][bigTable=?] in task 'Stage-1:MAPRED' is a cross 
product
+Warning: Map Join MAPJOIN[143][bigTable=?] in task 'Stage-1:MAPRED' is a cross 
product
 PREHOOK: query: explain
 with my_customers as (
  select distinct c_customer_sk
@@ -193,11 +193,11 @@ STAGE PLANS:
   Stage: Stage-3
     Spark
       Edges:
-        Reducer 23 <- Map 22 (GROUP, 2)
-        Reducer 24 <- Reducer 23 (GROUP, 1)
+        Reducer 22 <- Map 21 (GROUP, 2)
+        Reducer 23 <- Reducer 22 (GROUP, 1)
 #### A masked pattern was here ####
       Vertices:
-        Map 22 
+        Map 21 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
@@ -221,7 +221,7 @@ STAGE PLANS:
                           Map-reduce partition columns: _col0 (type: int)
                           Statistics: Num rows: 18262 Data size: 20435178 
Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Reducer 23 
+        Reducer 22 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
@@ -240,7 +240,7 @@ STAGE PLANS:
                       sort order: 
                       Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: NONE
                       value expressions: _col0 (type: bigint)
-        Reducer 24 
+        Reducer 23 
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -264,7 +264,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 12 
+        Map 10 
             Map Operator Tree:
                 TableScan
                   alias: store
@@ -288,45 +288,25 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 11 <- Map 10 (PARTITION-LEVEL SORT, 654), Reducer 17 
(PARTITION-LEVEL SORT, 654)
-        Reducer 14 <- Map 13 (PARTITION-LEVEL SORT, 458), Map 18 
(PARTITION-LEVEL SORT, 458), Map 19 (PARTITION-LEVEL SORT, 458)
-        Reducer 15 <- Map 20 (PARTITION-LEVEL SORT, 505), Reducer 14 
(PARTITION-LEVEL SORT, 505)
-        Reducer 16 <- Map 21 (PARTITION-LEVEL SORT, 1009), Reducer 15 
(PARTITION-LEVEL SORT, 1009)
-        Reducer 17 <- Reducer 16 (GROUP, 610)
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 398), Map 9 (PARTITION-LEVEL 
SORT, 398)
+        Reducer 12 <- Map 11 (PARTITION-LEVEL SORT, 458), Map 16 
(PARTITION-LEVEL SORT, 458), Map 17 (PARTITION-LEVEL SORT, 458)
+        Reducer 13 <- Map 18 (PARTITION-LEVEL SORT, 505), Reducer 12 
(PARTITION-LEVEL SORT, 505)
+        Reducer 14 <- Map 19 (PARTITION-LEVEL SORT, 1009), Reducer 13 
(PARTITION-LEVEL SORT, 1009)
+        Reducer 15 <- Reducer 14 (GROUP, 610)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 654), Reducer 15 
(PARTITION-LEVEL SORT, 654)
         Reducer 26 <- Map 25 (GROUP, 2)
-        Reducer 3 <- Reducer 11 (PARTITION-LEVEL SORT, 772), Reducer 2 
(PARTITION-LEVEL SORT, 772)
+        Reducer 3 <- Map 20 (PARTITION-LEVEL SORT, 733), Reducer 2 
(PARTITION-LEVEL SORT, 733)
         Reducer 31 <- Map 30 (GROUP, 2)
-        Reducer 4 <- Reducer 26 (PARTITION-LEVEL SORT, 1), Reducer 3 
(PARTITION-LEVEL SORT, 1)
-        Reducer 5 <- Reducer 31 (PARTITION-LEVEL SORT, 1), Reducer 4 
(PARTITION-LEVEL SORT, 1)
-        Reducer 6 <- Reducer 5 (GROUP, 1009)
+        Reducer 4 <- Map 24 (PARTITION-LEVEL SORT, 482), Reducer 3 
(PARTITION-LEVEL SORT, 482)
+        Reducer 5 <- Reducer 26 (PARTITION-LEVEL SORT, 1), Reducer 4 
(PARTITION-LEVEL SORT, 1)
+        Reducer 6 <- Reducer 31 (PARTITION-LEVEL SORT, 1), Reducer 5 
(PARTITION-LEVEL SORT, 1)
         Reducer 7 <- Reducer 6 (GROUP, 1009)
-        Reducer 8 <- Reducer 7 (SORT, 1)
+        Reducer 8 <- Reducer 7 (GROUP, 1009)
+        Reducer 9 <- Reducer 8 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: store_sales
-                  filterExpr: (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
-                  Filter Operator
-                    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_sales_price (type: decimal(7,2))
-                      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))
-            Execution mode: vectorized
-        Map 10 
-            Map Operator Tree:
-                TableScan
                   alias: customer_address
                   filterExpr: (ca_address_sk is not null and ca_county is not 
null and ca_state is not null) (type: boolean)
                   Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
@@ -345,7 +325,7 @@ STAGE PLANS:
                           1 _col0 (type: string), _col1 (type: string)
                         outputColumnNames: _col0
                         input vertices:
-                          1 Map 12
+                          1 Map 10
                         Statistics: Num rows: 44000000 Data size: 44654715780 
Basic stats: COMPLETE Column stats: NONE
                         Reduce Output Operator
                           key expressions: _col0 (type: int)
@@ -355,7 +335,7 @@ STAGE PLANS:
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
-        Map 13 
+        Map 11 
             Map Operator Tree:
                 TableScan
                   alias: catalog_sales
@@ -375,7 +355,7 @@ STAGE PLANS:
                         Statistics: Num rows: 431992504 Data size: 58579807164 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: int)
             Execution mode: vectorized
-        Map 18 
+        Map 16 
             Map Operator Tree:
                 TableScan
                   alias: web_sales
@@ -395,7 +375,7 @@ STAGE PLANS:
                         Statistics: Num rows: 431992504 Data size: 58579807164 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: int)
             Execution mode: vectorized
-        Map 19 
+        Map 17 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
@@ -414,7 +394,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 18262 Data size: 20435178 Basic 
stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 20 
+        Map 18 
             Map Operator Tree:
                 TableScan
                   alias: item
@@ -433,7 +413,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 115500 Data size: 165890114 
Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 21 
+        Map 19 
             Map Operator Tree:
                 TableScan
                   alias: customer
@@ -453,6 +433,46 @@ STAGE PLANS:
                         Statistics: Num rows: 80000000 Data size: 68801615852 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int)
             Execution mode: vectorized
+        Map 20 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  filterExpr: (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
+                  Filter Operator
+                    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_sales_price (type: decimal(7,2))
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 575995635 Data size: 50814502088 
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: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: int), _col2 (type: 
decimal(7,2))
+            Execution mode: vectorized
+        Map 24 
+            Map Operator Tree:
+                TableScan
+                  alias: date_dim
+                  filterExpr: d_date_sk is not null (type: boolean)
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: d_date_sk is not null (type: boolean)
+                    Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: d_date_sk (type: int), d_month_seq (type: 
int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int)
+            Execution mode: vectorized
         Map 25 
             Map Operator Tree:
                 TableScan
@@ -501,42 +521,7 @@ STAGE PLANS:
                           Map-reduce partition columns: _col0 (type: int)
                           Statistics: Num rows: 18262 Data size: 20435178 
Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 9 
-            Map Operator Tree:
-                TableScan
-                  alias: date_dim
-                  filterExpr: d_date_sk is not null (type: boolean)
-                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: d_date_sk is not null (type: boolean)
-                    Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: d_date_sk (type: int), d_month_seq (type: 
int)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int)
-            Execution mode: vectorized
-        Reducer 11 
-            Reduce Operator Tree:
-              Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col0 (type: int)
-                  1 _col1 (type: int)
-                outputColumnNames: _col5
-                Statistics: Num rows: 316240138 Data size: 42883351551 Basic 
stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col5 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col5 (type: int)
-                  Statistics: Num rows: 316240138 Data size: 42883351551 Basic 
stats: COMPLETE Column stats: NONE
-        Reducer 14 
+        Reducer 12 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -552,7 +537,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 475191764 Data size: 64437789277 Basic 
stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: int)
-        Reducer 15 
+        Reducer 13 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -567,7 +552,7 @@ STAGE PLANS:
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 522710951 Data size: 70881569741 Basic 
stats: COMPLETE Column stats: NONE
-        Reducer 16 
+        Reducer 14 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -587,7 +572,7 @@ STAGE PLANS:
                     sort order: ++
                     Map-reduce partition columns: _col0 (type: int), _col1 
(type: int)
                     Statistics: Num rows: 574982058 Data size: 77969728405 
Basic stats: COMPLETE Column stats: NONE
-        Reducer 17 
+        Reducer 15 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
@@ -612,15 +597,14 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4
-                Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
+                  1 _col1 (type: int)
+                outputColumnNames: _col5
+                Statistics: Num rows: 316240138 Data size: 42883351551 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: int)
+                  key expressions: _col5 (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)), _col4 (type: 
int)
+                  Map-reduce partition columns: _col5 (type: int)
+                  Statistics: Num rows: 316240138 Data size: 42883351551 Basic 
stats: COMPLETE Column stats: NONE
         Reducer 26 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -641,24 +625,26 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
-                  1 _col5 (type: int)
-                outputColumnNames: _col2, _col4, _col10
-                Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col5 (type: int)
+                  1 _col1 (type: int)
+                outputColumnNames: _col5, _col7, _col9
+                Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
                     0 
                     1 
-                  outputColumnNames: _col2, _col4, _col10
+                  outputColumnNames: _col5, _col7, _col9
                   input vertices:
-                    1 Reducer 24
-                  Statistics: Num rows: 696954748 Data size: 67758142923 Basic 
stats: COMPLETE Column stats: NONE
+                    1 Reducer 23
+                  Statistics: Num rows: 633595212 Data size: 61598310416 Basic 
stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    sort order: 
-                    Statistics: Num rows: 696954748 Data size: 67758142923 
Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col2 (type: decimal(7,2)), _col4 
(type: int), _col10 (type: int)
+                    key expressions: _col7 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col7 (type: int)
+                    Statistics: Num rows: 633595212 Data size: 61598310416 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col5 (type: int), _col9 (type: 
decimal(7,2))
         Reducer 31 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -672,6 +658,20 @@ STAGE PLANS:
                   Statistics: Num rows: 9131 Data size: 10217589 Basic stats: 
COMPLETE Column stats: NONE
                   value expressions: _col0 (type: int)
         Reducer 4 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col7 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col5, _col9, _col12
+                Statistics: Num rows: 696954748 Data size: 67758142926 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  sort order: 
+                  Statistics: Num rows: 696954748 Data size: 67758142926 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col5 (type: int), _col9 (type: 
decimal(7,2)), _col12 (type: int)
+        Reducer 5 
             Local Work:
               Map Reduce Local Work
             Reduce Operator Tree:
@@ -681,12 +681,12 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col2, _col4, _col10, _col13
-                Statistics: Num rows: 6363893803988 Data size: 
7746260663496473 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col5, _col9, _col12, _col13
+                Statistics: Num rows: 6363893803988 Data size: 
7746260663523866 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col10 (type: int), _col2 (type: decimal(7,2)), 
_col4 (type: int), _col13 (type: int)
+                  expressions: _col5 (type: int), _col9 (type: decimal(7,2)), 
_col12 (type: int), _col13 (type: int)
                   outputColumnNames: _col0, _col4, _col11, _col13
-                  Statistics: Num rows: 6363893803988 Data size: 
7746260663496473 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 6363893803988 Data size: 
7746260663523866 Basic stats: COMPLETE Column stats: NONE
                   Map Join Operator
                     condition map:
                          Inner Join 0 to 1
@@ -696,16 +696,16 @@ STAGE PLANS:
                     outputColumnNames: _col0, _col4, _col11, _col13
                     input vertices:
                       1 Reducer 29
-                    Statistics: Num rows: 6363893803988 Data size: 
7803535707732365 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 6363893803988 Data size: 
7803535707759758 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col4 (type: 
decimal(7,2)), _col11 (type: int), _col13 (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 6363893803988 Data size: 
7803535707732365 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 6363893803988 Data size: 
7803535707759758 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 6363893803988 Data size: 
7803535707732365 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 6363893803988 Data size: 
7803535707759758 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col1 (type: 
decimal(7,2)), _col2 (type: int), _col3 (type: int)
-        Reducer 5 
+        Reducer 6 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -734,7 +734,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 6456523813801603 Data size: 
1024819115206086144 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: decimal(17,2))
-        Reducer 6 
+        Reducer 7 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
@@ -759,7 +759,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 3228261906900801 Data size: 
512409557603043008 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: bigint)
-        Reducer 7 
+        Reducer 8 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
@@ -778,7 +778,7 @@ STAGE PLANS:
                     Statistics: Num rows: 1614130953450400 Data size: 
256204778801521408 Basic stats: COMPLETE Column stats: NONE
                     TopN Hash Memory Usage: 0.1
                     value expressions: _col2 (type: int)
-        Reducer 8 
+        Reducer 9 
             Execution mode: vectorized
             Reduce Operator Tree:
               Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/0f7163fa/ql/src/test/results/clientpositive/perf/spark/query72.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query72.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query72.q.out
index 37cf704..3292856 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query72.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query72.q.out
@@ -69,7 +69,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 7 
+        Map 9 
             Map Operator Tree:
                 TableScan
                   alias: warehouse
@@ -94,7 +94,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 15 
+        Map 16 
             Map Operator Tree:
                 TableScan
                   alias: household_demographics
@@ -114,7 +114,7 @@ STAGE PLANS:
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
-        Map 16 
+        Map 17 
             Map Operator Tree:
                 TableScan
                   alias: promotion
@@ -134,50 +134,57 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 10 <- Map 14 (PARTITION-LEVEL SORT, 338), Reducer 9 
(PARTITION-LEVEL SORT, 338)
-        Reducer 11 <- Map 17 (PARTITION-LEVEL SORT, 452), Reducer 10 
(PARTITION-LEVEL SORT, 452)
-        Reducer 12 <- Map 18 (PARTITION-LEVEL SORT, 492), Reducer 11 
(PARTITION-LEVEL SORT, 492)
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 186), Reducer 12 
(PARTITION-LEVEL SORT, 186)
-        Reducer 3 <- Map 19 (PARTITION-LEVEL SORT, 67), Reducer 2 
(PARTITION-LEVEL SORT, 67)
-        Reducer 4 <- Map 20 (PARTITION-LEVEL SORT, 97), Reducer 3 
(PARTITION-LEVEL SORT, 97)
-        Reducer 5 <- Reducer 4 (GROUP, 80)
-        Reducer 6 <- Reducer 5 (SORT, 1)
-        Reducer 9 <- Map 13 (PARTITION-LEVEL SORT, 306), Map 8 
(PARTITION-LEVEL SORT, 306)
+        Reducer 11 <- Map 10 (PARTITION-LEVEL SORT, 306), Map 14 
(PARTITION-LEVEL SORT, 306)
+        Reducer 12 <- Map 15 (PARTITION-LEVEL SORT, 338), Reducer 11 
(PARTITION-LEVEL SORT, 338)
+        Reducer 13 <- Map 18 (PARTITION-LEVEL SORT, 452), Reducer 12 
(PARTITION-LEVEL SORT, 452)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 97), Reducer 8 
(PARTITION-LEVEL SORT, 97)
+        Reducer 3 <- Reducer 2 (GROUP, 80)
+        Reducer 4 <- Reducer 3 (SORT, 1)
+        Reducer 6 <- Map 5 (PARTITION-LEVEL SORT, 496), Reducer 13 
(PARTITION-LEVEL SORT, 496)
+        Reducer 7 <- Map 19 (PARTITION-LEVEL SORT, 181), Reducer 6 
(PARTITION-LEVEL SORT, 181)
+        Reducer 8 <- Map 20 (PARTITION-LEVEL SORT, 199), Reducer 7 
(PARTITION-LEVEL SORT, 199)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: inventory
-                  filterExpr: (inv_item_sk is not null and inv_warehouse_sk is 
not null and inv_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 37584000 Data size: 593821104 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: catalog_returns
+                  filterExpr: cr_item_sk is not null (type: boolean)
+                  Statistics: Num rows: 28798881 Data size: 3057234680 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (inv_date_sk is not null and inv_item_sk is not 
null and inv_warehouse_sk is not null) (type: boolean)
-                    Statistics: Num rows: 37584000 Data size: 593821104 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: cr_item_sk is not null (type: boolean)
+                    Statistics: Num rows: 28798881 Data size: 3057234680 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: inv_date_sk (type: int), inv_item_sk (type: 
int), inv_warehouse_sk (type: int), inv_quantity_on_hand (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 37584000 Data size: 593821104 
Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 _col2 (type: int)
-                          1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col3, _col5
-                        input vertices:
-                          1 Map 7
-                        Statistics: Num rows: 41342400 Data size: 653203228 
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: 41342400 Data size: 653203228 
Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col0 (type: int), _col3 (type: 
int), _col5 (type: string)
+                      expressions: cr_item_sk (type: int), cr_order_number 
(type: int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 28798881 Data size: 3057234680 
Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 
(type: int)
+                        Statistics: Num rows: 28798881 Data size: 3057234680 
Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-            Local Work:
-              Map Reduce Local Work
-        Map 13 
+        Map 10 
+            Map Operator Tree:
+                TableScan
+                  alias: catalog_sales
+                  filterExpr: (cs_item_sk is not null and cs_bill_cdemo_sk is 
not null and cs_bill_hdemo_sk is not null and cs_sold_date_sk is not null and 
cs_ship_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cs_bill_cdemo_sk is not null and 
cs_bill_hdemo_sk is not null and cs_item_sk is not null and cs_ship_date_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_ship_date_sk (type: int), cs_bill_cdemo_sk (type: int), cs_bill_hdemo_sk 
(type: int), cs_item_sk (type: int), cs_promo_sk (type: int), cs_order_number 
(type: int), cs_quantity (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
+                      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: 
int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: 
int), _col7 (type: int)
+            Execution mode: vectorized
+        Map 14 
             Map Operator Tree:
                 TableScan
                   alias: d1
@@ -197,7 +204,7 @@ STAGE PLANS:
                         Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: string), _col2 (type: 
int)
             Execution mode: vectorized
-        Map 14 
+        Map 15 
             Map Operator Tree:
                 TableScan
                   alias: customer_demographics
@@ -216,7 +223,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 930900 Data size: 358593079 
Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 17 
+        Map 18 
             Map Operator Tree:
                 TableScan
                   alias: item
@@ -236,26 +243,6 @@ STAGE PLANS:
                         Statistics: Num rows: 462000 Data size: 663560457 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: string)
             Execution mode: vectorized
-        Map 18 
-            Map Operator Tree:
-                TableScan
-                  alias: d3
-                  filterExpr: d_date_sk is not null (type: boolean)
-                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: d_date_sk is not null (type: boolean)
-                    Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: d_date_sk (type: int), d_date (type: string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
-            Execution mode: vectorized
         Map 19 
             Map Operator Tree:
                 TableScan
@@ -278,43 +265,72 @@ STAGE PLANS:
         Map 20 
             Map Operator Tree:
                 TableScan
-                  alias: catalog_returns
-                  filterExpr: cr_item_sk is not null (type: boolean)
-                  Statistics: Num rows: 28798881 Data size: 3057234680 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: d3
+                  filterExpr: d_date_sk is not null (type: boolean)
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: cr_item_sk is not null (type: boolean)
-                    Statistics: Num rows: 28798881 Data size: 3057234680 Basic 
stats: COMPLETE Column stats: NONE
+                    predicate: d_date_sk is not null (type: boolean)
+                    Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cr_item_sk (type: int), cr_order_number 
(type: int)
+                      expressions: d_date_sk (type: int), d_date (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 28798881 Data size: 3057234680 
Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: int), _col1 (type: int)
-                        sort order: ++
-                        Map-reduce partition columns: _col0 (type: int), _col1 
(type: int)
-                        Statistics: Num rows: 28798881 Data size: 3057234680 
Basic stats: COMPLETE Column stats: NONE
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized
-        Map 8 
+        Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: catalog_sales
-                  filterExpr: (cs_item_sk is not null and cs_bill_cdemo_sk is 
not null and cs_bill_hdemo_sk is not null and cs_sold_date_sk is not null and 
cs_ship_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic 
stats: COMPLETE Column stats: NONE
+                  alias: inventory
+                  filterExpr: (inv_item_sk is not null and inv_warehouse_sk is 
not null and inv_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 37584000 Data size: 593821104 Basic 
stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (cs_bill_cdemo_sk is not null and 
cs_bill_hdemo_sk is not null and cs_item_sk is not null and cs_ship_date_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: (inv_date_sk is not null and inv_item_sk is not 
null and inv_warehouse_sk is not null) (type: boolean)
+                    Statistics: Num rows: 37584000 Data size: 593821104 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), 
cs_ship_date_sk (type: int), cs_bill_cdemo_sk (type: int), cs_bill_hdemo_sk 
(type: int), cs_item_sk (type: int), cs_promo_sk (type: int), cs_order_number 
(type: int), cs_quantity (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7
-                      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: 
int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: 
int), _col7 (type: int)
+                      expressions: inv_date_sk (type: int), inv_item_sk (type: 
int), inv_warehouse_sk (type: int), inv_quantity_on_hand (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 37584000 Data size: 593821104 
Basic stats: COMPLETE Column stats: NONE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col2 (type: int)
+                          1 _col0 (type: int)
+                        outputColumnNames: _col0, _col1, _col3, _col5
+                        input vertices:
+                          1 Map 9
+                        Statistics: Num rows: 41342400 Data size: 653203228 
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: 41342400 Data size: 653203228 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col0 (type: int), _col3 (type: 
int), _col5 (type: string)
             Execution mode: vectorized
-        Reducer 10 
+            Local Work:
+              Map Reduce Local Work
+        Reducer 11 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col9, _col10
+                Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col2 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col2 (type: int)
+                  Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col3 (type: int), 
_col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), 
_col9 (type: string), _col10 (type: int)
+        Reducer 12 
             Local Work:
               Map Reduce Local Work
             Reduce Operator Tree:
@@ -334,7 +350,7 @@ STAGE PLANS:
                     1 _col0 (type: int)
                   outputColumnNames: _col1, _col4, _col5, _col6, _col7, _col9, 
_col10
                   input vertices:
-                    1 Map 15
+                    1 Map 16
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic 
stats: COMPLETE Column stats: NONE
                   Map Join Operator
                     condition map:
@@ -344,7 +360,7 @@ STAGE PLANS:
                       1 _col0 (type: int)
                     outputColumnNames: _col1, _col4, _col6, _col7, _col9, 
_col10, _col16
                     input vertices:
-                      1 Map 16
+                      1 Map 17
                     Statistics: Num rows: 421645953 Data size: 57099332415 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col4 (type: int)
@@ -352,7 +368,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col4 (type: int)
                       Statistics: Num rows: 421645953 Data size: 57099332415 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: int), _col6 (type: int), 
_col7 (type: int), _col9 (type: string), _col10 (type: int), _col16 (type: int)
-        Reducer 11 
+        Reducer 13 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -362,101 +378,43 @@ STAGE PLANS:
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col4, _col6, _col7, _col9, _col10, 
_col16, _col18
                 Statistics: Num rows: 463810558 Data size: 62809267017 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: 463810558 Data size: 62809267017 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col4 (type: int), _col6 (type: int), 
_col7 (type: int), _col9 (type: string), _col10 (type: int), _col16 (type: 
int), _col18 (type: string)
-        Reducer 12 
-            Reduce Operator Tree:
-              Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col1 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col4, _col6, _col7, _col9, _col10, _col16, 
_col18, _col20
-                Statistics: Num rows: 510191624 Data size: 69090195216 Basic 
stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (UDFToDouble(_col20) > (UDFToDouble(_col9) + 
5.0D)) (type: boolean)
-                  Statistics: Num rows: 170063874 Data size: 23030064981 Basic 
stats: COMPLETE Column stats: NONE
-                  Select Operator
-                    expressions: _col18 (type: string), _col4 (type: int), 
_col6 (type: int), _col7 (type: int), _col10 (type: int), _col16 (type: int)
-                    outputColumnNames: _col3, _col8, _col10, _col11, _col14, 
_col20
-                    Statistics: Num rows: 170063874 Data size: 23030064981 
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: 170063874 Data size: 23030064981 
Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col3 (type: string), _col10 (type: 
int), _col11 (type: int), _col14 (type: int), _col20 (type: int)
-        Reducer 2 
-            Reduce Operator Tree:
-              Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col1 (type: int)
-                  1 _col8 (type: int)
-                outputColumnNames: _col0, _col3, _col5, _col9, _col14, _col16, 
_col17, _col20, _col26
-                Statistics: Num rows: 187070265 Data size: 25333072028 Basic 
stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (_col3 < _col17) (type: boolean)
-                  Statistics: Num rows: 62356755 Data size: 8444357342 Basic 
stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col20 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col20 
(type: int)
-                    Statistics: Num rows: 62356755 Data size: 8444357342 Basic 
stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: string), _col9 (type: 
string), _col14 (type: int), _col16 (type: int), _col26 (type: int)
-        Reducer 3 
-            Reduce Operator Tree:
-              Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col0 (type: int), _col20 (type: int)
-                  1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col5, _col9, _col14, _col16, _col20, _col26
-                Statistics: Num rows: 68592431 Data size: 9288793277 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col14 (type: int), _col16 (type: int), _col5 
(type: string), _col9 (type: string), _col20 (type: int), _col26 (type: int)
-                  outputColumnNames: _col4, _col6, _col13, _col15, _col22, 
_col28
-                  Statistics: Num rows: 68592431 Data size: 9288793277 Basic 
stats: COMPLETE Column stats: NONE
+                  expressions: _col18 (type: string), _col1 (type: int), _col4 
(type: int), _col6 (type: int), _col7 (type: int), _col9 (type: string), _col10 
(type: int), _col16 (type: int)
+                  outputColumnNames: _col1, _col3, _col6, _col8, _col9, 
_col11, _col12, _col18
+                  Statistics: Num rows: 463810558 Data size: 62809267017 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: 68592431 Data size: 9288793277 Basic 
stats: COMPLETE Column stats: NONE
-                    value expressions: _col13 (type: string), _col15 (type: 
string), _col22 (type: int), _col28 (type: int)
-        Reducer 4 
+                    key expressions: _col6 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col6 (type: int)
+                    Statistics: Num rows: 463810558 Data size: 62809267017 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: string), _col3 (type: 
int), _col8 (type: int), _col9 (type: int), _col11 (type: string), _col12 
(type: int), _col18 (type: int)
+        Reducer 2 
             Reduce Operator Tree:
               Join Operator
                 condition map:
-                     Left Outer Join 0 to 1
+                     Right Outer Join 0 to 1
                 keys:
-                  0 _col4 (type: int), _col6 (type: int)
-                  1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col13, _col15, _col22, _col28
-                Statistics: Num rows: 75451675 Data size: 10217672826 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: int), _col1 (type: int)
+                  1 _col4 (type: int), _col6 (type: int)
+                outputColumnNames: _col15, _col17, _col24, _col30
+                Statistics: Num rows: 75451675 Data size: 10217672727 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col15 (type: string), _col13 (type: string), 
_col22 (type: int), CASE WHEN (_col28 is null) THEN (1) ELSE (0) END (type: 
int), CASE WHEN (_col28 is not null) THEN (1) ELSE (0) END (type: int)
+                  expressions: _col17 (type: string), _col15 (type: string), 
_col24 (type: int), CASE WHEN (_col30 is null) THEN (1) ELSE (0) END (type: 
int), CASE WHEN (_col30 is not null) THEN (1) ELSE (0) END (type: int)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
-                  Statistics: Num rows: 75451675 Data size: 10217672826 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 75451675 Data size: 10217672727 Basic 
stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: count(_col3), count(_col4), count()
                     keys: _col0 (type: string), _col1 (type: string), _col2 
(type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                    Statistics: Num rows: 75451675 Data size: 10217672826 
Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 75451675 Data size: 10217672727 
Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: int)
                       sort order: +++
                       Map-reduce partition columns: _col0 (type: string), 
_col1 (type: string), _col2 (type: int)
-                      Statistics: Num rows: 75451675 Data size: 10217672826 
Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 75451675 Data size: 10217672727 
Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col3 (type: bigint), _col4 (type: 
bigint), _col5 (type: bigint)
-        Reducer 5 
+        Reducer 3 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
@@ -464,20 +422,20 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: int)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 37725837 Data size: 5108836345 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 37725837 Data size: 5108836295 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col5 (type: bigint), _col0 (type: string), 
_col1 (type: string), _col2 (type: int)
                   sort order: -+++
-                  Statistics: Num rows: 37725837 Data size: 5108836345 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 37725837 Data size: 5108836295 Basic 
stats: COMPLETE Column stats: NONE
                   TopN Hash Memory Usage: 0.1
                   value expressions: _col3 (type: bigint), _col4 (type: bigint)
-        Reducer 6 
+        Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:
               Select Operator
                 expressions: KEY.reducesinkkey1 (type: string), 
KEY.reducesinkkey2 (type: string), KEY.reducesinkkey3 (type: int), VALUE._col0 
(type: bigint), VALUE._col1 (type: bigint), KEY.reducesinkkey0 (type: bigint)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 37725837 Data size: 5108836345 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 37725837 Data size: 5108836295 Basic 
stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
                   Statistics: Num rows: 100 Data size: 13500 Basic stats: 
COMPLETE Column stats: NONE
@@ -488,22 +446,64 @@ STAGE PLANS:
                         input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                         serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-        Reducer 9 
+        Reducer 6 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col9, _col10
-                Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                  0 _col1 (type: int)
+                  1 _col6 (type: int)
+                outputColumnNames: _col0, _col3, _col5, _col7, _col9, _col12, 
_col14, _col15, _col17, _col18, _col24
+                Statistics: Num rows: 510191624 Data size: 69090195216 Basic 
stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (_col3 < _col15) (type: boolean)
+                  Statistics: Num rows: 170063874 Data size: 23030064981 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col18 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col18 
(type: int)
+                    Statistics: Num rows: 170063874 Data size: 23030064981 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col5 (type: string), _col7 (type: 
string), _col9 (type: int), _col12 (type: int), _col14 (type: int), _col17 
(type: string), _col24 (type: int)
+        Reducer 7 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int), _col18 (type: int)
+                  1 _col0 (type: int), _col1 (type: int)
+                outputColumnNames: _col5, _col7, _col9, _col12, _col14, 
_col17, _col18, _col24
+                Statistics: Num rows: 187070265 Data size: 25333072028 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col9 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
-                  Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col3 (type: int), 
_col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), 
_col9 (type: string), _col10 (type: int)
+                  Map-reduce partition columns: _col9 (type: int)
+                  Statistics: Num rows: 187070265 Data size: 25333072028 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col5 (type: string), _col7 (type: 
string), _col12 (type: int), _col14 (type: int), _col17 (type: string), _col18 
(type: int), _col24 (type: int)
+        Reducer 8 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col9 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col5, _col7, _col12, _col14, _col17, 
_col18, _col24, _col28
+                Statistics: Num rows: 205777295 Data size: 27866379834 Basic 
stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (UDFToDouble(_col28) > (UDFToDouble(_col17) + 
5.0D)) (type: boolean)
+                  Statistics: Num rows: 68592431 Data size: 9288793187 Basic 
stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col12 (type: int), _col14 (type: int), _col5 
(type: string), _col7 (type: string), _col18 (type: int), _col24 (type: int)
+                    outputColumnNames: _col4, _col6, _col13, _col15, _col22, 
_col28
+                    Statistics: Num rows: 68592431 Data size: 9288793187 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: 68592431 Data size: 9288793187 
Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col13 (type: string), _col15 (type: 
string), _col22 (type: int), _col28 (type: int)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/0f7163fa/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 af4a835..f5df424 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query85.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query85.q.out
@@ -174,7 +174,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 14 
+        Map 11 
             Map Operator Tree:
                 TableScan
                   alias: web_page
@@ -189,12 +189,12 @@ STAGE PLANS:
                       Statistics: Num rows: 4602 Data size: 2696178 Basic 
stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col10 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
-        Map 15 
+        Map 12 
             Map Operator Tree:
                 TableScan
                   alias: reason
@@ -209,7 +209,7 @@ STAGE PLANS:
                       Statistics: Num rows: 72 Data size: 14400 Basic stats: 
COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col13 (type: int)
+                          0 _col4 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
@@ -218,38 +218,18 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 52), Map 9 (PARTITION-LEVEL 
SORT, 52)
-        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 67), Reducer 2 
(PARTITION-LEVEL SORT, 67)
-        Reducer 4 <- Map 11 (PARTITION-LEVEL SORT, 68), Reducer 3 
(PARTITION-LEVEL SORT, 68)
-        Reducer 5 <- Map 12 (PARTITION-LEVEL SORT, 12), Reducer 4 
(PARTITION-LEVEL SORT, 12)
-        Reducer 6 <- Map 13 (PARTITION-LEVEL SORT, 165), Reducer 5 
(PARTITION-LEVEL SORT, 165)
-        Reducer 7 <- Reducer 6 (GROUP, 71)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 62), Map 9 (PARTITION-LEVEL 
SORT, 62)
+        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 57), Reducer 2 
(PARTITION-LEVEL SORT, 57)
+        Reducer 4 <- Map 13 (PARTITION-LEVEL SORT, 81), Reducer 3 
(PARTITION-LEVEL SORT, 81)
+        Reducer 5 <- Map 14 (PARTITION-LEVEL SORT, 13), Reducer 4 
(PARTITION-LEVEL SORT, 13)
+        Reducer 6 <- Map 15 (PARTITION-LEVEL SORT, 167), Reducer 5 
(PARTITION-LEVEL SORT, 167)
+        Reducer 7 <- Reducer 6 (GROUP, 59)
         Reducer 8 <- Reducer 7 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  filterExpr: ((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_web_page_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: ((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: 48000888 Data size: 6526732556 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: 48000888 Data size: 6526732556 
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: 48000888 Data size: 6526732556 
Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 
(type: decimal(7,2))
-            Execution mode: vectorized
-        Map 10 
-            Map Operator Tree:
-                TableScan
                   alias: web_returns
                   filterExpr: (wr_item_sk is not null and wr_order_number is 
not null and wr_refunded_cdemo_sk is not null and wr_returning_cdemo_sk is not 
null and wr_refunded_addr_sk is not null and wr_reason_sk is not null) (type: 
boolean)
                   Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
@@ -267,7 +247,26 @@ STAGE PLANS:
                         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))
             Execution mode: vectorized
-        Map 11 
+        Map 10 
+            Map Operator Tree:
+                TableScan
+                  alias: date_dim
+                  filterExpr: ((d_year = 1998) and d_date_sk is not null) 
(type: boolean)
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    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)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Map 13 
             Map Operator Tree:
                 TableScan
                   alias: cd1
@@ -287,7 +286,7 @@ STAGE PLANS:
                         Statistics: Num rows: 1861800 Data size: 717186159 
Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: string), _col2 (type: 
string)
             Execution mode: vectorized
-        Map 12 
+        Map 14 
             Map Operator Tree:
                 TableScan
                   alias: cd2
@@ -306,7 +305,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int), _col1 
(type: string), _col2 (type: string)
                         Statistics: Num rows: 1861800 Data size: 717186159 
Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 13 
+        Map 15 
             Map Operator Tree:
                 TableScan
                   alias: customer_address
@@ -329,21 +328,22 @@ STAGE PLANS:
         Map 9 
             Map Operator Tree:
                 TableScan
-                  alias: date_dim
-                  filterExpr: ((d_year = 1998) and d_date_sk is not null) 
(type: boolean)
-                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  alias: web_sales
+                  filterExpr: ((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_web_page_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: ((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
+                    predicate: ((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: 48000888 Data size: 6526732556 Basic 
stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                      expressions: 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: 48000888 Data size: 6526732556 
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
+                        key expressions: _col1 (type: int), _col3 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col1 (type: int), _col3 
(type: int)
+                        Statistics: Num rows: 48000888 Data size: 6526732556 
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))
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -351,114 +351,118 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6
+                  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: 52800977 Data size: 7179405967 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)
+                  key expressions: _col8 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col8 (type: int)
                   Statistics: Num rows: 52800977 Data size: 7179405967 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col4 (type: int), 
_col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                  value expressions: _col1 (type: int), _col2 (type: int), 
_col3 (type: int), _col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: 
decimal(7,2)), _col10 (type: int), _col12 (type: int), _col13 (type: 
decimal(7,2)), _col14 (type: decimal(7,2))
         Reducer 3 
+            Local Work:
+              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int), _col3 (type: int)
-                  1 _col0 (type: int), _col5 (type: int)
-                outputColumnNames: _col2, _col4, _col5, _col6, _col10, _col11, 
_col12, _col13, _col15, _col16
+                  0 _col8 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col10, _col12, _col13, _col14
                 Statistics: Num rows: 58081075 Data size: 7897346734 Basic 
stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col10 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col10 (type: int)
-                  Statistics: Num rows: 58081075 Data size: 7897346734 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col4 (type: int), 
_col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col11 (type: int), 
_col12 (type: int), _col13 (type: int), _col15 (type: decimal(7,2)), _col16 
(type: decimal(7,2))
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col10 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, 
_col12, _col13, _col14
+                  input vertices:
+                    1 Map 11
+                  Statistics: Num rows: 63889183 Data size: 8687081595 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, _col2, _col3, _col6, _col7, 
_col12, _col13, _col14, _col19
+                    input vertices:
+                      1 Map 12
+                    Statistics: Num rows: 70278102 Data size: 9555789961 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: 70278102 Data size: 9555789961 
Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col2 (type: int), _col3 (type: int), 
_col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), 
_col13 (type: decimal(7,2)), _col14 (type: decimal(7,2)), _col19 (type: string)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col10 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col5, _col6, _col11, _col12, 
_col13, _col15, _col16, _col18, _col19
-                Statistics: Num rows: 63889183 Data size: 8687081595 Basic 
stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col3, _col6, _col7, _col12, _col13, 
_col14, _col19, _col21, _col22
+                Statistics: Num rows: 77305913 Data size: 10511369184 Basic 
stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (((_col18 = 'D') and (_col19 = 'Primary') and 
_col5 BETWEEN 50 AND 100) or ((_col18 = 'M') and (_col19 = '4 yr Degree') and 
_col5 BETWEEN 100 AND 150) or ((_col18 = 'U') and (_col19 = 'Advanced Degree') 
and _col5 BETWEEN 150 AND 200)) (type: boolean)
-                  Statistics: Num rows: 5324097 Data size: 723923250 Basic 
stats: COMPLETE Column stats: NONE
+                  predicate: (((_col21 = 'D') and (_col22 = 'Primary') and 
_col13 BETWEEN 50 AND 100) or ((_col21 = 'M') and (_col22 = '4 yr Degree') and 
_col13 BETWEEN 100 AND 150) or ((_col21 = 'U') and (_col22 = 'Advanced Degree') 
and _col13 BETWEEN 150 AND 200)) (type: boolean)
+                  Statistics: Num rows: 6442158 Data size: 875947239 Basic 
stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col12 (type: int), _col18 (type: 
string), _col19 (type: string)
+                    key expressions: _col3 (type: int), _col21 (type: string), 
_col22 (type: string)
                     sort order: +++
-                    Map-reduce partition columns: _col12 (type: int), _col18 
(type: string), _col19 (type: string)
-                    Statistics: Num rows: 5324097 Data size: 723923250 Basic 
stats: COMPLETE Column stats: NONE
-                    value expressions: _col2 (type: int), _col4 (type: int), 
_col6 (type: decimal(7,2)), _col11 (type: int), _col13 (type: int), _col15 
(type: decimal(7,2)), _col16 (type: decimal(7,2))
+                    Map-reduce partition columns: _col3 (type: int), _col21 
(type: string), _col22 (type: string)
+                    Statistics: Num rows: 6442158 Data size: 875947239 Basic 
stats: COMPLETE Column stats: NONE
+                    value expressions: _col2 (type: int), _col6 (type: 
decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col14 (type: 
decimal(7,2)), _col19 (type: string)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col12 (type: int), _col18 (type: string), _col19 (type: 
string)
+                  0 _col3 (type: int), _col21 (type: string), _col22 (type: 
string)
                   1 _col0 (type: int), _col1 (type: string), _col2 (type: 
string)
-                outputColumnNames: _col2, _col4, _col6, _col11, _col13, 
_col15, _col16
-                Statistics: Num rows: 5856506 Data size: 796315592 Basic 
stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col6, _col7, _col12, _col14, _col19
+                Statistics: Num rows: 7086373 Data size: 963541983 Basic 
stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col11 (type: int)
+                  key expressions: _col2 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col11 (type: int)
-                  Statistics: Num rows: 5856506 Data size: 796315592 Basic 
stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col4 (type: int), 
_col6 (type: decimal(7,2)), _col13 (type: int), _col15 (type: decimal(7,2)), 
_col16 (type: decimal(7,2))
+                  Map-reduce partition columns: _col2 (type: int)
+                  Statistics: Num rows: 7086373 Data size: 963541983 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col6 (type: decimal(7,2)), _col7 (type: 
decimal(7,2)), _col12 (type: int), _col14 (type: decimal(7,2)), _col19 (type: 
string)
         Reducer 6 
-            Local Work:
-              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col11 (type: int)
+                  0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col6, _col13, _col15, 
_col16, _col24
+                outputColumnNames: _col6, _col7, _col12, _col14, _col19, _col27
                 Statistics: Num rows: 22000000 Data size: 22327357890 Basic 
stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((((_col24 = 'KY') or (_col24 = 'GA') or (_col24 
= 'NM')) and _col6 BETWEEN 100 AND 200) or (((_col24 = 'MT') or (_col24 = 'OR') 
or (_col24 = 'IN')) and _col6 BETWEEN 150 AND 300) or (((_col24 = 'WI') or 
(_col24 = 'MO') or (_col24 = 'WV')) and _col6 BETWEEN 50 AND 250)) (type: 
boolean)
+                  predicate: ((((_col27 = 'KY') or (_col27 = 'GA') or (_col27 
= 'NM')) and _col14 BETWEEN 100 AND 200) or (((_col27 = 'MT') or (_col27 = 
'OR') or (_col27 = 'IN')) and _col14 BETWEEN 150 AND 300) or (((_col27 = 'WI') 
or (_col27 = 'MO') or (_col27 = 'WV')) and _col14 BETWEEN 50 AND 250)) (type: 
boolean)
                   Statistics: Num rows: 7333332 Data size: 7442451276 Basic 
stats: COMPLETE Column stats: NONE
-                  Map Join Operator
-                    condition map:
-                         Inner Join 0 to 1
-                    keys:
-                      0 _col2 (type: int)
-                      1 _col0 (type: int)
-                    outputColumnNames: _col4, _col13, _col15, _col16
-                    input vertices:
-                      1 Map 14
-                    Statistics: Num rows: 8066665 Data size: 8186696581 Basic 
stats: COMPLETE Column stats: NONE
-                    Map Join Operator
-                      condition map:
-                           Inner Join 0 to 1
-                      keys:
-                        0 _col13 (type: int)
-                        1 _col0 (type: int)
-                      outputColumnNames: _col4, _col15, _col16, _col28
-                      input vertices:
-                        1 Map 15
-                      Statistics: Num rows: 8873331 Data size: 9005366434 
Basic stats: COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: sum(_col4), count(_col4), sum(_col16), 
count(_col16), sum(_col15), count(_col15)
-                        keys: _col28 (type: string)
-                        mode: hash
-                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
-                        Statistics: Num rows: 8873331 Data size: 9005366434 
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: 8873331 Data size: 9005366434 
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)
+                  Select Operator
+                    expressions: _col6 (type: decimal(7,2)), _col7 (type: 
decimal(7,2)), _col12 (type: int), _col19 (type: string)
+                    outputColumnNames: _col6, _col7, _col12, _col19
+                    Statistics: Num rows: 7333332 Data size: 7442451276 Basic 
stats: COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: sum(_col12), count(_col12), sum(_col7), 
count(_col7), sum(_col6), count(_col6)
+                      keys: _col19 (type: string)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6
+                      Statistics: Num rows: 7333332 Data size: 7442451276 
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: 7333332 Data size: 7442451276 
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 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -467,15 +471,15 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
-                Statistics: Num rows: 4436665 Data size: 4502682709 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 3666666 Data size: 3721225638 Basic 
stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: (UDFToDouble(_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: 4436665 Data size: 4502682709 Basic 
stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 3666666 Data size: 3721225638 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: 4436665 Data size: 4502682709 Basic 
stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 3666666 Data size: 3721225638 Basic 
stats: COMPLETE Column stats: NONE
                     TopN Hash Memory Usage: 0.1
         Reducer 8 
             Execution mode: vectorized
@@ -483,7 +487,7 @@ STAGE PLANS:
               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: 4436665 Data size: 4502682709 Basic 
stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 3666666 Data size: 3721225638 Basic 
stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
                   Statistics: Num rows: 100 Data size: 101400 Basic stats: 
COMPLETE Column stats: NONE

Reply via email to