http://git-wip-us.apache.org/repos/asf/hive/blob/bd371246/ql/src/test/results/clientpositive/perf/spark/query28.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query28.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query28.q.out
new file mode 100644
index 0000000..fb7e198
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/spark/query28.q.out
@@ -0,0 +1,517 @@
+Warning: Map Join MAPJOIN[94][bigTable=?] in task 'Stage-1:MAPRED' is a cross 
product
+PREHOOK: query: explain
+select  *
+from (select avg(ss_list_price) B1_LP
+            ,count(ss_list_price) B1_CNT
+            ,count(distinct ss_list_price) B1_CNTD
+      from store_sales
+      where ss_quantity between 0 and 5
+        and (ss_list_price between 11 and 11+10 
+             or ss_coupon_amt between 460 and 460+1000
+             or ss_wholesale_cost between 14 and 14+20)) B1,
+     (select avg(ss_list_price) B2_LP
+            ,count(ss_list_price) B2_CNT
+            ,count(distinct ss_list_price) B2_CNTD
+      from store_sales
+      where ss_quantity between 6 and 10
+        and (ss_list_price between 91 and 91+10
+          or ss_coupon_amt between 1430 and 1430+1000
+          or ss_wholesale_cost between 32 and 32+20)) B2,
+     (select avg(ss_list_price) B3_LP
+            ,count(ss_list_price) B3_CNT
+            ,count(distinct ss_list_price) B3_CNTD
+      from store_sales
+      where ss_quantity between 11 and 15
+        and (ss_list_price between 66 and 66+10
+          or ss_coupon_amt between 920 and 920+1000
+          or ss_wholesale_cost between 4 and 4+20)) B3,
+     (select avg(ss_list_price) B4_LP
+            ,count(ss_list_price) B4_CNT
+            ,count(distinct ss_list_price) B4_CNTD
+      from store_sales
+      where ss_quantity between 16 and 20
+        and (ss_list_price between 142 and 142+10
+          or ss_coupon_amt between 3054 and 3054+1000
+          or ss_wholesale_cost between 80 and 80+20)) B4,
+     (select avg(ss_list_price) B5_LP
+            ,count(ss_list_price) B5_CNT
+            ,count(distinct ss_list_price) B5_CNTD
+      from store_sales
+      where ss_quantity between 21 and 25
+        and (ss_list_price between 135 and 135+10
+          or ss_coupon_amt between 14180 and 14180+1000
+          or ss_wholesale_cost between 38 and 38+20)) B5,
+     (select avg(ss_list_price) B6_LP
+            ,count(ss_list_price) B6_CNT
+            ,count(distinct ss_list_price) B6_CNTD
+      from store_sales
+      where ss_quantity between 26 and 30
+        and (ss_list_price between 28 and 28+10
+          or ss_coupon_amt between 2513 and 2513+1000
+          or ss_wholesale_cost between 42 and 42+20)) B6
+limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  *
+from (select avg(ss_list_price) B1_LP
+            ,count(ss_list_price) B1_CNT
+            ,count(distinct ss_list_price) B1_CNTD
+      from store_sales
+      where ss_quantity between 0 and 5
+        and (ss_list_price between 11 and 11+10 
+             or ss_coupon_amt between 460 and 460+1000
+             or ss_wholesale_cost between 14 and 14+20)) B1,
+     (select avg(ss_list_price) B2_LP
+            ,count(ss_list_price) B2_CNT
+            ,count(distinct ss_list_price) B2_CNTD
+      from store_sales
+      where ss_quantity between 6 and 10
+        and (ss_list_price between 91 and 91+10
+          or ss_coupon_amt between 1430 and 1430+1000
+          or ss_wholesale_cost between 32 and 32+20)) B2,
+     (select avg(ss_list_price) B3_LP
+            ,count(ss_list_price) B3_CNT
+            ,count(distinct ss_list_price) B3_CNTD
+      from store_sales
+      where ss_quantity between 11 and 15
+        and (ss_list_price between 66 and 66+10
+          or ss_coupon_amt between 920 and 920+1000
+          or ss_wholesale_cost between 4 and 4+20)) B3,
+     (select avg(ss_list_price) B4_LP
+            ,count(ss_list_price) B4_CNT
+            ,count(distinct ss_list_price) B4_CNTD
+      from store_sales
+      where ss_quantity between 16 and 20
+        and (ss_list_price between 142 and 142+10
+          or ss_coupon_amt between 3054 and 3054+1000
+          or ss_wholesale_cost between 80 and 80+20)) B4,
+     (select avg(ss_list_price) B5_LP
+            ,count(ss_list_price) B5_CNT
+            ,count(distinct ss_list_price) B5_CNTD
+      from store_sales
+      where ss_quantity between 21 and 25
+        and (ss_list_price between 135 and 135+10
+          or ss_coupon_amt between 14180 and 14180+1000
+          or ss_wholesale_cost between 38 and 38+20)) B5,
+     (select avg(ss_list_price) B6_LP
+            ,count(ss_list_price) B6_CNT
+            ,count(distinct ss_list_price) B6_CNTD
+      from store_sales
+      where ss_quantity between 26 and 30
+        and (ss_list_price between 28 and 28+10
+          or ss_coupon_amt between 2513 and 2513+1000
+          or ss_wholesale_cost between 42 and 42+20)) B6
+limit 100
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-2 is a root stage
+  Stage-1 depends on stages: Stage-2
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-2
+    Spark
+      Edges:
+        Reducer 11 <- Map 10 (GROUP, 15)
+        Reducer 12 <- Reducer 11 (GROUP, 1)
+        Reducer 14 <- Map 13 (GROUP, 15)
+        Reducer 15 <- Reducer 14 (GROUP, 1)
+        Reducer 17 <- Map 16 (GROUP, 15)
+        Reducer 18 <- Reducer 17 (GROUP, 1)
+        Reducer 5 <- Map 4 (GROUP, 15)
+        Reducer 6 <- Reducer 5 (GROUP, 1)
+        Reducer 8 <- Map 7 (GROUP, 15)
+        Reducer 9 <- Reducer 8 (GROUP, 1)
+#### A masked pattern was here ####
+      Vertices:
+        Map 10 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ss_list_price BETWEEN 142 AND 152 or 
ss_coupon_amt BETWEEN 3054 AND 4054 or ss_wholesale_cost BETWEEN 80 AND 100) 
and ss_quantity BETWEEN 16 AND 20) (type: boolean)
+                    Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_list_price (type: decimal(7,2))
+                      outputColumnNames: ss_list_price
+                      Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                      Group By Operator
+                        aggregations: avg(ss_list_price), count(ss_list_price)
+                        keys: ss_list_price (type: decimal(7,2))
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(7,2))
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: 
decimal(7,2))
+                          Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col1 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col2 (type: bigint)
+        Map 13 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ss_list_price BETWEEN 66 AND 76 or 
ss_coupon_amt BETWEEN 920 AND 1920 or ss_wholesale_cost BETWEEN 4 AND 24) and 
ss_quantity BETWEEN 11 AND 15) (type: boolean)
+                    Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_list_price (type: decimal(7,2))
+                      outputColumnNames: ss_list_price
+                      Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                      Group By Operator
+                        aggregations: avg(ss_list_price), count(ss_list_price)
+                        keys: ss_list_price (type: decimal(7,2))
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(7,2))
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: 
decimal(7,2))
+                          Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col1 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col2 (type: bigint)
+        Map 16 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ss_list_price BETWEEN 91 AND 101 or 
ss_coupon_amt BETWEEN 1430 AND 2430 or ss_wholesale_cost BETWEEN 32 AND 52) and 
ss_quantity BETWEEN 6 AND 10) (type: boolean)
+                    Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_list_price (type: decimal(7,2))
+                      outputColumnNames: ss_list_price
+                      Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                      Group By Operator
+                        aggregations: avg(ss_list_price), count(ss_list_price)
+                        keys: ss_list_price (type: decimal(7,2))
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(7,2))
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: 
decimal(7,2))
+                          Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col1 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col2 (type: bigint)
+        Map 4 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ss_list_price BETWEEN 28 AND 38 or 
ss_coupon_amt BETWEEN 2513 AND 3513 or ss_wholesale_cost BETWEEN 42 AND 62) and 
ss_quantity BETWEEN 26 AND 30) (type: boolean)
+                    Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_list_price (type: decimal(7,2))
+                      outputColumnNames: ss_list_price
+                      Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                      Group By Operator
+                        aggregations: avg(ss_list_price), count(ss_list_price)
+                        keys: ss_list_price (type: decimal(7,2))
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(7,2))
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: 
decimal(7,2))
+                          Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col1 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col2 (type: bigint)
+        Map 7 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ss_list_price BETWEEN 135 AND 145 or 
ss_coupon_amt BETWEEN 14180 AND 15180 or ss_wholesale_cost BETWEEN 38 AND 58) 
and ss_quantity BETWEEN 21 AND 25) (type: boolean)
+                    Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_list_price (type: decimal(7,2))
+                      outputColumnNames: ss_list_price
+                      Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                      Group By Operator
+                        aggregations: avg(ss_list_price), count(ss_list_price)
+                        keys: ss_list_price (type: decimal(7,2))
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(7,2))
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: 
decimal(7,2))
+                          Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col1 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col2 (type: bigint)
+        Reducer 11 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1)
+                keys: KEY._col0 (type: decimal(7,2))
+                mode: partial2
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: avg(_col1), count(_col2), count(_col0)
+                  mode: partial2
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col1 (type: 
bigint), _col2 (type: bigint)
+        Reducer 12 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1), 
count(VALUE._col2)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Spark HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+                    2 
+                    3 
+                    4 
+                    5 
+        Reducer 14 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1)
+                keys: KEY._col0 (type: decimal(7,2))
+                mode: partial2
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: avg(_col1), count(_col2), count(_col0)
+                  mode: partial2
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col1 (type: 
bigint), _col2 (type: bigint)
+        Reducer 15 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1), 
count(VALUE._col2)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Spark HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+                    2 
+                    3 
+                    4 
+                    5 
+        Reducer 17 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1)
+                keys: KEY._col0 (type: decimal(7,2))
+                mode: partial2
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: avg(_col1), count(_col2), count(_col0)
+                  mode: partial2
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col1 (type: 
bigint), _col2 (type: bigint)
+        Reducer 18 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1), 
count(VALUE._col2)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Spark HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+                    2 
+                    3 
+                    4 
+                    5 
+        Reducer 5 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1)
+                keys: KEY._col0 (type: decimal(7,2))
+                mode: partial2
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: avg(_col1), count(_col2), count(_col0)
+                  mode: partial2
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col1 (type: 
bigint), _col2 (type: bigint)
+        Reducer 6 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1), 
count(VALUE._col2)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Spark HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+                    2 
+                    3 
+                    4 
+                    5 
+        Reducer 8 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1)
+                keys: KEY._col0 (type: decimal(7,2))
+                mode: partial2
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: avg(_col1), count(_col2), count(_col0)
+                  mode: partial2
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col1 (type: 
bigint), _col2 (type: bigint)
+        Reducer 9 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1), 
count(VALUE._col2)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Spark HashTable Sink Operator
+                  keys:
+                    0 
+                    1 
+                    2 
+                    3 
+                    4 
+                    5 
+
+  Stage: Stage-1
+    Spark
+      Edges:
+        Reducer 2 <- Map 1 (GROUP, 15)
+        Reducer 3 <- Reducer 2 (GROUP, 1)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ss_list_price BETWEEN 11 AND 21 or 
ss_coupon_amt BETWEEN 460 AND 1460 or ss_wholesale_cost BETWEEN 14 AND 34) and 
ss_quantity BETWEEN 0 AND 5) (type: boolean)
+                    Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_list_price (type: decimal(7,2))
+                      outputColumnNames: ss_list_price
+                      Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                      Group By Operator
+                        aggregations: avg(ss_list_price), count(ss_list_price)
+                        keys: ss_list_price (type: decimal(7,2))
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
+                        Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(7,2))
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: 
decimal(7,2))
+                          Statistics: Num rows: 21333171 Data size: 1882018537 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col1 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col2 (type: bigint)
+        Reducer 2 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1)
+                keys: KEY._col0 (type: decimal(7,2))
+                mode: partial2
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 21333171 Data size: 1882018537 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: avg(_col1), count(_col2), count(_col0)
+                  mode: partial2
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: 
struct<count:bigint,sum:decimal(17,2),input:decimal(7,2)>), _col1 (type: 
bigint), _col2 (type: bigint)
+        Reducer 3 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: avg(VALUE._col0), count(VALUE._col1), 
count(VALUE._col2)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                       Inner Join 0 to 2
+                       Inner Join 0 to 3
+                       Inner Join 0 to 4
+                       Inner Join 0 to 5
+                  keys:
+                    0 
+                    1 
+                    2 
+                    3 
+                    4 
+                    5 
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17
+                  input vertices:
+                    1 Reducer 6
+                    2 Reducer 9
+                    3 Reducer 12
+                    4 Reducer 15
+                    5 Reducer 18
+                  Statistics: Num rows: 1 Data size: 3505 Basic stats: 
COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col0 (type: decimal(11,6)), _col1 (type: 
bigint), _col2 (type: bigint), _col15 (type: decimal(11,6)), _col16 (type: 
bigint), _col17 (type: bigint), _col12 (type: decimal(11,6)), _col13 (type: 
bigint), _col14 (type: bigint), _col9 (type: decimal(11,6)), _col10 (type: 
bigint), _col11 (type: bigint), _col6 (type: decimal(11,6)), _col7 (type: 
bigint), _col8 (type: bigint), _col3 (type: decimal(11,6)), _col4 (type: 
bigint), _col5 (type: bigint)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, 
_col15, _col16, _col17
+                    Statistics: Num rows: 1 Data size: 3505 Basic stats: 
COMPLETE Column stats: NONE
+                    Limit
+                      Number of rows: 100
+                      Statistics: Num rows: 1 Data size: 3505 Basic stats: 
COMPLETE Column stats: NONE
+                      File Output Operator
+                        compressed: false
+                        Statistics: Num rows: 1 Data size: 3505 Basic stats: 
COMPLETE Column stats: NONE
+                        table:
+                            input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
+                            output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                            serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 100
+      Processor Tree:
+        ListSink
+

http://git-wip-us.apache.org/repos/asf/hive/blob/bd371246/ql/src/test/results/clientpositive/perf/spark/query29.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query29.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query29.q.out
new file mode 100644
index 0000000..530a625
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/spark/query29.q.out
@@ -0,0 +1,415 @@
+PREHOOK: query: explain
+select   
+     i_item_id
+    ,i_item_desc
+    ,s_store_id
+    ,s_store_name
+    ,sum(ss_quantity)        as store_sales_quantity
+    ,sum(sr_return_quantity) as store_returns_quantity
+    ,sum(cs_quantity)        as catalog_sales_quantity
+ from
+    store_sales
+   ,store_returns
+   ,catalog_sales
+   ,date_dim             d1
+   ,date_dim             d2
+   ,date_dim             d3
+   ,store
+   ,item
+ where
+     d1.d_moy               = 4 
+ and d1.d_year              = 1999
+ and d1.d_date_sk           = ss_sold_date_sk
+ and i_item_sk              = ss_item_sk
+ and s_store_sk             = ss_store_sk
+ and ss_customer_sk         = sr_customer_sk
+ and ss_item_sk             = sr_item_sk
+ and ss_ticket_number       = sr_ticket_number
+ and sr_returned_date_sk    = d2.d_date_sk
+ and d2.d_moy               between 4 and  4 + 3 
+ and d2.d_year              = 1999
+ and sr_customer_sk         = cs_bill_customer_sk
+ and sr_item_sk             = cs_item_sk
+ and cs_sold_date_sk        = d3.d_date_sk     
+ and d3.d_year              in (1999,1999+1,1999+2)
+ group by
+    i_item_id
+   ,i_item_desc
+   ,s_store_id
+   ,s_store_name
+ order by
+    i_item_id 
+   ,i_item_desc
+   ,s_store_id
+   ,s_store_name
+ limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select   
+     i_item_id
+    ,i_item_desc
+    ,s_store_id
+    ,s_store_name
+    ,sum(ss_quantity)        as store_sales_quantity
+    ,sum(sr_return_quantity) as store_returns_quantity
+    ,sum(cs_quantity)        as catalog_sales_quantity
+ from
+    store_sales
+   ,store_returns
+   ,catalog_sales
+   ,date_dim             d1
+   ,date_dim             d2
+   ,date_dim             d3
+   ,store
+   ,item
+ where
+     d1.d_moy               = 4 
+ and d1.d_year              = 1999
+ and d1.d_date_sk           = ss_sold_date_sk
+ and i_item_sk              = ss_item_sk
+ and s_store_sk             = ss_store_sk
+ and ss_customer_sk         = sr_customer_sk
+ and ss_item_sk             = sr_item_sk
+ and ss_ticket_number       = sr_ticket_number
+ and sr_returned_date_sk    = d2.d_date_sk
+ and d2.d_moy               between 4 and  4 + 3 
+ and d2.d_year              = 1999
+ and sr_customer_sk         = cs_bill_customer_sk
+ and sr_item_sk             = cs_item_sk
+ and cs_sold_date_sk        = d3.d_date_sk     
+ and d3.d_year              in (1999,1999+1,1999+2)
+ group by
+    i_item_id
+   ,i_item_desc
+   ,s_store_id
+   ,s_store_name
+ order by
+    i_item_id 
+   ,i_item_desc
+   ,s_store_id
+   ,s_store_name
+ limit 100
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-2 is a root stage
+  Stage-3 depends on stages: Stage-2
+  Stage-1 depends on stages: Stage-3
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-2
+    Spark
+#### A masked pattern was here ####
+      Vertices:
+        Map 15 
+            Map Operator Tree:
+                TableScan
+                  alias: store
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: s_store_sk is not null (type: boolean)
+                    Statistics: Num rows: 1704 Data size: 3256276 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: s_store_sk (type: int), s_store_id (type: 
string), s_store_name (type: string)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 1704 Data size: 3256276 Basic 
stats: COMPLETE Column stats: NONE
+                      Spark HashTable Sink Operator
+                        keys:
+                          0 _col3 (type: int)
+                          1 _col0 (type: int)
+            Local Work:
+              Map Reduce Local Work
+
+  Stage: Stage-3
+    Spark
+#### A masked pattern was here ####
+      Vertices:
+        Map 13 
+            Map Operator Tree:
+                TableScan
+                  alias: d2
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((d_year = 1999) and d_date_sk is not null and 
d_moy BETWEEN 4 AND 7) (type: boolean)
+                    Statistics: Num rows: 4058 Data size: 4540902 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 4058 Data size: 4540902 Basic 
stats: COMPLETE Column stats: NONE
+                      Spark HashTable Sink Operator
+                        keys:
+                          0 _col0 (type: int)
+                          1 _col0 (type: int)
+            Local Work:
+              Map Reduce Local Work
+
+  Stage: Stage-1
+    Spark
+      Edges:
+        Reducer 10 <- Map 14 (PARTITION-LEVEL SORT, 486), Reducer 9 
(PARTITION-LEVEL SORT, 486)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 306), Map 6 (PARTITION-LEVEL 
SORT, 306)
+        Reducer 3 <- Reducer 10 (PARTITION-LEVEL SORT, 917), Reducer 2 
(PARTITION-LEVEL SORT, 917)
+        Reducer 4 <- Reducer 3 (GROUP, 640)
+        Reducer 5 <- Reducer 4 (SORT, 1)
+        Reducer 8 <- Map 11 (PARTITION-LEVEL SORT, 398), Map 7 
(PARTITION-LEVEL SORT, 398)
+        Reducer 9 <- Map 12 (PARTITION-LEVEL SORT, 476), Reducer 8 
(PARTITION-LEVEL SORT, 476)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: catalog_sales
+                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cs_bill_customer_sk is not null and cs_item_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_item_sk (type: int), cs_quantity (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      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)
+        Map 11 
+            Map Operator Tree:
+                TableScan
+                  alias: d1
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((d_moy = 4) and (d_year = 1999) and d_date_sk 
is not null) (type: boolean)
+                    Statistics: Num rows: 18262 Data size: 20435178 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 18262 Data size: 20435178 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: 18262 Data size: 20435178 Basic 
stats: COMPLETE Column stats: NONE
+        Map 12 
+            Map Operator Tree:
+                TableScan
+                  alias: store_returns
+                  Statistics: Num rows: 57591150 Data size: 4462194832 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (sr_customer_sk is not null and sr_item_sk is 
not null and sr_returned_date_sk is not null and sr_ticket_number is not null) 
(type: boolean)
+                    Statistics: Num rows: 57591150 Data size: 4462194832 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: sr_returned_date_sk (type: int), sr_item_sk 
(type: int), sr_customer_sk (type: int), sr_ticket_number (type: int), 
sr_return_quantity (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      Statistics: Num rows: 57591150 Data size: 4462194832 
Basic stats: COMPLETE Column stats: NONE
+                      Map Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: int)
+                          1 _col0 (type: int)
+                        outputColumnNames: _col1, _col2, _col3, _col4
+                        input vertices:
+                          1 Map 13
+                        Statistics: Num rows: 63350266 Data size: 4908414421 
Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: int)
+                          sort order: +++
+                          Map-reduce partition columns: _col1 (type: int), 
_col2 (type: int), _col3 (type: int)
+                          Statistics: Num rows: 63350266 Data size: 4908414421 
Basic stats: COMPLETE Column stats: NONE
+                          value expressions: _col4 (type: int)
+            Local Work:
+              Map Reduce Local Work
+        Map 14 
+            Map Operator Tree:
+                TableScan
+                  alias: item
+                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: i_item_sk is not null (type: boolean)
+                    Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: i_item_sk (type: int), i_item_id (type: 
string), i_item_desc (type: string)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 462000 Data size: 663560457 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string), _col2 (type: 
string)
+        Map 6 
+            Map Operator Tree:
+                TableScan
+                  alias: d3
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((d_year) IN (1999, 2000, 2001) and d_date_sk 
is not null) (type: boolean)
+                    Statistics: Num rows: 36525 Data size: 40871475 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 36525 Data size: 40871475 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: 36525 Data size: 40871475 Basic 
stats: COMPLETE Column stats: NONE
+        Map 7 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (ss_customer_sk is not null and ss_item_sk is 
not null and ss_sold_date_sk is not null and ss_store_sk is not null and 
ss_ticket_number is not null) (type: boolean)
+                    Statistics: Num rows: 575995635 Data size: 50814502088 
Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ss_sold_date_sk (type: int), ss_item_sk 
(type: int), ss_customer_sk (type: int), ss_store_sk (type: int), 
ss_ticket_number (type: int), ss_quantity (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5
+                      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: 
int), _col3 (type: int), _col4 (type: int), _col5 (type: int)
+        Reducer 10 
+            Local Work:
+              Map Reduce Local Work
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col3, _col5, _col10, _col11, _col13, 
_col18, _col19
+                Statistics: Num rows: 766650239 Data size: 67634106676 Basic 
stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col3 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col5, _col10, _col11, _col13, _col18, 
_col19, _col21, _col22
+                  input vertices:
+                    1 Map 15
+                  Statistics: Num rows: 843315281 Data size: 74397518956 Basic 
stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col18 (type: string), _col19 (type: string), 
_col5 (type: int), _col10 (type: int), _col11 (type: int), _col13 (type: int), 
_col21 (type: string), _col22 (type: string)
+                    outputColumnNames: _col1, _col2, _col8, _col13, _col14, 
_col16, _col21, _col22
+                    Statistics: Num rows: 843315281 Data size: 74397518956 
Basic stats: COMPLETE Column stats: NONE
+                    Reduce Output Operator
+                      key expressions: _col14 (type: int), _col13 (type: int)
+                      sort order: ++
+                      Map-reduce partition columns: _col14 (type: int), _col13 
(type: int)
+                      Statistics: Num rows: 843315281 Data size: 74397518956 
Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string), _col2 (type: 
string), _col8 (type: int), _col16 (type: int), _col21 (type: string), _col22 
(type: string)
+        Reducer 2 
+            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
+                Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col1 (type: int), _col2 (type: int)
+                  sort order: ++
+                  Map-reduce partition columns: _col1 (type: int), _col2 
(type: int)
+                  Statistics: Num rows: 316788826 Data size: 42899570777 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col3 (type: int)
+        Reducer 3 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: int), _col2 (type: int)
+                  1 _col14 (type: int), _col13 (type: int)
+                outputColumnNames: _col3, _col7, _col8, _col14, _col22, 
_col27, _col28
+                Statistics: Num rows: 927646829 Data size: 81837272625 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col14), sum(_col22), sum(_col3)
+                  keys: _col7 (type: string), _col8 (type: string), _col27 
(type: string), _col28 (type: string)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
+                  Statistics: Num rows: 927646829 Data size: 81837272625 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: 
string), _col2 (type: string), _col3 (type: string)
+                    sort order: ++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: string), _col2 (type: string), _col3 (type: string)
+                    Statistics: Num rows: 927646829 Data size: 81837272625 
Basic stats: COMPLETE Column stats: NONE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col4 (type: bigint), _col5 (type: 
bigint), _col6 (type: bigint)
+        Reducer 4 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0), sum(VALUE._col1), 
sum(VALUE._col2)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), 
KEY._col2 (type: string), KEY._col3 (type: string)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
+                Statistics: Num rows: 463823414 Data size: 40918636268 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string), _col1 (type: string), 
_col2 (type: string), _col3 (type: string)
+                  sort order: ++++
+                  Statistics: Num rows: 463823414 Data size: 40918636268 Basic 
stats: COMPLETE Column stats: NONE
+                  TopN Hash Memory Usage: 0.1
+                  value expressions: _col4 (type: bigint), _col5 (type: 
bigint), _col6 (type: bigint)
+        Reducer 5 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: string), 
KEY.reducesinkkey1 (type: string), KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), VALUE._col0 (type: bigint), VALUE._col1 
(type: bigint), VALUE._col2 (type: bigint)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6
+                Statistics: Num rows: 463823414 Data size: 40918636268 Basic 
stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 100
+                  Statistics: Num rows: 100 Data size: 8800 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 100 Data size: 8800 Basic stats: 
COMPLETE Column stats: NONE
+                    table:
+                        input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 8 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col1 (type: int), _col2 (type: int), _col4 
(type: int)
+                  sort order: +++
+                  Map-reduce partition columns: _col1 (type: int), _col2 
(type: int), _col4 (type: int)
+                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col3 (type: int), _col5 (type: int)
+        Reducer 9 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: int), _col2 (type: int), _col4 (type: int)
+                  1 _col1 (type: int), _col2 (type: int), _col3 (type: int)
+                outputColumnNames: _col1, _col3, _col5, _col10, _col11, _col13
+                Statistics: Num rows: 696954748 Data size: 61485550191 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: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col3 (type: int), _col5 (type: int), 
_col10 (type: int), _col11 (type: int), _col13 (type: int)
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 100
+      Processor Tree:
+        ListSink
+

http://git-wip-us.apache.org/repos/asf/hive/blob/bd371246/ql/src/test/results/clientpositive/perf/spark/query3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query3.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query3.q.out
new file mode 100644
index 0000000..7fdd478
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/spark/query3.q.out
@@ -0,0 +1,183 @@
+PREHOOK: query: explain
+select  dt.d_year 
+       ,item.i_brand_id brand_id 
+       ,item.i_brand brand
+       ,sum(ss_ext_sales_price) sum_agg
+ from  date_dim dt 
+      ,store_sales
+      ,item
+ where dt.d_date_sk = store_sales.ss_sold_date_sk
+   and store_sales.ss_item_sk = item.i_item_sk
+   and item.i_manufact_id = 436
+   and dt.d_moy=12
+ group by dt.d_year
+      ,item.i_brand
+      ,item.i_brand_id
+ order by dt.d_year
+         ,sum_agg desc
+         ,brand_id
+ limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  dt.d_year 
+       ,item.i_brand_id brand_id 
+       ,item.i_brand brand
+       ,sum(ss_ext_sales_price) sum_agg
+ from  date_dim dt 
+      ,store_sales
+      ,item
+ where dt.d_date_sk = store_sales.ss_sold_date_sk
+   and store_sales.ss_item_sk = item.i_item_sk
+   and item.i_manufact_id = 436
+   and dt.d_moy=12
+ group by dt.d_year
+      ,item.i_brand
+      ,item.i_brand_id
+ order by dt.d_year
+         ,sum_agg desc
+         ,brand_id
+ limit 100
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Spark
+      Edges:
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 400), Map 6 (PARTITION-LEVEL 
SORT, 400)
+        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 438), Reducer 2 
(PARTITION-LEVEL SORT, 438)
+        Reducer 4 <- Reducer 3 (GROUP, 481)
+        Reducer 5 <- Reducer 4 (SORT, 1)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: store_sales
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (ss_item_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_item_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))
+        Map 6 
+            Map Operator Tree:
+                TableScan
+                  alias: item
+                  Statistics: Num rows: 462000 Data size: 663560457 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((i_manufact_id = 436) and i_item_sk is not 
null) (type: boolean)
+                    Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: i_item_sk (type: int), i_brand_id (type: 
int), i_brand (type: string)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 231000 Data size: 331780228 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 231000 Data size: 331780228 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
string)
+        Map 7 
+            Map Operator Tree:
+                TableScan
+                  alias: dt
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((d_moy = 12) 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_year (type: int)
+                      outputColumnNames: _col0, _col1
+                      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: _col1 (type: int)
+        Reducer 2 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0, _col2, _col4, _col5
+                Statistics: Num rows: 633595212 Data size: 55895953508 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: 633595212 Data size: 55895953508 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: 
int), _col5 (type: string)
+        Reducer 3 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col2, _col4, _col5, _col8
+                Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col8 (type: int), _col4 (type: int), _col5 (type: 
string)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: int), 
_col2 (type: string)
+                    sort order: +++
+                    Map-reduce partition columns: _col0 (type: int), _col1 
(type: int), _col2 (type: string)
+                    Statistics: Num rows: 696954748 Data size: 61485550191 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col3 (type: decimal(17,2))
+        Reducer 4 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 
(type: string)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 348477374 Data size: 30742775095 Basic 
stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col3 (type: 
decimal(17,2)), _col1 (type: int)
+                  sort order: +-+
+                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic 
stats: COMPLETE Column stats: NONE
+                  TopN Hash Memory Usage: 0.1
+                  value expressions: _col2 (type: string)
+        Reducer 5 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), 
KEY.reducesinkkey2 (type: int), VALUE._col0 (type: string), KEY.reducesinkkey1 
(type: decimal(17,2))
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 348477374 Data size: 30742775095 Basic 
stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 100
+                  Statistics: Num rows: 100 Data size: 8800 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 100 Data size: 8800 Basic stats: 
COMPLETE Column stats: NONE
+                    table:
+                        input format: 
org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: 
org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 100
+      Processor Tree:
+        ListSink
+

http://git-wip-us.apache.org/repos/asf/hive/blob/bd371246/ql/src/test/results/clientpositive/perf/spark/query30.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query30.q.out 
b/ql/src/test/results/clientpositive/perf/spark/query30.q.out
new file mode 100644
index 0000000..7a0c78d
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/spark/query30.q.out
@@ -0,0 +1,424 @@
+PREHOOK: query: explain
+with customer_total_return as
+ (select wr_returning_customer_sk as ctr_customer_sk
+        ,ca_state as ctr_state, 
+       sum(wr_return_amt) as ctr_total_return
+ from web_returns
+     ,date_dim
+     ,customer_address
+ where wr_returned_date_sk = d_date_sk 
+   and d_year =2002
+   and wr_returning_addr_sk = ca_address_sk 
+ group by wr_returning_customer_sk
+         ,ca_state)
+  select  
c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag
+       
,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address
+       ,c_last_review_date,ctr_total_return
+ from customer_total_return ctr1
+     ,customer_address
+     ,customer
+ where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2
+                         from customer_total_return ctr2 
+                         where ctr1.ctr_state = ctr2.ctr_state)
+       and ca_address_sk = c_current_addr_sk
+       and ca_state = 'IL'
+       and ctr1.ctr_customer_sk = c_customer_sk
+ order by 
c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag
+                  
,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address
+                  ,c_last_review_date,ctr_total_return
+limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+with customer_total_return as
+ (select wr_returning_customer_sk as ctr_customer_sk
+        ,ca_state as ctr_state, 
+       sum(wr_return_amt) as ctr_total_return
+ from web_returns
+     ,date_dim
+     ,customer_address
+ where wr_returned_date_sk = d_date_sk 
+   and d_year =2002
+   and wr_returning_addr_sk = ca_address_sk 
+ group by wr_returning_customer_sk
+         ,ca_state)
+  select  
c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag
+       
,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address
+       ,c_last_review_date,ctr_total_return
+ from customer_total_return ctr1
+     ,customer_address
+     ,customer
+ where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2
+                         from customer_total_return ctr2 
+                         where ctr1.ctr_state = ctr2.ctr_state)
+       and ca_address_sk = c_current_addr_sk
+       and ca_state = 'IL'
+       and ctr1.ctr_customer_sk = c_customer_sk
+ order by 
c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag
+                  
,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address
+                  ,c_last_review_date,ctr_total_return
+limit 100
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Spark
+      Edges:
+        Reducer 10 <- Reducer 16 (PARTITION-LEVEL SORT, 262), Reducer 9 
(PARTITION-LEVEL SORT, 262)
+        Reducer 14 <- Map 13 (PARTITION-LEVEL SORT, 11), Map 17 
(PARTITION-LEVEL SORT, 11)
+        Reducer 15 <- Map 18 (PARTITION-LEVEL SORT, 329), Reducer 14 
(PARTITION-LEVEL SORT, 329)
+        Reducer 16 <- Reducer 15 (GROUP PARTITION-LEVEL SORT, 349)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 697), Map 5 (PARTITION-LEVEL 
SORT, 697)
+        Reducer 3 <- Reducer 10 (PARTITION-LEVEL SORT, 656), Reducer 2 
(PARTITION-LEVEL SORT, 656)
+        Reducer 4 <- Reducer 3 (SORT, 1)
+        Reducer 7 <- Map 11 (PARTITION-LEVEL SORT, 11), Map 6 (PARTITION-LEVEL 
SORT, 11)
+        Reducer 8 <- Map 12 (PARTITION-LEVEL SORT, 329), Reducer 7 
(PARTITION-LEVEL SORT, 329)
+        Reducer 9 <- Reducer 8 (GROUP, 349)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: customer
+                  Statistics: Num rows: 80000000 Data size: 68801615852 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (c_current_addr_sk is not null and 
c_customer_sk is not null) (type: boolean)
+                    Statistics: Num rows: 80000000 Data size: 68801615852 
Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: c_customer_sk (type: int), c_customer_id 
(type: string), c_current_addr_sk (type: int), c_salutation (type: string), 
c_first_name (type: string), c_last_name (type: string), c_preferred_cust_flag 
(type: string), c_birth_day (type: int), c_birth_month (type: int), 
c_birth_year (type: int), c_birth_country (type: string), c_login (type: 
string), c_email_address (type: string), c_last_review_date (type: string)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                      Statistics: Num rows: 80000000 Data size: 68801615852 
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: 80000000 Data size: 68801615852 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: int), _col1 (type: 
string), _col3 (type: string), _col4 (type: string), _col5 (type: string), 
_col6 (type: string), _col7 (type: int), _col8 (type: int), _col9 (type: int), 
_col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 
(type: string)
+        Map 11 
+            Map Operator Tree:
+                TableScan
+                  alias: date_dim
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((d_year = 2002) and d_date_sk is not null) 
(type: boolean)
+                    Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                    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
+        Map 12 
+            Map Operator Tree:
+                TableScan
+                  alias: customer_address
+                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ca_address_sk is not null (type: boolean)
+                    Statistics: Num rows: 40000000 Data size: 40595195284 
Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ca_address_sk (type: int), ca_state (type: 
string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 40000000 Data size: 40595195284 
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: 40000000 Data size: 40595195284 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
+        Map 13 
+            Map Operator Tree:
+                TableScan
+                  alias: web_returns
+                  Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (wr_returned_date_sk is not null and 
wr_returning_addr_sk is not null) (type: boolean)
+                    Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: wr_returned_date_sk (type: int), 
wr_returning_customer_sk (type: int), wr_returning_addr_sk (type: int), 
wr_return_amt (type: decimal(7,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: decimal(7,2))
+        Map 17 
+            Map Operator Tree:
+                TableScan
+                  alias: date_dim
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((d_year = 2002) and d_date_sk is not null) 
(type: boolean)
+                    Statistics: Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                    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
+        Map 18 
+            Map Operator Tree:
+                TableScan
+                  alias: customer_address
+                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (ca_address_sk is not null and ca_state is not 
null) (type: boolean)
+                    Statistics: Num rows: 40000000 Data size: 40595195284 
Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ca_address_sk (type: int), ca_state (type: 
string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 40000000 Data size: 40595195284 
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: 40000000 Data size: 40595195284 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
+        Map 5 
+            Map Operator Tree:
+                TableScan
+                  alias: customer_address
+                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((ca_state = 'IL') 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)
+                      outputColumnNames: _col0
+                      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
+        Map 6 
+            Map Operator Tree:
+                TableScan
+                  alias: web_returns
+                  Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (wr_returned_date_sk is not null and 
wr_returning_addr_sk is not null and wr_returning_customer_sk is not null) 
(type: boolean)
+                    Statistics: Num rows: 14398467 Data size: 1325194184 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: wr_returned_date_sk (type: int), 
wr_returning_customer_sk (type: int), wr_returning_addr_sk (type: int), 
wr_return_amt (type: decimal(7,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 14398467 Data size: 1325194184 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: 
int), _col3 (type: decimal(7,2))
+        Reducer 10 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: string)
+                  1 _col2 (type: string)
+                outputColumnNames: _col0, _col2, _col3, _col4
+                Statistics: Num rows: 24200000 Data size: 24560094211 Basic 
stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (_col2 > CASE WHEN (_col4 is null) THEN (null) 
ELSE (_col3) END) (type: boolean)
+                  Statistics: Num rows: 8066666 Data size: 8186697393 Basic 
stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col0 (type: int), _col2 (type: decimal(17,2))
+                    outputColumnNames: _col0, _col2
+                    Statistics: Num rows: 8066666 Data size: 8186697393 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: 8066666 Data size: 8186697393 
Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col2 (type: decimal(17,2))
+        Reducer 14 
+            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
+                Statistics: Num rows: 15838314 Data size: 1457713633 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: 15838314 Data size: 1457713633 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col3 (type: 
decimal(7,2))
+        Reducer 15 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col2 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col1, _col3, _col7
+                Statistics: Num rows: 44000000 Data size: 44654715780 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col3)
+                  keys: _col7 (type: string), _col1 (type: int)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 44000000 Data size: 44654715780 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 44000000 Data size: 44654715780 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col2 (type: decimal(17,2))
+        Reducer 16 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: string), KEY._col1 (type: int)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 22000000 Data size: 22327357890 Basic 
stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col0 (type: string), _col2 (type: 
decimal(17,2))
+                  outputColumnNames: _col0, _col2
+                  Statistics: Num rows: 22000000 Data size: 22327357890 Basic 
stats: COMPLETE Column stats: NONE
+                  Group By Operator
+                    aggregations: avg(_col2)
+                    keys: _col0 (type: string)
+                    mode: complete
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 11000000 Data size: 11163678945 
Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: (_col1 * 1.2) (type: decimal(24,7)), true 
(type: boolean), _col0 (type: string)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 11000000 Data size: 11163678945 
Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col2 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col2 (type: string)
+                        Statistics: Num rows: 11000000 Data size: 11163678945 
Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: decimal(24,7)), _col1 
(type: boolean)
+        Reducer 2 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col2 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6, 
_col7, _col8, _col9, _col10, _col11, _col12, _col13
+                Statistics: Num rows: 88000001 Data size: 75681779077 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: 88000001 Data size: 75681779077 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string), _col3 (type: 
string), _col4 (type: string), _col5 (type: string), _col6 (type: string), 
_col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: string), 
_col11 (type: string), _col12 (type: string), _col13 (type: string)
+        Reducer 3 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, 
_col8, _col9, _col10, _col11, _col12, _col13, _col18
+                Statistics: Num rows: 96800003 Data size: 83249958789 Basic 
stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: string), _col3 (type: string), 
_col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: 
int), _col8 (type: int), _col9 (type: int), _col10 (type: string), _col11 
(type: string), _col12 (type: string), _col13 (type: string), _col18 (type: 
decimal(17,2))
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
+                  Statistics: Num rows: 96800003 Data size: 83249958789 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: int), _col6 (type: int), _col7 (type: int), _col8 (type: string), 
_col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 
(type: decimal(17,2))
+                    sort order: +++++++++++++
+                    Statistics: Num rows: 96800003 Data size: 83249958789 
Basic stats: COMPLETE Column stats: NONE
+                    TopN Hash Memory Usage: 0.1
+        Reducer 4 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: string), 
KEY.reducesinkkey1 (type: string), KEY.reducesinkkey2 (type: string), 
KEY.reducesinkkey3 (type: string), KEY.reducesinkkey4 (type: string), 
KEY.reducesinkkey5 (type: int), KEY.reducesinkkey6 (type: int), 
KEY.reducesinkkey7 (type: int), KEY.reducesinkkey8 (type: string), 
KEY.reducesinkkey9 (type: string), KEY.reducesinkkey10 (type: string), 
KEY.reducesinkkey11 (type: string), KEY.reducesinkkey12 (type: decimal(17,2))
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12
+                Statistics: Num rows: 96800003 Data size: 83249958789 Basic 
stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 100
+                  Statistics: Num rows: 100 Data size: 86000 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 100 Data size: 86000 Basic stats: 
COMPLETE Column stats: NONE
+                    table:
+                        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 7 
+            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
+                Statistics: Num rows: 15838314 Data size: 1457713633 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: 15838314 Data size: 1457713633 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col3 (type: 
decimal(7,2))
+        Reducer 8 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col2 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col1, _col3, _col7
+                Statistics: Num rows: 44000000 Data size: 44654715780 Basic 
stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col3)
+                  keys: _col7 (type: string), _col1 (type: int)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 44000000 Data size: 44654715780 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: string), _col1 
(type: int)
+                    Statistics: Num rows: 44000000 Data size: 44654715780 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col2 (type: decimal(17,2))
+        Reducer 9 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: string), KEY._col1 (type: int)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 22000000 Data size: 22327357890 Basic 
stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: int), _col0 (type: string), _col2 
(type: decimal(17,2))
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 22000000 Data size: 22327357890 Basic 
stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col1 (type: string)
+                    Statistics: Num rows: 22000000 Data size: 22327357890 
Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: int), _col2 (type: 
decimal(17,2))
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 100
+      Processor Tree:
+        ListSink
+

Reply via email to