You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2017/10/03 22:55:19 UTC

[13/50] [abbrv] hive git commit: HIVE-17543: Enable PerfCliDriver for HoS (Sahil Takiar, reviewed by Peter Vary) (addendum)

http://git-wip-us.apache.org/repos/asf/hive/blob/9244fdc7/ql/src/test/results/clientpositive/perf/tez/query45.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query45.q.out b/ql/src/test/results/clientpositive/perf/tez/query45.q.out
new file mode 100644
index 0000000..3efed2e
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/tez/query45.q.out
@@ -0,0 +1,180 @@
+Warning: Shuffle Join MERGEJOIN[87][tables = [$hdt$_0, $hdt$_1, $hdt$_2, $hdt$_3]] in Stage 'Reducer 4' is a cross product
+PREHOOK: query: explain
+select  ca_zip, ca_county, sum(ws_sales_price)
+ from web_sales, customer, customer_address, date_dim, item
+ where ws_bill_customer_sk = c_customer_sk
+ 	and c_current_addr_sk = ca_address_sk 
+ 	and ws_item_sk = i_item_sk 
+ 	and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792')
+ 	      or 
+ 	      i_item_id in (select i_item_id
+                             from item
+                             where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
+                             )
+ 	    )
+ 	and ws_sold_date_sk = d_date_sk
+ 	and d_qoy = 2 and d_year = 2000
+ group by ca_zip, ca_county
+ order by ca_zip, ca_county
+ limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  ca_zip, ca_county, sum(ws_sales_price)
+ from web_sales, customer, customer_address, date_dim, item
+ where ws_bill_customer_sk = c_customer_sk
+ 	and c_current_addr_sk = ca_address_sk 
+ 	and ws_item_sk = i_item_sk 
+ 	and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792')
+ 	      or 
+ 	      i_item_id in (select i_item_id
+                             from item
+                             where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
+                             )
+ 	    )
+ 	and ws_sold_date_sk = d_date_sk
+ 	and d_qoy = 2 and d_year = 2000
+ group by ca_zip, ca_county
+ order by ca_zip, ca_county
+ limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 10 <- Reducer 14 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 8 (SIMPLE_EDGE)
+Reducer 12 <- Map 8 (CUSTOM_SIMPLE_EDGE)
+Reducer 14 <- Map 13 (SIMPLE_EDGE), Map 15 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 10 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 12 (CUSTOM_SIMPLE_EDGE), Reducer 3 (CUSTOM_SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 9 <- Map 8 (SIMPLE_EDGE), Reducer 11 (ONE_TO_ONE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:100
+    Stage-1
+      Reducer 6
+      File Output Operator [FS_59]
+        Limit [LIM_58] (rows=100 width=152)
+          Number of rows:100
+          Select Operator [SEL_57] (rows=95833781 width=152)
+            Output:["_col0","_col1","_col2"]
+          <-Reducer 5 [SIMPLE_EDGE]
+            SHUFFLE [RS_56]
+              Group By Operator [GBY_54] (rows=95833781 width=152)
+                Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1
+              <-Reducer 4 [SIMPLE_EDGE]
+                SHUFFLE [RS_53]
+                  PartitionCols:_col0, _col1
+                  Group By Operator [GBY_52] (rows=191667562 width=152)
+                    Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col8, _col7
+                    Select Operator [SEL_51] (rows=191667562 width=152)
+                      Output:["_col3","_col7","_col8"]
+                      Filter Operator [FIL_50] (rows=191667562 width=152)
+                        predicate:((substr(_col8, 1, 5)) IN ('85669', '86197', '88274', '83405', '86475', '85392', '85460', '80348', '81792') or CASE WHEN ((_col14 = 0)) THEN (false) WHEN (_col17 is not null) THEN (true) WHEN (_col13 is null) THEN (null) WHEN ((_col15 < _col14)) THEN (null) ELSE (false) END)
+                        Select Operator [SEL_49] (rows=191667562 width=152)
+                          Output:["_col3","_col7","_col8","_col13","_col14","_col15","_col17"]
+                          Merge Join Operator [MERGEJOIN_87] (rows=191667562 width=152)
+                            Conds:(Inner),Output:["_col3","_col4","_col6","_col8","_col12","_col16","_col17"]
+                          <-Reducer 12 [CUSTOM_SIMPLE_EDGE]
+                            PARTITION_ONLY_SHUFFLE [RS_47]
+                              Group By Operator [GBY_38] (rows=1 width=16)
+                                Output:["_col0","_col1"],aggregations:["count(VALUE._col0)","count(VALUE._col1)"]
+                              <-Map 8 [CUSTOM_SIMPLE_EDGE]
+                                SHUFFLE [RS_37]
+                                  Group By Operator [GBY_36] (rows=1 width=16)
+                                    Output:["_col0","_col1"],aggregations:["count()","count(i_item_id)"]
+                                    Select Operator [SEL_35] (rows=231000 width=1436)
+                                      Output:["i_item_id"]
+                                      Filter Operator [FIL_81] (rows=231000 width=1436)
+                                        predicate:(i_item_sk) IN (2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
+                                        TableScan [TS_6] (rows=462000 width=1436)
+                                          default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_id"]
+                          <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
+                            PARTITION_ONLY_SHUFFLE [RS_46]
+                              Merge Join Operator [MERGEJOIN_86] (rows=191667562 width=135)
+                                Conds:RS_43._col0=RS_44._col6(Inner),Output:["_col3","_col4","_col6","_col8","_col12"]
+                              <-Reducer 10 [SIMPLE_EDGE]
+                                SHUFFLE [RS_44]
+                                  PartitionCols:_col6
+                                  Merge Join Operator [MERGEJOIN_85] (rows=174243235 width=135)
+                                    Conds:RS_29._col0=RS_30._col1(Inner),Output:["_col1","_col3","_col6","_col7"]
+                                  <-Reducer 14 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_30]
+                                      PartitionCols:_col1
+                                      Merge Join Operator [MERGEJOIN_84] (rows=158402938 width=135)
+                                        Conds:RS_22._col0=RS_23._col0(Inner),Output:["_col1","_col2","_col3"]
+                                      <-Map 13 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_22]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_18] (rows=144002668 width=135)
+                                            Output:["_col0","_col1","_col2","_col3"]
+                                            Filter Operator [FIL_79] (rows=144002668 width=135)
+                                              predicate:(ws_bill_customer_sk is not null and ws_item_sk is not null and ws_sold_date_sk is not null)
+                                              TableScan [TS_16] (rows=144002668 width=135)
+                                                default@web_sales,web_sales,Tbl:COMPLETE,Col:NONE,Output:["ws_sold_date_sk","ws_item_sk","ws_bill_customer_sk","ws_sales_price"]
+                                      <-Map 15 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_23]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_21] (rows=18262 width=1119)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_80] (rows=18262 width=1119)
+                                              predicate:((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null)
+                                              TableScan [TS_19] (rows=73049 width=1119)
+                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_qoy"]
+                                  <-Reducer 9 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_29]
+                                      PartitionCols:_col0
+                                      Merge Join Operator [MERGEJOIN_83] (rows=508200 width=1436)
+                                        Conds:RS_26._col1=RS_27._col0(Left Outer),Output:["_col0","_col1","_col3"]
+                                      <-Map 8 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_26]
+                                          PartitionCols:_col1
+                                          Select Operator [SEL_8] (rows=462000 width=1436)
+                                            Output:["_col0","_col1"]
+                                            Filter Operator [FIL_77] (rows=462000 width=1436)
+                                              predicate:i_item_sk is not null
+                                               Please refer to the previous TableScan [TS_6]
+                                      <-Reducer 11 [ONE_TO_ONE_EDGE]
+                                        FORWARD [RS_27]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_15] (rows=115500 width=1436)
+                                            Output:["_col0","_col1"]
+                                            Group By Operator [GBY_14] (rows=115500 width=1436)
+                                              Output:["_col0"],keys:KEY._col0
+                                            <-Map 8 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_13]
+                                                PartitionCols:_col0
+                                                Group By Operator [GBY_12] (rows=231000 width=1436)
+                                                  Output:["_col0"],keys:i_item_id
+                                                  Select Operator [SEL_11] (rows=231000 width=1436)
+                                                    Output:["i_item_id"]
+                                                    Filter Operator [FIL_78] (rows=231000 width=1436)
+                                                      predicate:(i_item_sk) IN (2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
+                                                       Please refer to the previous TableScan [TS_6]
+                              <-Reducer 2 [SIMPLE_EDGE]
+                                SHUFFLE [RS_43]
+                                  PartitionCols:_col0
+                                  Merge Join Operator [MERGEJOIN_82] (rows=88000001 width=860)
+                                    Conds:RS_40._col1=RS_41._col0(Inner),Output:["_col0","_col3","_col4"]
+                                  <-Map 1 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_40]
+                                      PartitionCols:_col1
+                                      Select Operator [SEL_2] (rows=80000000 width=860)
+                                        Output:["_col0","_col1"]
+                                        Filter Operator [FIL_75] (rows=80000000 width=860)
+                                          predicate:(c_current_addr_sk is not null and c_customer_sk is not null)
+                                          TableScan [TS_0] (rows=80000000 width=860)
+                                            default@customer,customer,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk","c_current_addr_sk"]
+                                  <-Map 7 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_41]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_5] (rows=40000000 width=1014)
+                                        Output:["_col0","_col1","_col2"]
+                                        Filter Operator [FIL_76] (rows=40000000 width=1014)
+                                          predicate:ca_address_sk is not null
+                                          TableScan [TS_3] (rows=40000000 width=1014)
+                                            default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_county","ca_zip"]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/9244fdc7/ql/src/test/results/clientpositive/perf/tez/query46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query46.q.out b/ql/src/test/results/clientpositive/perf/tez/query46.q.out
new file mode 100644
index 0000000..1a193ed
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/tez/query46.q.out
@@ -0,0 +1,191 @@
+PREHOOK: query: explain
+select  c_last_name
+       ,c_first_name
+       ,ca_city
+       ,bought_city
+       ,ss_ticket_number
+       ,amt,profit 
+ from
+   (select ss_ticket_number
+          ,ss_customer_sk
+          ,ca_city bought_city
+          ,sum(ss_coupon_amt) amt
+          ,sum(ss_net_profit) profit
+    from store_sales,date_dim,store,household_demographics,customer_address 
+    where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+    and store_sales.ss_store_sk = store.s_store_sk  
+    and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+    and store_sales.ss_addr_sk = customer_address.ca_address_sk
+    and (household_demographics.hd_dep_count = 2 or
+         household_demographics.hd_vehicle_count= 1)
+    and date_dim.d_dow in (6,0)
+    and date_dim.d_year in (1998,1998+1,1998+2) 
+    and store.s_city in ('Cedar Grove','Wildwood','Union','Salem','Highland Park') 
+    group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr
+    where ss_customer_sk = c_customer_sk
+      and customer.c_current_addr_sk = current_addr.ca_address_sk
+      and current_addr.ca_city <> bought_city
+  order by c_last_name
+          ,c_first_name
+          ,ca_city
+          ,bought_city
+          ,ss_ticket_number
+  limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  c_last_name
+       ,c_first_name
+       ,ca_city
+       ,bought_city
+       ,ss_ticket_number
+       ,amt,profit 
+ from
+   (select ss_ticket_number
+          ,ss_customer_sk
+          ,ca_city bought_city
+          ,sum(ss_coupon_amt) amt
+          ,sum(ss_net_profit) profit
+    from store_sales,date_dim,store,household_demographics,customer_address 
+    where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+    and store_sales.ss_store_sk = store.s_store_sk  
+    and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+    and store_sales.ss_addr_sk = customer_address.ca_address_sk
+    and (household_demographics.hd_dep_count = 2 or
+         household_demographics.hd_vehicle_count= 1)
+    and date_dim.d_dow in (6,0)
+    and date_dim.d_year in (1998,1998+1,1998+2) 
+    and store.s_city in ('Cedar Grove','Wildwood','Union','Salem','Highland Park') 
+    group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr
+    where ss_customer_sk = c_customer_sk
+      and customer.c_current_addr_sk = current_addr.ca_address_sk
+      and current_addr.ca_city <> bought_city
+  order by c_last_name
+          ,c_first_name
+          ,ca_city
+          ,bought_city
+          ,ss_ticket_number
+  limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 10 <- Map 13 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 14 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 6 <- Map 5 (SIMPLE_EDGE), Reducer 11 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+Reducer 9 <- Map 12 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:100
+    Stage-1
+      Reducer 4
+      File Output Operator [FS_50]
+        Limit [LIM_49] (rows=100 width=88)
+          Number of rows:100
+          Select Operator [SEL_48] (rows=463823414 width=88)
+            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+          <-Reducer 3 [SIMPLE_EDGE]
+            SHUFFLE [RS_47]
+              Select Operator [SEL_46] (rows=463823414 width=88)
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                Filter Operator [FIL_45] (rows=463823414 width=88)
+                  predicate:(_col5 <> _col8)
+                  Merge Join Operator [MERGEJOIN_86] (rows=463823414 width=88)
+                    Conds:RS_42._col0=RS_43._col1(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9","_col10"]
+                  <-Reducer 2 [SIMPLE_EDGE]
+                    SHUFFLE [RS_42]
+                      PartitionCols:_col0
+                      Merge Join Operator [MERGEJOIN_81] (rows=88000001 width=860)
+                        Conds:RS_39._col1=RS_40._col0(Inner),Output:["_col0","_col2","_col3","_col5"]
+                      <-Map 5 [SIMPLE_EDGE]
+                        SHUFFLE [RS_40]
+                          PartitionCols:_col0
+                          Select Operator [SEL_5] (rows=40000000 width=1014)
+                            Output:["_col0","_col1"]
+                            Filter Operator [FIL_75] (rows=40000000 width=1014)
+                              predicate:ca_address_sk is not null
+                              TableScan [TS_3] (rows=40000000 width=1014)
+                                default@customer_address,current_addr,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_city"]
+                      <-Map 1 [SIMPLE_EDGE]
+                        SHUFFLE [RS_39]
+                          PartitionCols:_col1
+                          Select Operator [SEL_2] (rows=80000000 width=860)
+                            Output:["_col0","_col1","_col2","_col3"]
+                            Filter Operator [FIL_74] (rows=80000000 width=860)
+                              predicate:(c_current_addr_sk is not null and c_customer_sk is not null)
+                              TableScan [TS_0] (rows=80000000 width=860)
+                                default@customer,customer,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk","c_current_addr_sk","c_first_name","c_last_name"]
+                  <-Reducer 7 [SIMPLE_EDGE]
+                    SHUFFLE [RS_43]
+                      PartitionCols:_col1
+                      Select Operator [SEL_37] (rows=421657640 width=88)
+                        Output:["_col0","_col1","_col2","_col3","_col4"]
+                        Group By Operator [GBY_36] (rows=421657640 width=88)
+                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3
+                        <-Reducer 6 [SIMPLE_EDGE]
+                          SHUFFLE [RS_35]
+                            PartitionCols:_col0, _col1, _col2, _col3
+                            Group By Operator [GBY_34] (rows=843315281 width=88)
+                              Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","sum(_col7)"],keys:_col1, _col17, _col3, _col5
+                              Merge Join Operator [MERGEJOIN_85] (rows=843315281 width=88)
+                                Conds:RS_30._col3=RS_31._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col17"]
+                              <-Map 5 [SIMPLE_EDGE]
+                                SHUFFLE [RS_31]
+                                  PartitionCols:_col0
+                                   Please refer to the previous Select Operator [SEL_5]
+                              <-Reducer 11 [SIMPLE_EDGE]
+                                SHUFFLE [RS_30]
+                                  PartitionCols:_col3
+                                  Merge Join Operator [MERGEJOIN_84] (rows=766650239 width=88)
+                                    Conds:RS_27._col2=RS_28._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7"]
+                                  <-Map 14 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_28]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_17] (rows=7200 width=107)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_79] (rows=7200 width=107)
+                                          predicate:(((hd_dep_count = 2) or (hd_vehicle_count = 1)) and hd_demo_sk is not null)
+                                          TableScan [TS_15] (rows=7200 width=107)
+                                            default@household_demographics,household_demographics,Tbl:COMPLETE,Col:NONE,Output:["hd_demo_sk","hd_dep_count","hd_vehicle_count"]
+                                  <-Reducer 10 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_27]
+                                      PartitionCols:_col2
+                                      Merge Join Operator [MERGEJOIN_83] (rows=696954748 width=88)
+                                        Conds:RS_24._col4=RS_25._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col7"]
+                                      <-Map 13 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_25]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_14] (rows=852 width=1910)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_78] (rows=852 width=1910)
+                                              predicate:((s_city) IN ('Cedar Grove', 'Wildwood', 'Union', 'Salem', 'Highland Park') and s_store_sk is not null)
+                                              TableScan [TS_12] (rows=1704 width=1910)
+                                                default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_city"]
+                                      <-Reducer 9 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_24]
+                                          PartitionCols:_col4
+                                          Merge Join Operator [MERGEJOIN_82] (rows=633595212 width=88)
+                                            Conds:RS_21._col0=RS_22._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                          <-Map 12 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_22]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_11] (rows=18263 width=1119)
+                                                Output:["_col0"]
+                                                Filter Operator [FIL_77] (rows=18263 width=1119)
+                                                  predicate:((d_dow) IN (6, 0) and (d_year) IN (1998, 1999, 2000) and d_date_sk is not null)
+                                                  TableScan [TS_9] (rows=73049 width=1119)
+                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_dow"]
+                                          <-Map 8 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_21]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_8] (rows=575995635 width=88)
+                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                                Filter Operator [FIL_76] (rows=575995635 width=88)
+                                                  predicate:(ss_addr_sk is not null and ss_customer_sk is not null and ss_hdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                                  TableScan [TS_6] (rows=575995635 width=88)
+                                                    default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_customer_sk","ss_hdemo_sk","ss_addr_sk","ss_store_sk","ss_ticket_number","ss_coupon_amt","ss_net_profit"]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/9244fdc7/ql/src/test/results/clientpositive/perf/tez/query47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query47.q.out b/ql/src/test/results/clientpositive/perf/tez/query47.q.out
new file mode 100644
index 0000000..1288408
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/tez/query47.q.out
@@ -0,0 +1,325 @@
+PREHOOK: query: explain
+with v1 as(
+ select i_category, i_brand,
+        s_store_name, s_company_name,
+        d_year, d_moy,
+        sum(ss_sales_price) sum_sales,
+        avg(sum(ss_sales_price)) over
+          (partition by i_category, i_brand,
+                     s_store_name, s_company_name, d_year)
+          avg_monthly_sales,
+        rank() over
+          (partition by i_category, i_brand,
+                     s_store_name, s_company_name
+           order by d_year, d_moy) rn
+ from item, store_sales, date_dim, store
+ where ss_item_sk = i_item_sk and
+       ss_sold_date_sk = d_date_sk and
+       ss_store_sk = s_store_sk and
+       (
+         d_year = 2000 or
+         ( d_year = 2000-1 and d_moy =12) or
+         ( d_year = 2000+1 and d_moy =1)
+       )
+ group by i_category, i_brand,
+          s_store_name, s_company_name,
+          d_year, d_moy),
+ v2 as(
+ select v1.i_category
+        ,v1.d_year, v1.d_moy
+        ,v1.avg_monthly_sales
+        ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum
+ from v1, v1 v1_lag, v1 v1_lead
+ where v1.i_category = v1_lag.i_category and
+       v1.i_category = v1_lead.i_category and
+       v1.i_brand = v1_lag.i_brand and
+       v1.i_brand = v1_lead.i_brand and
+       v1.s_store_name = v1_lag.s_store_name and
+       v1.s_store_name = v1_lead.s_store_name and
+       v1.s_company_name = v1_lag.s_company_name and
+       v1.s_company_name = v1_lead.s_company_name and
+       v1.rn = v1_lag.rn + 1 and
+       v1.rn = v1_lead.rn - 1)
+  select  *
+ from v2
+ where  d_year = 2000 and    
+        avg_monthly_sales > 0 and
+        case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1
+ order by sum_sales - avg_monthly_sales, 3
+ limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+with v1 as(
+ select i_category, i_brand,
+        s_store_name, s_company_name,
+        d_year, d_moy,
+        sum(ss_sales_price) sum_sales,
+        avg(sum(ss_sales_price)) over
+          (partition by i_category, i_brand,
+                     s_store_name, s_company_name, d_year)
+          avg_monthly_sales,
+        rank() over
+          (partition by i_category, i_brand,
+                     s_store_name, s_company_name
+           order by d_year, d_moy) rn
+ from item, store_sales, date_dim, store
+ where ss_item_sk = i_item_sk and
+       ss_sold_date_sk = d_date_sk and
+       ss_store_sk = s_store_sk and
+       (
+         d_year = 2000 or
+         ( d_year = 2000-1 and d_moy =12) or
+         ( d_year = 2000+1 and d_moy =1)
+       )
+ group by i_category, i_brand,
+          s_store_name, s_company_name,
+          d_year, d_moy),
+ v2 as(
+ select v1.i_category
+        ,v1.d_year, v1.d_moy
+        ,v1.avg_monthly_sales
+        ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum
+ from v1, v1 v1_lag, v1 v1_lead
+ where v1.i_category = v1_lag.i_category and
+       v1.i_category = v1_lead.i_category and
+       v1.i_brand = v1_lag.i_brand and
+       v1.i_brand = v1_lead.i_brand and
+       v1.s_store_name = v1_lag.s_store_name and
+       v1.s_store_name = v1_lead.s_store_name and
+       v1.s_company_name = v1_lag.s_company_name and
+       v1.s_company_name = v1_lead.s_company_name and
+       v1.rn = v1_lag.rn + 1 and
+       v1.rn = v1_lead.rn - 1)
+  select  *
+ from v2
+ where  d_year = 2000 and    
+        avg_monthly_sales > 0 and
+        case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1
+ order by sum_sales - avg_monthly_sales, 3
+ limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 10 <- Map 21 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 22 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
+Reducer 12 <- Reducer 11 (SIMPLE_EDGE)
+Reducer 13 <- Reducer 12 (SIMPLE_EDGE)
+Reducer 14 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
+Reducer 15 <- Map 21 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
+Reducer 16 <- Map 22 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE)
+Reducer 17 <- Reducer 16 (SIMPLE_EDGE)
+Reducer 18 <- Reducer 17 (SIMPLE_EDGE)
+Reducer 19 <- Reducer 18 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
+Reducer 3 <- Map 21 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 22 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 13 (SIMPLE_EDGE), Reducer 19 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
+Reducer 8 <- Reducer 7 (SIMPLE_EDGE)
+Reducer 9 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:-1
+    Stage-1
+      Reducer 8
+      File Output Operator [FS_112]
+        Limit [LIM_110] (rows=100 width=88)
+          Number of rows:100
+          Select Operator [SEL_109] (rows=843315280 width=88)
+            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+          <-Reducer 7 [SIMPLE_EDGE]
+            SHUFFLE [RS_108]
+              Select Operator [SEL_107] (rows=843315280 width=88)
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                Merge Join Operator [MERGEJOIN_189] (rows=843315280 width=88)
+                  Conds:RS_103._col0, _col1, _col2, _col3, (_col7 + 1)=RS_104._col0, _col1, _col2, _col3, _col8(Inner),RS_104._col0, _col1, _col2, _col3, _col8=RS_105._col0, _col1, _col2, _col3, (_col7 - 1)(Inner),Output:["_col6","_col8","_col12","_col13","_col14","_col15","_col23"]
+                <-Reducer 13 [SIMPLE_EDGE]
+                  SHUFFLE [RS_103]
+                    PartitionCols:_col0, _col1, _col2, _col3, (_col7 + 1)
+                    Select Operator [SEL_29] (rows=383325119 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col6","_col7"]
+                      Filter Operator [FIL_164] (rows=383325119 width=88)
+                        predicate:rank_window_0 is not null
+                        PTF Operator [PTF_28] (rows=383325119 width=88)
+                          Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3"}]
+                          Select Operator [SEL_27] (rows=383325119 width=88)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                          <-Reducer 12 [SIMPLE_EDGE]
+                            SHUFFLE [RS_26]
+                              PartitionCols:_col0, _col1, _col2, _col3
+                              Select Operator [SEL_25] (rows=383325119 width=88)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                Group By Operator [GBY_24] (rows=383325119 width=88)
+                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
+                                <-Reducer 11 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_23]
+                                    PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
+                                    Group By Operator [GBY_22] (rows=766650239 width=88)
+                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col9, _col11, _col12
+                                      Merge Join Operator [MERGEJOIN_182] (rows=766650239 width=88)
+                                        Conds:RS_18._col2=RS_19._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
+                                      <-Map 22 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_19]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_81] (rows=1704 width=1910)
+                                            Output:["_col0","_col1","_col2"]
+                                            Filter Operator [FIL_179] (rows=1704 width=1910)
+                                              predicate:(s_company_name is not null and s_store_name is not null and s_store_sk is not null)
+                                              TableScan [TS_79] (rows=1704 width=1910)
+                                                default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_name","s_company_name"]
+                                      <-Reducer 10 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_18]
+                                          PartitionCols:_col2
+                                          Merge Join Operator [MERGEJOIN_181] (rows=696954748 width=88)
+                                            Conds:RS_15._col1=RS_16._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
+                                          <-Map 21 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_16]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_78] (rows=462000 width=1436)
+                                                Output:["_col0","_col1","_col2"]
+                                                Filter Operator [FIL_178] (rows=462000 width=1436)
+                                                  predicate:(i_brand is not null and i_category is not null and i_item_sk is not null)
+                                                  TableScan [TS_76] (rows=462000 width=1436)
+                                                    default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_brand","i_category"]
+                                          <-Reducer 9 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_15]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_180] (rows=633595212 width=88)
+                                                Conds:RS_12._col0=RS_13._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
+                                              <-Map 1 [SIMPLE_EDGE]
+                                                SHUFFLE [RS_12]
+                                                  PartitionCols:_col0
+                                                  Select Operator [SEL_72] (rows=575995635 width=88)
+                                                    Output:["_col0","_col1","_col2","_col3"]
+                                                    Filter Operator [FIL_176] (rows=575995635 width=88)
+                                                      predicate:(ss_item_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                                      TableScan [TS_70] (rows=575995635 width=88)
+                                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_sales_price"]
+                                              <-Map 20 [SIMPLE_EDGE]
+                                                SHUFFLE [RS_13]
+                                                  PartitionCols:_col0
+                                                  Select Operator [SEL_75] (rows=73048 width=1119)
+                                                    Output:["_col0","_col1","_col2"]
+                                                    Filter Operator [FIL_177] (rows=73048 width=1119)
+                                                      predicate:(((d_year = 2000) or ((d_year = 1999) and (d_moy = 12)) or ((d_year = 2001) and (d_moy = 1))) and d_date_sk is not null)
+                                                      TableScan [TS_73] (rows=73049 width=1119)
+                                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
+                <-Reducer 19 [SIMPLE_EDGE]
+                  SHUFFLE [RS_104]
+                    PartitionCols:_col0, _col1, _col2, _col3, _col8
+                    Select Operator [SEL_67] (rows=31943759 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                      Filter Operator [FIL_169] (rows=31943759 width=88)
+                        predicate:CASE WHEN ((_col0 > 0)) THEN (((abs((_col7 - _col0)) / _col0) > 0.1)) ELSE (null) END
+                        Select Operator [SEL_66] (rows=63887519 width=88)
+                          Output:["rank_window_1","_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                          Filter Operator [FIL_170] (rows=63887519 width=88)
+                            predicate:((_col0 > 0) and (_col5 = 2000) and rank_window_1 is not null)
+                            PTF Operator [PTF_65] (rows=383325119 width=88)
+                              Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col5 ASC NULLS FIRST, _col6 ASC NULLS FIRST","partition by:":"_col1, _col2, _col3, _col4"}]
+                              Select Operator [SEL_64] (rows=383325119 width=88)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                              <-Reducer 18 [SIMPLE_EDGE]
+                                SHUFFLE [RS_63]
+                                  PartitionCols:_col0, _col1, _col2, _col3
+                                  Select Operator [SEL_62] (rows=383325119 width=88)
+                                    Output:["avg_window_0","_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                    PTF Operator [PTF_61] (rows=383325119 width=88)
+                                      Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST, _col2 ASC NULLS FIRST, _col3 ASC NULLS FIRST, _col4 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3, _col4"}]
+                                      Select Operator [SEL_60] (rows=383325119 width=88)
+                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                      <-Reducer 17 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_59]
+                                          PartitionCols:_col0, _col1, _col2, _col3, _col4
+                                          Select Operator [SEL_58] (rows=383325119 width=88)
+                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                            Group By Operator [GBY_57] (rows=383325119 width=88)
+                                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
+                                            <-Reducer 16 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_56]
+                                                PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
+                                                Group By Operator [GBY_55] (rows=766650239 width=88)
+                                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col9, _col11, _col12
+                                                  Merge Join Operator [MERGEJOIN_185] (rows=766650239 width=88)
+                                                    Conds:RS_51._col2=RS_52._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
+                                                  <-Map 22 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_52]
+                                                      PartitionCols:_col0
+                                                       Please refer to the previous Select Operator [SEL_81]
+                                                  <-Reducer 15 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_51]
+                                                      PartitionCols:_col2
+                                                      Merge Join Operator [MERGEJOIN_184] (rows=696954748 width=88)
+                                                        Conds:RS_48._col1=RS_49._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
+                                                      <-Map 21 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_49]
+                                                          PartitionCols:_col0
+                                                           Please refer to the previous Select Operator [SEL_78]
+                                                      <-Reducer 14 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_48]
+                                                          PartitionCols:_col1
+                                                          Merge Join Operator [MERGEJOIN_183] (rows=633595212 width=88)
+                                                            Conds:RS_45._col0=RS_46._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
+                                                          <-Map 1 [SIMPLE_EDGE]
+                                                            SHUFFLE [RS_45]
+                                                              PartitionCols:_col0
+                                                               Please refer to the previous Select Operator [SEL_72]
+                                                          <-Map 20 [SIMPLE_EDGE]
+                                                            SHUFFLE [RS_46]
+                                                              PartitionCols:_col0
+                                                               Please refer to the previous Select Operator [SEL_75]
+                <-Reducer 6 [SIMPLE_EDGE]
+                  SHUFFLE [RS_105]
+                    PartitionCols:_col0, _col1, _col2, _col3, (_col7 - 1)
+                    Select Operator [SEL_99] (rows=383325119 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col6","_col7"]
+                      Filter Operator [FIL_175] (rows=383325119 width=88)
+                        predicate:rank_window_0 is not null
+                        PTF Operator [PTF_98] (rows=383325119 width=88)
+                          Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3"}]
+                          Select Operator [SEL_97] (rows=383325119 width=88)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                          <-Reducer 5 [SIMPLE_EDGE]
+                            SHUFFLE [RS_96]
+                              PartitionCols:_col0, _col1, _col2, _col3
+                              Select Operator [SEL_95] (rows=383325119 width=88)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                Group By Operator [GBY_94] (rows=383325119 width=88)
+                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
+                                <-Reducer 4 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_93]
+                                    PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
+                                    Group By Operator [GBY_92] (rows=766650239 width=88)
+                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col9, _col11, _col12
+                                      Merge Join Operator [MERGEJOIN_188] (rows=766650239 width=88)
+                                        Conds:RS_88._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
+                                      <-Map 22 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_89]
+                                          PartitionCols:_col0
+                                           Please refer to the previous Select Operator [SEL_81]
+                                      <-Reducer 3 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_88]
+                                          PartitionCols:_col2
+                                          Merge Join Operator [MERGEJOIN_187] (rows=696954748 width=88)
+                                            Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
+                                          <-Map 21 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_86]
+                                              PartitionCols:_col0
+                                               Please refer to the previous Select Operator [SEL_78]
+                                          <-Reducer 2 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_85]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_186] (rows=633595212 width=88)
+                                                Conds:RS_82._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
+                                              <-Map 1 [SIMPLE_EDGE]
+                                                SHUFFLE [RS_82]
+                                                  PartitionCols:_col0
+                                                   Please refer to the previous Select Operator [SEL_72]
+                                              <-Map 20 [SIMPLE_EDGE]
+                                                SHUFFLE [RS_83]
+                                                  PartitionCols:_col0
+                                                   Please refer to the previous Select Operator [SEL_75]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/9244fdc7/ql/src/test/results/clientpositive/perf/tez/query48.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query48.q.out b/ql/src/test/results/clientpositive/perf/tez/query48.q.out
new file mode 100644
index 0000000..8db0c1e
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/tez/query48.q.out
@@ -0,0 +1,218 @@
+PREHOOK: query: explain
+select sum (ss_quantity)
+ from store_sales, store, customer_demographics, customer_address, date_dim
+ where s_store_sk = ss_store_sk
+ and  ss_sold_date_sk = d_date_sk and d_year = 1998
+ and  
+ (
+  (
+   cd_demo_sk = ss_cdemo_sk
+   and 
+   cd_marital_status = 'M'
+   and 
+   cd_education_status = '4 yr Degree'
+   and 
+   ss_sales_price between 100.00 and 150.00  
+   )
+ or
+  (
+  cd_demo_sk = ss_cdemo_sk
+   and 
+   cd_marital_status = 'M'
+   and 
+   cd_education_status = '4 yr Degree'
+   and 
+   ss_sales_price between 50.00 and 100.00   
+  )
+ or 
+ (
+  cd_demo_sk = ss_cdemo_sk
+  and 
+   cd_marital_status = 'M'
+   and 
+   cd_education_status = '4 yr Degree'
+   and 
+   ss_sales_price between 150.00 and 200.00  
+ )
+ )
+ and
+ (
+  (
+  ss_addr_sk = ca_address_sk
+  and
+  ca_country = 'United States'
+  and
+  ca_state in ('KY', 'GA', 'NM')
+  and ss_net_profit between 0 and 2000  
+  )
+ or
+  (ss_addr_sk = ca_address_sk
+  and
+  ca_country = 'United States'
+  and
+  ca_state in ('MT', 'OR', 'IN')
+  and ss_net_profit between 150 and 3000 
+  )
+ or
+  (ss_addr_sk = ca_address_sk
+  and
+  ca_country = 'United States'
+  and
+  ca_state in ('WI', 'MO', 'WV')
+  and ss_net_profit between 50 and 25000 
+  )
+ )
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select sum (ss_quantity)
+ from store_sales, store, customer_demographics, customer_address, date_dim
+ where s_store_sk = ss_store_sk
+ and  ss_sold_date_sk = d_date_sk and d_year = 1998
+ and  
+ (
+  (
+   cd_demo_sk = ss_cdemo_sk
+   and 
+   cd_marital_status = 'M'
+   and 
+   cd_education_status = '4 yr Degree'
+   and 
+   ss_sales_price between 100.00 and 150.00  
+   )
+ or
+  (
+  cd_demo_sk = ss_cdemo_sk
+   and 
+   cd_marital_status = 'M'
+   and 
+   cd_education_status = '4 yr Degree'
+   and 
+   ss_sales_price between 50.00 and 100.00   
+  )
+ or 
+ (
+  cd_demo_sk = ss_cdemo_sk
+  and 
+   cd_marital_status = 'M'
+   and 
+   cd_education_status = '4 yr Degree'
+   and 
+   ss_sales_price between 150.00 and 200.00  
+ )
+ )
+ and
+ (
+  (
+  ss_addr_sk = ca_address_sk
+  and
+  ca_country = 'United States'
+  and
+  ca_state in ('KY', 'GA', 'NM')
+  and ss_net_profit between 0 and 2000  
+  )
+ or
+  (ss_addr_sk = ca_address_sk
+  and
+  ca_country = 'United States'
+  and
+  ca_state in ('MT', 'OR', 'IN')
+  and ss_net_profit between 150 and 3000 
+  )
+ or
+  (ss_addr_sk = ca_address_sk
+  and
+  ca_country = 'United States'
+  and
+  ca_state in ('WI', 'MO', 'WV')
+  and ss_net_profit between 50 and 25000 
+  )
+ )
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 3 <- Map 8 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 9 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Map 10 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (CUSTOM_SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:-1
+    Stage-1
+      Reducer 6
+      File Output Operator [FS_33]
+        Group By Operator [GBY_31] (rows=1 width=8)
+          Output:["_col0"],aggregations:["sum(VALUE._col0)"]
+        <-Reducer 5 [CUSTOM_SIMPLE_EDGE]
+          PARTITION_ONLY_SHUFFLE [RS_30]
+            Group By Operator [GBY_29] (rows=1 width=8)
+              Output:["_col0"],aggregations:["sum(_col5)"]
+              Select Operator [SEL_28] (rows=15616947 width=88)
+                Output:["_col5"]
+                Filter Operator [FIL_27] (rows=15616947 width=88)
+                  predicate:(((_col14) IN ('KY', 'GA', 'NM') and _col7 BETWEEN 0 AND 2000) or ((_col14) IN ('MT', 'OR', 'IN') and _col7 BETWEEN 150 AND 3000) or ((_col14) IN ('WI', 'MO', 'WV') and _col7 BETWEEN 50 AND 25000))
+                  Merge Join Operator [MERGEJOIN_56] (rows=93701693 width=88)
+                    Conds:RS_24._col3=RS_25._col0(Inner),Output:["_col5","_col7","_col14"]
+                  <-Map 10 [SIMPLE_EDGE]
+                    SHUFFLE [RS_25]
+                      PartitionCols:_col0
+                      Select Operator [SEL_14] (rows=10000000 width=1014)
+                        Output:["_col0","_col1"]
+                        Filter Operator [FIL_52] (rows=10000000 width=1014)
+                          predicate:((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null)
+                          TableScan [TS_12] (rows=40000000 width=1014)
+                            default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_state","ca_country"]
+                  <-Reducer 4 [SIMPLE_EDGE]
+                    SHUFFLE [RS_24]
+                      PartitionCols:_col3
+                      Merge Join Operator [MERGEJOIN_55] (rows=85183356 width=88)
+                        Conds:RS_21._col2=RS_22._col0(Inner),Output:["_col3","_col5","_col7"]
+                      <-Map 9 [SIMPLE_EDGE]
+                        SHUFFLE [RS_22]
+                          PartitionCols:_col0
+                          Select Operator [SEL_11] (rows=465450 width=385)
+                            Output:["_col0"]
+                            Filter Operator [FIL_51] (rows=465450 width=385)
+                              predicate:((cd_education_status = '4 yr Degree') and (cd_marital_status = 'M') and cd_demo_sk is not null)
+                              TableScan [TS_9] (rows=1861800 width=385)
+                                default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:NONE,Output:["cd_demo_sk","cd_marital_status","cd_education_status"]
+                      <-Reducer 3 [SIMPLE_EDGE]
+                        SHUFFLE [RS_21]
+                          PartitionCols:_col2
+                          Merge Join Operator [MERGEJOIN_54] (rows=77439413 width=88)
+                            Conds:RS_18._col1=RS_19._col0(Inner),Output:["_col2","_col3","_col5","_col7"]
+                          <-Map 8 [SIMPLE_EDGE]
+                            SHUFFLE [RS_19]
+                              PartitionCols:_col0
+                              Select Operator [SEL_8] (rows=36524 width=1119)
+                                Output:["_col0"]
+                                Filter Operator [FIL_50] (rows=36524 width=1119)
+                                  predicate:((d_year = 1998) and d_date_sk is not null)
+                                  TableScan [TS_6] (rows=73049 width=1119)
+                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year"]
+                          <-Reducer 2 [SIMPLE_EDGE]
+                            SHUFFLE [RS_18]
+                              PartitionCols:_col1
+                              Merge Join Operator [MERGEJOIN_53] (rows=70399465 width=88)
+                                Conds:RS_15._col0=RS_16._col3(Inner),Output:["_col1","_col2","_col3","_col5","_col7"]
+                              <-Map 1 [SIMPLE_EDGE]
+                                SHUFFLE [RS_15]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_2] (rows=1704 width=1910)
+                                    Output:["_col0"]
+                                    Filter Operator [FIL_48] (rows=1704 width=1910)
+                                      predicate:s_store_sk is not null
+                                      TableScan [TS_0] (rows=1704 width=1910)
+                                        default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk"]
+                              <-Map 7 [SIMPLE_EDGE]
+                                SHUFFLE [RS_16]
+                                  PartitionCols:_col3
+                                  Select Operator [SEL_5] (rows=63999513 width=88)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col6"]
+                                    Filter Operator [FIL_49] (rows=63999513 width=88)
+                                      predicate:((ss_net_profit BETWEEN 0 AND 2000 or ss_net_profit BETWEEN 150 AND 3000 or ss_net_profit BETWEEN 50 AND 25000) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 150 AND 200) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                      TableScan [TS_3] (rows=575995635 width=88)
+                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_cdemo_sk","ss_addr_sk","ss_store_sk","ss_quantity","ss_sales_price","ss_net_profit"]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/9244fdc7/ql/src/test/results/clientpositive/perf/tez/query49.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query49.q.out b/ql/src/test/results/clientpositive/perf/tez/query49.q.out
new file mode 100644
index 0000000..be4027d
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/tez/query49.q.out
@@ -0,0 +1,496 @@
+PREHOOK: query: explain
+select  
+ 'web' as channel
+ ,web.item
+ ,web.return_ratio
+ ,web.return_rank
+ ,web.currency_rank
+ from (
+ 	select 
+ 	 item
+ 	,return_ratio
+ 	,currency_ratio
+ 	,rank() over (order by return_ratio) as return_rank
+ 	,rank() over (order by currency_ratio) as currency_rank
+ 	from
+ 	(	select ws.ws_item_sk as item
+ 		,(cast(sum(coalesce(wr.wr_return_quantity,0)) as dec(15,4))/
+ 		cast(sum(coalesce(ws.ws_quantity,0)) as dec(15,4) )) as return_ratio
+ 		,(cast(sum(coalesce(wr.wr_return_amt,0)) as dec(15,4))/
+ 		cast(sum(coalesce(ws.ws_net_paid,0)) as dec(15,4) )) as currency_ratio
+ 		from 
+ 		 web_sales ws left outer join web_returns wr 
+ 			on (ws.ws_order_number = wr.wr_order_number and 
+ 			ws.ws_item_sk = wr.wr_item_sk)
+                 ,date_dim
+ 		where 
+ 			wr.wr_return_amt > 10000 
+ 			and ws.ws_net_profit > 1
+                         and ws.ws_net_paid > 0
+                         and ws.ws_quantity > 0
+                         and ws_sold_date_sk = d_date_sk
+                         and d_year = 2000
+                         and d_moy = 12
+ 		group by ws.ws_item_sk
+ 	) in_web
+ ) web
+ where 
+ (
+ web.return_rank <= 10
+ or
+ web.currency_rank <= 10
+ )
+ union
+ select 
+ 'catalog' as channel
+ ,catalog.item
+ ,catalog.return_ratio
+ ,catalog.return_rank
+ ,catalog.currency_rank
+ from (
+ 	select 
+ 	 item
+ 	,return_ratio
+ 	,currency_ratio
+ 	,rank() over (order by return_ratio) as return_rank
+ 	,rank() over (order by currency_ratio) as currency_rank
+ 	from
+ 	(	select 
+ 		cs.cs_item_sk as item
+ 		,(cast(sum(coalesce(cr.cr_return_quantity,0)) as dec(15,4))/
+ 		cast(sum(coalesce(cs.cs_quantity,0)) as dec(15,4) )) as return_ratio
+ 		,(cast(sum(coalesce(cr.cr_return_amount,0)) as dec(15,4))/
+ 		cast(sum(coalesce(cs.cs_net_paid,0)) as dec(15,4) )) as currency_ratio
+ 		from 
+ 		catalog_sales cs left outer join catalog_returns cr
+ 			on (cs.cs_order_number = cr.cr_order_number and 
+ 			cs.cs_item_sk = cr.cr_item_sk)
+                ,date_dim
+ 		where 
+ 			cr.cr_return_amount > 10000 
+ 			and cs.cs_net_profit > 1
+                         and cs.cs_net_paid > 0
+                         and cs.cs_quantity > 0
+                         and cs_sold_date_sk = d_date_sk
+                         and d_year = 2000
+                         and d_moy = 12
+                 group by cs.cs_item_sk
+ 	) in_cat
+ ) catalog
+ where 
+ (
+ catalog.return_rank <= 10
+ or
+ catalog.currency_rank <=10
+ )
+ union
+ select 
+ 'store' as channel
+ ,store.item
+ ,store.return_ratio
+ ,store.return_rank
+ ,store.currency_rank
+ from (
+ 	select 
+ 	 item
+ 	,return_ratio
+ 	,currency_ratio
+ 	,rank() over (order by return_ratio) as return_rank
+ 	,rank() over (order by currency_ratio) as currency_rank
+ 	from
+ 	(	select sts.ss_item_sk as item
+ 		,(cast(sum(coalesce(sr.sr_return_quantity,0)) as dec(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as dec(15,4) )) as return_ratio
+ 		,(cast(sum(coalesce(sr.sr_return_amt,0)) as dec(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as dec(15,4) )) as currency_ratio
+ 		from 
+ 		store_sales sts left outer join store_returns sr
+ 			on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk)
+                ,date_dim
+ 		where 
+ 			sr.sr_return_amt > 10000 
+ 			and sts.ss_net_profit > 1
+                         and sts.ss_net_paid > 0 
+                         and sts.ss_quantity > 0
+                         and ss_sold_date_sk = d_date_sk
+                         and d_year = 2000
+                         and d_moy = 12
+ 		group by sts.ss_item_sk
+ 	) in_store
+ ) store
+ where  (
+ store.return_rank <= 10
+ or 
+ store.currency_rank <= 10
+ )
+ order by 1,4,5
+ limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  
+ 'web' as channel
+ ,web.item
+ ,web.return_ratio
+ ,web.return_rank
+ ,web.currency_rank
+ from (
+ 	select 
+ 	 item
+ 	,return_ratio
+ 	,currency_ratio
+ 	,rank() over (order by return_ratio) as return_rank
+ 	,rank() over (order by currency_ratio) as currency_rank
+ 	from
+ 	(	select ws.ws_item_sk as item
+ 		,(cast(sum(coalesce(wr.wr_return_quantity,0)) as dec(15,4))/
+ 		cast(sum(coalesce(ws.ws_quantity,0)) as dec(15,4) )) as return_ratio
+ 		,(cast(sum(coalesce(wr.wr_return_amt,0)) as dec(15,4))/
+ 		cast(sum(coalesce(ws.ws_net_paid,0)) as dec(15,4) )) as currency_ratio
+ 		from 
+ 		 web_sales ws left outer join web_returns wr 
+ 			on (ws.ws_order_number = wr.wr_order_number and 
+ 			ws.ws_item_sk = wr.wr_item_sk)
+                 ,date_dim
+ 		where 
+ 			wr.wr_return_amt > 10000 
+ 			and ws.ws_net_profit > 1
+                         and ws.ws_net_paid > 0
+                         and ws.ws_quantity > 0
+                         and ws_sold_date_sk = d_date_sk
+                         and d_year = 2000
+                         and d_moy = 12
+ 		group by ws.ws_item_sk
+ 	) in_web
+ ) web
+ where 
+ (
+ web.return_rank <= 10
+ or
+ web.currency_rank <= 10
+ )
+ union
+ select 
+ 'catalog' as channel
+ ,catalog.item
+ ,catalog.return_ratio
+ ,catalog.return_rank
+ ,catalog.currency_rank
+ from (
+ 	select 
+ 	 item
+ 	,return_ratio
+ 	,currency_ratio
+ 	,rank() over (order by return_ratio) as return_rank
+ 	,rank() over (order by currency_ratio) as currency_rank
+ 	from
+ 	(	select 
+ 		cs.cs_item_sk as item
+ 		,(cast(sum(coalesce(cr.cr_return_quantity,0)) as dec(15,4))/
+ 		cast(sum(coalesce(cs.cs_quantity,0)) as dec(15,4) )) as return_ratio
+ 		,(cast(sum(coalesce(cr.cr_return_amount,0)) as dec(15,4))/
+ 		cast(sum(coalesce(cs.cs_net_paid,0)) as dec(15,4) )) as currency_ratio
+ 		from 
+ 		catalog_sales cs left outer join catalog_returns cr
+ 			on (cs.cs_order_number = cr.cr_order_number and 
+ 			cs.cs_item_sk = cr.cr_item_sk)
+                ,date_dim
+ 		where 
+ 			cr.cr_return_amount > 10000 
+ 			and cs.cs_net_profit > 1
+                         and cs.cs_net_paid > 0
+                         and cs.cs_quantity > 0
+                         and cs_sold_date_sk = d_date_sk
+                         and d_year = 2000
+                         and d_moy = 12
+                 group by cs.cs_item_sk
+ 	) in_cat
+ ) catalog
+ where 
+ (
+ catalog.return_rank <= 10
+ or
+ catalog.currency_rank <=10
+ )
+ union
+ select 
+ 'store' as channel
+ ,store.item
+ ,store.return_ratio
+ ,store.return_rank
+ ,store.currency_rank
+ from (
+ 	select 
+ 	 item
+ 	,return_ratio
+ 	,currency_ratio
+ 	,rank() over (order by return_ratio) as return_rank
+ 	,rank() over (order by currency_ratio) as currency_rank
+ 	from
+ 	(	select sts.ss_item_sk as item
+ 		,(cast(sum(coalesce(sr.sr_return_quantity,0)) as dec(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as dec(15,4) )) as return_ratio
+ 		,(cast(sum(coalesce(sr.sr_return_amt,0)) as dec(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as dec(15,4) )) as currency_ratio
+ 		from 
+ 		store_sales sts left outer join store_returns sr
+ 			on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk)
+                ,date_dim
+ 		where 
+ 			sr.sr_return_amt > 10000 
+ 			and sts.ss_net_profit > 1
+                         and sts.ss_net_paid > 0 
+                         and sts.ss_quantity > 0
+                         and ss_sold_date_sk = d_date_sk
+                         and d_year = 2000
+                         and d_moy = 12
+ 		group by sts.ss_item_sk
+ 	) in_store
+ ) store
+ where  (
+ store.return_rank <= 10
+ or 
+ store.currency_rank <= 10
+ )
+ order by 1,4,5
+ limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 10 <- Union 9 (SIMPLE_EDGE)
+Reducer 11 <- Reducer 10 (SIMPLE_EDGE)
+Reducer 13 <- Map 12 (SIMPLE_EDGE), Map 24 (SIMPLE_EDGE)
+Reducer 14 <- Map 25 (SIMPLE_EDGE), Reducer 13 (SIMPLE_EDGE)
+Reducer 15 <- Reducer 14 (SIMPLE_EDGE)
+Reducer 16 <- Reducer 15 (SIMPLE_EDGE)
+Reducer 17 <- Reducer 16 (SIMPLE_EDGE), Union 7 (CONTAINS)
+Reducer 18 <- Map 12 (SIMPLE_EDGE), Map 26 (SIMPLE_EDGE)
+Reducer 19 <- Map 27 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
+Reducer 20 <- Reducer 19 (SIMPLE_EDGE)
+Reducer 21 <- Reducer 20 (SIMPLE_EDGE)
+Reducer 22 <- Reducer 21 (SIMPLE_EDGE), Union 9 (CONTAINS)
+Reducer 3 <- Map 23 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE), Union 7 (CONTAINS)
+Reducer 8 <- Union 7 (SIMPLE_EDGE), Union 9 (CONTAINS)
+
+Stage-0
+  Fetch Operator
+    limit:100
+    Stage-1
+      Reducer 11
+      File Output Operator [FS_113]
+        Limit [LIM_112] (rows=100 width=101)
+          Number of rows:100
+          Select Operator [SEL_111] (rows=5915494 width=101)
+            Output:["_col0","_col1","_col2","_col3","_col4"]
+          <-Reducer 10 [SIMPLE_EDGE]
+            SHUFFLE [RS_110]
+              Select Operator [SEL_109] (rows=5915494 width=101)
+                Output:["_col0","_col1","_col2","_col3","_col4"]
+                Group By Operator [GBY_108] (rows=5915494 width=101)
+                  Output:["_col0","_col1","_col2","_col3","_col4"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
+                <-Union 9 [SIMPLE_EDGE]
+                  <-Reducer 22 [CONTAINS]
+                    Reduce Output Operator [RS_107]
+                      PartitionCols:_col0, _col1, _col2, _col3, _col4
+                      Group By Operator [GBY_106] (rows=11830988 width=101)
+                        Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
+                        Select Operator [SEL_99] (rows=8604378 width=88)
+                          Output:["_col0","_col1","_col2","_col3","_col4"]
+                          Filter Operator [FIL_137] (rows=8604378 width=88)
+                            predicate:((_col0 <= 10) or (rank_window_1 <= 10))
+                            PTF Operator [PTF_98] (rows=12906568 width=88)
+                              Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col4 AS decimal(15,4)) / CAST( _col5 AS decimal(15,4))) ASC NULLS FIRST","partition by:":"0"}]
+                              Select Operator [SEL_97] (rows=12906568 width=88)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                              <-Reducer 21 [SIMPLE_EDGE]
+                                SHUFFLE [RS_96]
+                                  PartitionCols:0
+                                  Select Operator [SEL_95] (rows=12906568 width=88)
+                                    Output:["rank_window_0","_col0","_col1","_col2","_col3","_col4"]
+                                    PTF Operator [PTF_94] (rows=12906568 width=88)
+                                      Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col1 AS decimal(15,4)) / CAST( _col2 AS decimal(15,4))) ASC NULLS FIRST","partition by:":"0"}]
+                                      Select Operator [SEL_93] (rows=12906568 width=88)
+                                        Output:["_col0","_col1","_col2","_col3","_col4"]
+                                      <-Reducer 20 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_92]
+                                          PartitionCols:0
+                                          Group By Operator [GBY_90] (rows=12906568 width=88)
+                                            Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
+                                          <-Reducer 19 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_89]
+                                              PartitionCols:_col0
+                                              Group By Operator [GBY_88] (rows=25813137 width=88)
+                                                Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0
+                                                Select Operator [SEL_86] (rows=25813137 width=88)
+                                                  Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                  Merge Join Operator [MERGEJOIN_146] (rows=25813137 width=88)
+                                                    Conds:RS_83._col1, _col2=RS_84._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col11","_col12"]
+                                                  <-Map 27 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_84]
+                                                      PartitionCols:_col0, _col1
+                                                      Select Operator [SEL_79] (rows=19197050 width=77)
+                                                        Output:["_col0","_col1","_col2","_col3"]
+                                                        Filter Operator [FIL_140] (rows=19197050 width=77)
+                                                          predicate:((sr_return_amt > 10000) and sr_item_sk is not null and sr_ticket_number is not null)
+                                                          TableScan [TS_77] (rows=57591150 width=77)
+                                                            default@store_returns,sr,Tbl:COMPLETE,Col:NONE,Output:["sr_item_sk","sr_ticket_number","sr_return_quantity","sr_return_amt"]
+                                                  <-Reducer 18 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_83]
+                                                      PartitionCols:_col1, _col2
+                                                      Merge Join Operator [MERGEJOIN_145] (rows=23466488 width=88)
+                                                        Conds:RS_80._col0=RS_81._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                                      <-Map 12 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_81]
+                                                          PartitionCols:_col0
+                                                          Select Operator [SEL_5] (rows=18262 width=1119)
+                                                            Output:["_col0"]
+                                                            Filter Operator [FIL_131] (rows=18262 width=1119)
+                                                              predicate:((d_moy = 12) and (d_year = 2000) and d_date_sk is not null)
+                                                              TableScan [TS_3] (rows=73049 width=1119)
+                                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
+                                                      <-Map 26 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_80]
+                                                          PartitionCols:_col0
+                                                          Select Operator [SEL_73] (rows=21333171 width=88)
+                                                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                            Filter Operator [FIL_138] (rows=21333171 width=88)
+                                                              predicate:((ss_net_paid > 0) and (ss_net_profit > 1) and (ss_quantity > 0) and ss_item_sk is not null and ss_sold_date_sk is not null and ss_ticket_number is not null)
+                                                              TableScan [TS_71] (rows=575995635 width=88)
+                                                                default@store_sales,sts,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_ticket_number","ss_quantity","ss_net_paid","ss_net_profit"]
+                  <-Reducer 8 [CONTAINS]
+                    Reduce Output Operator [RS_107]
+                      PartitionCols:_col0, _col1, _col2, _col3, _col4
+                      Group By Operator [GBY_106] (rows=11830988 width=101)
+                        Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
+                        Select Operator [SEL_70] (rows=3226610 width=135)
+                          Output:["_col0","_col1","_col2","_col3","_col4"]
+                          Group By Operator [GBY_69] (rows=3226610 width=135)
+                            Output:["_col0","_col1","_col2","_col3","_col4"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
+                          <-Union 7 [SIMPLE_EDGE]
+                            <-Reducer 17 [CONTAINS]
+                              Reduce Output Operator [RS_68]
+                                PartitionCols:_col0, _col1, _col2, _col3, _col4
+                                Group By Operator [GBY_67] (rows=6453220 width=135)
+                                  Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
+                                  Select Operator [SEL_60] (rows=4302070 width=135)
+                                    Output:["_col0","_col1","_col2","_col3","_col4"]
+                                    Filter Operator [FIL_133] (rows=4302070 width=135)
+                                      predicate:((_col0 <= 10) or (rank_window_1 <= 10))
+                                      PTF Operator [PTF_59] (rows=6453105 width=135)
+                                        Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col4 AS decimal(15,4)) / CAST( _col5 AS decimal(15,4))) ASC NULLS FIRST","partition by:":"0"}]
+                                        Select Operator [SEL_58] (rows=6453105 width=135)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                                        <-Reducer 16 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_57]
+                                            PartitionCols:0
+                                            Select Operator [SEL_56] (rows=6453105 width=135)
+                                              Output:["rank_window_0","_col0","_col1","_col2","_col3","_col4"]
+                                              PTF Operator [PTF_55] (rows=6453105 width=135)
+                                                Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col1 AS decimal(15,4)) / CAST( _col2 AS decimal(15,4))) ASC NULLS FIRST","partition by:":"0"}]
+                                                Select Operator [SEL_54] (rows=6453105 width=135)
+                                                  Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                <-Reducer 15 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_53]
+                                                    PartitionCols:0
+                                                    Group By Operator [GBY_51] (rows=6453105 width=135)
+                                                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
+                                                    <-Reducer 14 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_50]
+                                                        PartitionCols:_col0
+                                                        Group By Operator [GBY_49] (rows=12906211 width=135)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0
+                                                          Select Operator [SEL_47] (rows=12906211 width=135)
+                                                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                            Merge Join Operator [MERGEJOIN_144] (rows=12906211 width=135)
+                                                              Conds:RS_44._col1, _col2=RS_45._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col11","_col12"]
+                                                            <-Map 25 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_45]
+                                                                PartitionCols:_col0, _col1
+                                                                Select Operator [SEL_40] (rows=9599627 width=106)
+                                                                  Output:["_col0","_col1","_col2","_col3"]
+                                                                  Filter Operator [FIL_136] (rows=9599627 width=106)
+                                                                    predicate:((cr_return_amount > 10000) and cr_item_sk is not null and cr_order_number is not null)
+                                                                    TableScan [TS_38] (rows=28798881 width=106)
+                                                                      default@catalog_returns,cr,Tbl:COMPLETE,Col:NONE,Output:["cr_item_sk","cr_order_number","cr_return_quantity","cr_return_amount"]
+                                                            <-Reducer 13 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_44]
+                                                                PartitionCols:_col1, _col2
+                                                                Merge Join Operator [MERGEJOIN_143] (rows=11732919 width=135)
+                                                                  Conds:RS_41._col0=RS_42._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                                                <-Map 12 [SIMPLE_EDGE]
+                                                                  SHUFFLE [RS_42]
+                                                                    PartitionCols:_col0
+                                                                     Please refer to the previous Select Operator [SEL_5]
+                                                                <-Map 24 [SIMPLE_EDGE]
+                                                                  SHUFFLE [RS_41]
+                                                                    PartitionCols:_col0
+                                                                    Select Operator [SEL_34] (rows=10666290 width=135)
+                                                                      Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                                      Filter Operator [FIL_134] (rows=10666290 width=135)
+                                                                        predicate:((cs_net_paid > 0) and (cs_net_profit > 1) and (cs_quantity > 0) and cs_item_sk is not null and cs_order_number is not null and cs_sold_date_sk is not null)
+                                                                        TableScan [TS_32] (rows=287989836 width=135)
+                                                                          default@catalog_sales,cs,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_item_sk","cs_order_number","cs_quantity","cs_net_paid","cs_net_profit"]
+                            <-Reducer 6 [CONTAINS]
+                              Reduce Output Operator [RS_68]
+                                PartitionCols:_col0, _col1, _col2, _col3, _col4
+                                Group By Operator [GBY_67] (rows=6453220 width=135)
+                                  Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
+                                  Select Operator [SEL_28] (rows=2151150 width=135)
+                                    Output:["_col0","_col1","_col2","_col3","_col4"]
+                                    Filter Operator [FIL_129] (rows=2151150 width=135)
+                                      predicate:((_col0 <= 10) or (rank_window_1 <= 10))
+                                      PTF Operator [PTF_27] (rows=3226726 width=135)
+                                        Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col4 AS decimal(15,4)) / CAST( _col5 AS decimal(15,4))) ASC NULLS FIRST","partition by:":"0"}]
+                                        Select Operator [SEL_26] (rows=3226726 width=135)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                                        <-Reducer 5 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_25]
+                                            PartitionCols:0
+                                            Select Operator [SEL_24] (rows=3226726 width=135)
+                                              Output:["rank_window_0","_col0","_col1","_col2","_col3","_col4"]
+                                              PTF Operator [PTF_23] (rows=3226726 width=135)
+                                                Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col1 AS decimal(15,4)) / CAST( _col2 AS decimal(15,4))) ASC NULLS FIRST","partition by:":"0"}]
+                                                Select Operator [SEL_22] (rows=3226726 width=135)
+                                                  Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                <-Reducer 4 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_21]
+                                                    PartitionCols:0
+                                                    Group By Operator [GBY_19] (rows=3226726 width=135)
+                                                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
+                                                    <-Reducer 3 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_18]
+                                                        PartitionCols:_col0
+                                                        Group By Operator [GBY_17] (rows=6453452 width=135)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0
+                                                          Select Operator [SEL_15] (rows=6453452 width=135)
+                                                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                            Merge Join Operator [MERGEJOIN_142] (rows=6453452 width=135)
+                                                              Conds:RS_12._col1, _col2=RS_13._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col11","_col12"]
+                                                            <-Map 23 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_13]
+                                                                PartitionCols:_col0, _col1
+                                                                Select Operator [SEL_8] (rows=4799489 width=92)
+                                                                  Output:["_col0","_col1","_col2","_col3"]
+                                                                  Filter Operator [FIL_132] (rows=4799489 width=92)
+                                                                    predicate:((wr_return_amt > 10000) and wr_item_sk is not null and wr_order_number is not null)
+                                                                    TableScan [TS_6] (rows=14398467 width=92)
+                                                                      default@web_returns,wr,Tbl:COMPLETE,Col:NONE,Output:["wr_item_sk","wr_order_number","wr_return_quantity","wr_return_amt"]
+                                                            <-Reducer 2 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_12]
+                                                                PartitionCols:_col1, _col2
+                                                                Merge Join Operator [MERGEJOIN_141] (rows=5866775 width=135)
+                                                                  Conds:RS_9._col0=RS_10._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                                                <-Map 12 [SIMPLE_EDGE]
+                                                                  SHUFFLE [RS_10]
+                                                                    PartitionCols:_col0
+                                                                     Please refer to the previous Select Operator [SEL_5]
+                                                                <-Map 1 [SIMPLE_EDGE]
+                                                                  SHUFFLE [RS_9]
+                                                                    PartitionCols:_col0
+                                                                    Select Operator [SEL_2] (rows=5333432 width=135)
+                                                                      Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                                      Filter Operator [FIL_130] (rows=5333432 width=135)
+                                                                        predicate:((ws_net_paid > 0) and (ws_net_profit > 1) and (ws_quantity > 0) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null)
+                                                                        TableScan [TS_0] (rows=144002668 width=135)
+                                                                          default@web_sales,ws,Tbl:COMPLETE,Col:NONE,Output:["ws_sold_date_sk","ws_item_sk","ws_order_number","ws_quantity","ws_net_paid","ws_net_profit"]
+