hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [11/17] hive git commit: HIVE-16764: Support numeric as same as decimal (Pengcheng Xiong, reviewed by Ashutosh Chauhan)
Date Wed, 31 May 2017 00:11:49 GMT
http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query34.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query34.q.out b/ql/src/test/results/clientpositive/perf/query34.q.out
index 51710bd..a535ce5 100644
--- a/ql/src/test/results/clientpositive/perf/query34.q.out
+++ b/ql/src/test/results/clientpositive/perf/query34.q.out
@@ -1,6 +1,62 @@
-PREHOOK: query: explain select c_last_name ,c_first_name ,c_salutation ,c_preferred_cust_flag ,ss_ticket_number ,cnt from (select ss_ticket_number ,ss_customer_sk ,count(*) cnt from store_sales,date_dim,store,household_demographics 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 (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28) and (household_demographics.hd_buy_potential = '1001-5000' or household_demographics.hd_buy_potential = '5001-10000') and household_demographics.hd_vehicle_count > 0 and (case when household_demographics.hd_vehicle_count > 0 then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end) > 1.2 and date_dim.d_year in (1998,1998+1,1998+2) and store.s_county in ('Kittitas County','Adams County','Richland County','Furnas County', 'Orange County','Appanoose County','Franklin Parish','Tehama Co
 unty') group by ss_ticket_number,ss_customer_sk) dn,customer where dn.ss_customer_sk = customer.c_customer_sk and cnt between 15 and 20 order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc
+PREHOOK: query: explain
+select c_last_name
+       ,c_first_name
+       ,c_salutation
+       ,c_preferred_cust_flag
+       ,ss_ticket_number
+       ,cnt from
+   (select ss_ticket_number
+          ,ss_customer_sk
+          ,count(*) cnt
+    from store_sales,date_dim,store,household_demographics
+    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 (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28)
+    and (household_demographics.hd_buy_potential = '>10000' or
+         household_demographics.hd_buy_potential = 'unknown')
+    and household_demographics.hd_vehicle_count > 0
+    and (case when household_demographics.hd_vehicle_count > 0 
+	then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count 
+	else null 
+	end)  > 1.2
+    and date_dim.d_year in (2000,2000+1,2000+2)
+    and store.s_county in ('Mobile County','Maverick County','Huron County','Kittitas County',
+                           'Fairfield County','Jackson County','Barrow County','Pennington County')
+    group by ss_ticket_number,ss_customer_sk) dn,customer
+    where ss_customer_sk = c_customer_sk
+      and cnt between 15 and 20
+    order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select c_last_name ,c_first_name ,c_salutation ,c_preferred_cust_flag ,ss_ticket_number ,cnt from (select ss_ticket_number ,ss_customer_sk ,count(*) cnt from store_sales,date_dim,store,household_demographics 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 (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28) and (household_demographics.hd_buy_potential = '1001-5000' or household_demographics.hd_buy_potential = '5001-10000') and household_demographics.hd_vehicle_count > 0 and (case when household_demographics.hd_vehicle_count > 0 then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end) > 1.2 and date_dim.d_year in (1998,1998+1,1998+2) and store.s_county in ('Kittitas County','Adams County','Richland County','Furnas County', 'Orange County','Appanoose County','Franklin Parish','Tehama C
 ounty') group by ss_ticket_number,ss_customer_sk) dn,customer where dn.ss_customer_sk = customer.c_customer_sk and cnt between 15 and 20 order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc
+POSTHOOK: query: explain
+select c_last_name
+       ,c_first_name
+       ,c_salutation
+       ,c_preferred_cust_flag
+       ,ss_ticket_number
+       ,cnt from
+   (select ss_ticket_number
+          ,ss_customer_sk
+          ,count(*) cnt
+    from store_sales,date_dim,store,household_demographics
+    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 (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28)
+    and (household_demographics.hd_buy_potential = '>10000' or
+         household_demographics.hd_buy_potential = 'unknown')
+    and household_demographics.hd_vehicle_count > 0
+    and (case when household_demographics.hd_vehicle_count > 0 
+	then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count 
+	else null 
+	end)  > 1.2
+    and date_dim.d_year in (2000,2000+1,2000+2)
+    and store.s_county in ('Mobile County','Maverick County','Huron County','Kittitas County',
+                           'Fairfield County','Jackson County','Barrow County','Pennington County')
+    group by ss_ticket_number,ss_customer_sk) dn,customer
+    where ss_customer_sk = c_customer_sk
+      and cnt between 15 and 20
+    order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc
 POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
@@ -57,7 +113,7 @@ Stage-0
                                 Select Operator [SEL_14] (rows=852 width=1910)
                                   Output:["_col0"]
                                   Filter Operator [FIL_56] (rows=852 width=1910)
-                                    predicate:((s_county) IN ('Kittitas County', 'Adams County', 'Richland County', 'Furnas County', 'Orange County', 'Appanoose County', 'Franklin Parish', 'Tehama County') and s_store_sk is not null)
+                                    predicate:((s_county) IN ('Mobile County', 'Maverick County', 'Huron County', 'Kittitas County', 'Fairfield County', 'Jackson County', 'Barrow County', 'Pennington County') 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_county"]
                             <-Reducer 6 [SIMPLE_EDGE]
@@ -71,7 +127,7 @@ Stage-0
                                     Select Operator [SEL_11] (rows=1200 width=107)
                                       Output:["_col0"]
                                       Filter Operator [FIL_55] (rows=1200 width=107)
-                                        predicate:(((hd_buy_potential = '1001-5000') or (hd_buy_potential = '5001-10000')) and (hd_vehicle_count > 0) and CASE WHEN ((hd_vehicle_count > 0)) THEN (((UDFToDouble(hd_dep_count) / UDFToDouble(hd_vehicle_count)) > 1.2)) ELSE (null) END and hd_demo_sk is not null)
+                                        predicate:(((hd_buy_potential = '>10000') or (hd_buy_potential = 'unknown')) and (hd_vehicle_count > 0) and CASE WHEN ((hd_vehicle_count > 0)) THEN (((UDFToDouble(hd_dep_count) / UDFToDouble(hd_vehicle_count)) > 1.2)) ELSE (null) END and hd_demo_sk is not null)
                                         TableScan [TS_9] (rows=7200 width=107)
                                           default@household_demographics,household_demographics,Tbl:COMPLETE,Col:NONE,Output:["hd_demo_sk","hd_buy_potential","hd_dep_count","hd_vehicle_count"]
                                 <-Reducer 5 [SIMPLE_EDGE]
@@ -94,7 +150,7 @@ Stage-0
                                         Select Operator [SEL_8] (rows=8116 width=1119)
                                           Output:["_col0"]
                                           Filter Operator [FIL_54] (rows=8116 width=1119)
-                                            predicate:((d_year) IN (1998, 1999, 2000) and (d_dom BETWEEN 1 AND 3 or d_dom BETWEEN 25 AND 28) and d_date_sk is not null)
+                                            predicate:((d_year) IN (2000, 2001, 2002) and (d_dom BETWEEN 1 AND 3 or d_dom BETWEEN 25 AND 28) 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","d_dom"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query35.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query35.q.out b/ql/src/test/results/clientpositive/perf/query35.q.out
new file mode 100644
index 0000000..b286a07
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query35.q.out
@@ -0,0 +1,292 @@
+PREHOOK: query: explain
+select   
+  ca_state,
+  cd_gender,
+  cd_marital_status,
+  count(*) cnt1,
+  avg(cd_dep_count),
+  max(cd_dep_count),
+  sum(cd_dep_count),
+  cd_dep_employed_count,
+  count(*) cnt2,
+  avg(cd_dep_employed_count),
+  max(cd_dep_employed_count),
+  sum(cd_dep_employed_count),
+  cd_dep_college_count,
+  count(*) cnt3,
+  avg(cd_dep_college_count),
+  max(cd_dep_college_count),
+  sum(cd_dep_college_count)
+ from
+  customer c,customer_address ca,customer_demographics
+ where
+  c.c_current_addr_sk = ca.ca_address_sk and
+  cd_demo_sk = c.c_current_cdemo_sk and 
+  exists (select *
+          from store_sales,date_dim
+          where c.c_customer_sk = ss_customer_sk and
+                ss_sold_date_sk = d_date_sk and
+                d_year = 1999 and
+                d_qoy < 4) and
+   (exists (select *
+            from web_sales,date_dim
+            where c.c_customer_sk = ws_bill_customer_sk and
+                  ws_sold_date_sk = d_date_sk and
+                  d_year = 1999 and
+                  d_qoy < 4) or 
+    exists (select * 
+            from catalog_sales,date_dim
+            where c.c_customer_sk = cs_ship_customer_sk and
+                  cs_sold_date_sk = d_date_sk and
+                  d_year = 1999 and
+                  d_qoy < 4))
+ group by ca_state,
+          cd_gender,
+          cd_marital_status,
+          cd_dep_count,
+          cd_dep_employed_count,
+          cd_dep_college_count
+ order by ca_state,
+          cd_gender,
+          cd_marital_status,
+          cd_dep_count,
+          cd_dep_employed_count,
+          cd_dep_college_count
+ limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select   
+  ca_state,
+  cd_gender,
+  cd_marital_status,
+  count(*) cnt1,
+  avg(cd_dep_count),
+  max(cd_dep_count),
+  sum(cd_dep_count),
+  cd_dep_employed_count,
+  count(*) cnt2,
+  avg(cd_dep_employed_count),
+  max(cd_dep_employed_count),
+  sum(cd_dep_employed_count),
+  cd_dep_college_count,
+  count(*) cnt3,
+  avg(cd_dep_college_count),
+  max(cd_dep_college_count),
+  sum(cd_dep_college_count)
+ from
+  customer c,customer_address ca,customer_demographics
+ where
+  c.c_current_addr_sk = ca.ca_address_sk and
+  cd_demo_sk = c.c_current_cdemo_sk and 
+  exists (select *
+          from store_sales,date_dim
+          where c.c_customer_sk = ss_customer_sk and
+                ss_sold_date_sk = d_date_sk and
+                d_year = 1999 and
+                d_qoy < 4) and
+   (exists (select *
+            from web_sales,date_dim
+            where c.c_customer_sk = ws_bill_customer_sk and
+                  ws_sold_date_sk = d_date_sk and
+                  d_year = 1999 and
+                  d_qoy < 4) or 
+    exists (select * 
+            from catalog_sales,date_dim
+            where c.c_customer_sk = cs_ship_customer_sk and
+                  cs_sold_date_sk = d_date_sk and
+                  d_year = 1999 and
+                  d_qoy < 4))
+ group by ca_state,
+          cd_gender,
+          cd_marital_status,
+          cd_dep_count,
+          cd_dep_employed_count,
+          cd_dep_college_count
+ order by ca_state,
+          cd_gender,
+          cd_marital_status,
+          cd_dep_count,
+          cd_dep_employed_count,
+          cd_dep_college_count
+ limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 11 <- Map 10 (SIMPLE_EDGE), Map 13 (SIMPLE_EDGE)
+Reducer 12 <- Reducer 11 (SIMPLE_EDGE)
+Reducer 14 <- Map 13 (SIMPLE_EDGE), Map 18 (SIMPLE_EDGE)
+Reducer 15 <- Reducer 14 (SIMPLE_EDGE)
+Reducer 16 <- Map 13 (SIMPLE_EDGE), Map 19 (SIMPLE_EDGE)
+Reducer 17 <- Reducer 16 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
+Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 12 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 17 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:-1
+    Stage-1
+      Reducer 7
+      File Output Operator [FS_75]
+        Limit [LIM_73] (rows=100 width=88)
+          Number of rows:100
+          Select Operator [SEL_72] (rows=383325119 width=88)
+            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16"]
+          <-Reducer 6 [SIMPLE_EDGE]
+            SHUFFLE [RS_71]
+              Select Operator [SEL_70] (rows=383325119 width=88)
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col9","_col10","_col11","_col12","_col14","_col15","_col16","_col17"]
+                Group By Operator [GBY_69] (rows=383325119 width=88)
+                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15"],aggregations:["count(VALUE._col0)","avg(VALUE._col1)","max(VALUE._col2)","sum(VALUE._col3)","avg(VALUE._col4)","max(VALUE._col5)","sum(VALUE._col6)","avg(VALUE._col7)","max(VALUE._col8)","sum(VALUE._col9)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
+                <-Reducer 5 [SIMPLE_EDGE]
+                  SHUFFLE [RS_68]
+                    PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
+                    Group By Operator [GBY_67] (rows=766650239 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15"],aggregations:["count()","avg(_col8)","max(_col8)","sum(_col8)","avg(_col9)","max(_col9)","sum(_col9)","avg(_col10)","max(_col10)","sum(_col10)"],keys:_col4, _col6, _col7, _col8, _col9, _col10
+                      Select Operator [SEL_66] (rows=766650239 width=88)
+                        Output:["_col4","_col6","_col7","_col8","_col9","_col10"]
+                        Filter Operator [FIL_65] (rows=766650239 width=88)
+                          predicate:(_col13 is not null or _col15 is not null)
+                          Merge Join Operator [MERGEJOIN_113] (rows=766650239 width=88)
+                            Conds:RS_62._col0=RS_63._col0(Left Outer),Output:["_col4","_col6","_col7","_col8","_col9","_col10","_col13","_col15"]
+                          <-Reducer 17 [SIMPLE_EDGE]
+                            SHUFFLE [RS_63]
+                              PartitionCols:_col0
+                              Select Operator [SEL_61] (rows=158394413 width=135)
+                                Output:["_col0","_col1"]
+                                Group By Operator [GBY_60] (rows=158394413 width=135)
+                                  Output:["_col0"],keys:KEY._col0
+                                <-Reducer 16 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_59]
+                                    PartitionCols:_col0
+                                    Group By Operator [GBY_58] (rows=316788826 width=135)
+                                      Output:["_col0"],keys:_col1
+                                      Merge Join Operator [MERGEJOIN_111] (rows=316788826 width=135)
+                                        Conds:RS_54._col0=RS_55._col0(Inner),Output:["_col1"]
+                                      <-Map 13 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_55]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_53] (rows=12174 width=1119)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_106] (rows=12174 width=1119)
+                                              predicate:((d_year = 1999) and (d_qoy < 4) and d_date_sk is not null)
+                                              TableScan [TS_12] (rows=73049 width=1119)
+                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_qoy"]
+                                      <-Map 19 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_54]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_50] (rows=287989836 width=135)
+                                            Output:["_col0","_col1"]
+                                            Filter Operator [FIL_105] (rows=287989836 width=135)
+                                              predicate:(cs_ship_customer_sk is not null and cs_sold_date_sk is not null)
+                                              TableScan [TS_48] (rows=287989836 width=135)
+                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_ship_customer_sk"]
+                          <-Reducer 4 [SIMPLE_EDGE]
+                            SHUFFLE [RS_62]
+                              PartitionCols:_col0
+                              Select Operator [SEL_47] (rows=696954748 width=88)
+                                Output:["_col0","_col4","_col6","_col7","_col8","_col9","_col10","_col13"]
+                                Merge Join Operator [MERGEJOIN_112] (rows=696954748 width=88)
+                                  Conds:RS_43._col0=RS_44._col0(Left Outer),RS_43._col0=RS_45._col0(Inner),Output:["_col0","_col4","_col6","_col7","_col8","_col9","_col10","_col12"]
+                                <-Reducer 12 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_44]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_22] (rows=79201469 width=135)
+                                      Output:["_col0","_col1"]
+                                      Group By Operator [GBY_21] (rows=79201469 width=135)
+                                        Output:["_col0"],keys:KEY._col0
+                                      <-Reducer 11 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_20]
+                                          PartitionCols:_col0
+                                          Group By Operator [GBY_19] (rows=158402938 width=135)
+                                            Output:["_col0"],keys:_col1
+                                            Merge Join Operator [MERGEJOIN_109] (rows=158402938 width=135)
+                                              Conds:RS_15._col0=RS_16._col0(Inner),Output:["_col1"]
+                                            <-Map 13 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_16]
+                                                PartitionCols:_col0
+                                                Select Operator [SEL_14] (rows=12174 width=1119)
+                                                  Output:["_col0"]
+                                                  Filter Operator [FIL_102] (rows=12174 width=1119)
+                                                    predicate:((d_year = 1999) and (d_qoy < 4) and d_date_sk is not null)
+                                                     Please refer to the previous TableScan [TS_12]
+                                            <-Map 10 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_15]
+                                                PartitionCols:_col0
+                                                Select Operator [SEL_11] (rows=144002668 width=135)
+                                                  Output:["_col0","_col1"]
+                                                  Filter Operator [FIL_101] (rows=144002668 width=135)
+                                                    predicate:(ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
+                                                    TableScan [TS_9] (rows=144002668 width=135)
+                                                      default@web_sales,web_sales,Tbl:COMPLETE,Col:NONE,Output:["ws_sold_date_sk","ws_bill_customer_sk"]
+                                <-Reducer 15 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_45]
+                                    PartitionCols:_col0
+                                    Group By Operator [GBY_35] (rows=316797606 width=88)
+                                      Output:["_col0"],keys:KEY._col0
+                                    <-Reducer 14 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_34]
+                                        PartitionCols:_col0
+                                        Group By Operator [GBY_33] (rows=633595212 width=88)
+                                          Output:["_col0"],keys:_col1
+                                          Merge Join Operator [MERGEJOIN_110] (rows=633595212 width=88)
+                                            Conds:RS_29._col0=RS_30._col0(Inner),Output:["_col1"]
+                                          <-Map 13 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_30]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_28] (rows=12174 width=1119)
+                                                Output:["_col0"]
+                                                Filter Operator [FIL_104] (rows=12174 width=1119)
+                                                  predicate:((d_year = 1999) and (d_qoy < 4) and d_date_sk is not null)
+                                                   Please refer to the previous TableScan [TS_12]
+                                          <-Map 18 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_29]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_25] (rows=575995635 width=88)
+                                                Output:["_col0","_col1"]
+                                                Filter Operator [FIL_103] (rows=575995635 width=88)
+                                                  predicate:(ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                                  TableScan [TS_23] (rows=575995635 width=88)
+                                                    default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_customer_sk"]
+                                <-Reducer 3 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_43]
+                                    PartitionCols:_col0
+                                    Merge Join Operator [MERGEJOIN_108] (rows=96800003 width=860)
+                                      Conds:RS_40._col1=RS_41._col0(Inner),Output:["_col0","_col4","_col6","_col7","_col8","_col9","_col10"]
+                                    <-Map 9 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_41]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_8] (rows=1861800 width=385)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                                          Filter Operator [FIL_100] (rows=1861800 width=385)
+                                            predicate:cd_demo_sk is not null
+                                            TableScan [TS_6] (rows=1861800 width=385)
+                                              default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:NONE,Output:["cd_demo_sk","cd_gender","cd_marital_status","cd_dep_count","cd_dep_employed_count","cd_dep_college_count"]
+                                    <-Reducer 2 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_40]
+                                        PartitionCols:_col1
+                                        Merge Join Operator [MERGEJOIN_107] (rows=88000001 width=860)
+                                          Conds:RS_37._col2=RS_38._col0(Inner),Output:["_col0","_col1","_col4"]
+                                        <-Map 1 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_37]
+                                            PartitionCols:_col2
+                                            Select Operator [SEL_2] (rows=80000000 width=860)
+                                              Output:["_col0","_col1","_col2"]
+                                              Filter Operator [FIL_98] (rows=80000000 width=860)
+                                                predicate:(c_current_addr_sk is not null and c_current_cdemo_sk is not null)
+                                                TableScan [TS_0] (rows=80000000 width=860)
+                                                  default@customer,c,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk","c_current_cdemo_sk","c_current_addr_sk"]
+                                        <-Map 8 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_38]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_5] (rows=40000000 width=1014)
+                                              Output:["_col0","_col1"]
+                                              Filter Operator [FIL_99] (rows=40000000 width=1014)
+                                                predicate:ca_address_sk is not null
+                                                TableScan [TS_3] (rows=40000000 width=1014)
+                                                  default@customer_address,ca,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_state"]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query36.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query36.q.out b/ql/src/test/results/clientpositive/perf/query36.q.out
index b5110d9..e0dc8d9 100644
--- a/ql/src/test/results/clientpositive/perf/query36.q.out
+++ b/ql/src/test/results/clientpositive/perf/query36.q.out
@@ -5,9 +5,9 @@ select
    ,i_class
    ,grouping(i_category)+grouping(i_class) as lochierarchy
    ,rank() over (
-     partition by grouping(i_category)+grouping(i_class),
-     case when grouping(i_class) = 0 then i_category end 
-     order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent
+ 	partition by grouping(i_category)+grouping(i_class),
+ 	case when grouping(i_class) = 0 then i_category end 
+ 	order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent
  from
     store_sales
    ,date_dim       d1
@@ -34,9 +34,9 @@ select
    ,i_class
    ,grouping(i_category)+grouping(i_class) as lochierarchy
    ,rank() over (
-     partition by grouping(i_category)+grouping(i_class),
-     case when grouping(i_class) = 0 then i_category end 
-     order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent
+ 	partition by grouping(i_category)+grouping(i_class),
+ 	case when grouping(i_class) = 0 then i_category end 
+ 	order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent
  from
     store_sales
    ,date_dim       d1

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query39.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query39.q.out b/ql/src/test/results/clientpositive/perf/query39.q.out
index 3e34c27..cf139f2 100644
--- a/ql/src/test/results/clientpositive/perf/query39.q.out
+++ b/ql/src/test/results/clientpositive/perf/query39.q.out
@@ -1,6 +1,54 @@
-PREHOOK: query: explain with inv as (select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stdev,mean, case mean when 0 then null else stdev/mean end cov from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean from inventory ,item ,warehouse ,date_dim where inv_item_sk = i_item_sk and inv_warehouse_sk = w_warehouse_sk and inv_date_sk = d_date_sk and d_year =1999 group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo where case mean when 0 then 0 else stdev/mean end > 1) select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov from inv inv1,inv inv2 where inv1.i_item_sk = inv2.i_item_sk and inv1.w_warehouse_sk = inv2.w_warehouse_sk and inv1.d_moy=3 and inv2.d_moy=3+1 order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov ,inv2.d_moy,inv2.mean, inv2.cov
+PREHOOK: query: explain
+with inv as
+(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+       ,stdev,mean, case mean when 0 then null else stdev/mean end cov
+ from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+            ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean
+      from inventory
+          ,item
+          ,warehouse
+          ,date_dim
+      where inv_item_sk = i_item_sk
+        and inv_warehouse_sk = w_warehouse_sk
+        and inv_date_sk = d_date_sk
+        and d_year =1999
+      group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo
+ where case mean when 0 then 0 else stdev/mean end > 1)
+select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov
+        ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov
+from inv inv1,inv inv2
+where inv1.i_item_sk = inv2.i_item_sk
+  and inv1.w_warehouse_sk =  inv2.w_warehouse_sk
+  and inv1.d_moy=4
+  and inv2.d_moy=4+1
+order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov
+        ,inv2.d_moy,inv2.mean, inv2.cov
 PREHOOK: type: QUERY
-POSTHOOK: query: explain with inv as (select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stdev,mean, case mean when 0 then null else stdev/mean end cov from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean from inventory ,item ,warehouse ,date_dim where inv_item_sk = i_item_sk and inv_warehouse_sk = w_warehouse_sk and inv_date_sk = d_date_sk and d_year =1999 group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo where case mean when 0 then 0 else stdev/mean end > 1) select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov from inv inv1,inv inv2 where inv1.i_item_sk = inv2.i_item_sk and inv1.w_warehouse_sk = inv2.w_warehouse_sk and inv1.d_moy=3 and inv2.d_moy=3+1 order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov ,inv2.d_moy,inv2.mean, inv2.cov
+POSTHOOK: query: explain
+with inv as
+(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+       ,stdev,mean, case mean when 0 then null else stdev/mean end cov
+ from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+            ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean
+      from inventory
+          ,item
+          ,warehouse
+          ,date_dim
+      where inv_item_sk = i_item_sk
+        and inv_warehouse_sk = w_warehouse_sk
+        and inv_date_sk = d_date_sk
+        and d_year =1999
+      group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo
+ where case mean when 0 then 0 else stdev/mean end > 1)
+select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov
+        ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov
+from inv inv1,inv inv2
+where inv1.i_item_sk = inv2.i_item_sk
+  and inv1.w_warehouse_sk =  inv2.w_warehouse_sk
+  and inv1.d_moy=4
+  and inv2.d_moy=4+1
+order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov
+        ,inv2.d_moy,inv2.mean, inv2.cov
 POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
@@ -91,7 +139,7 @@ Stage-0
                                           Select Operator [SEL_33] (rows=18262 width=1119)
                                             Output:["_col0"]
                                             Filter Operator [FIL_95] (rows=18262 width=1119)
-                                              predicate:((d_year = 1999) and (d_moy = 4) and d_date_sk is not null)
+                                              predicate:((d_year = 1999) and (d_moy = 5) 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"]
               <-Reducer 5 [SIMPLE_EDGE]
@@ -152,17 +200,65 @@ Stage-0
                                           Select Operator [SEL_5] (rows=18262 width=1119)
                                             Output:["_col0"]
                                             Filter Operator [FIL_91] (rows=18262 width=1119)
-                                              predicate:((d_year = 1999) and (d_moy = 3) and d_date_sk is not null)
+                                              predicate:((d_year = 1999) and (d_moy = 4) and d_date_sk is not null)
                                                Please refer to the previous TableScan [TS_3]
 
-PREHOOK: query: with inv as (select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stdev,mean, case mean when 0 then null else stdev/mean end cov from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean from inventory ,item ,warehouse ,date_dim where inv_item_sk = i_item_sk and inv_warehouse_sk = w_warehouse_sk and inv_date_sk = d_date_sk and d_year =1999 group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo where case mean when 0 then 0 else stdev/mean end > 1) select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov from inv inv1,inv inv2 where inv1.i_item_sk = inv2.i_item_sk and inv1.w_warehouse_sk = inv2.w_warehouse_sk and inv1.d_moy=3 and inv2.d_moy=3+1 and inv1.cov > 1.5 order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov ,inv2.d_moy,inv2.mean, inv2.cov
+PREHOOK: query: with inv as
+(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+       ,stdev,mean, case mean when 0 then null else stdev/mean end cov
+ from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+            ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean
+      from inventory
+          ,item
+          ,warehouse
+          ,date_dim
+      where inv_item_sk = i_item_sk
+        and inv_warehouse_sk = w_warehouse_sk
+        and inv_date_sk = d_date_sk
+        and d_year =1999
+      group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo
+ where case mean when 0 then 0 else stdev/mean end > 1)
+select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov
+        ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov
+from inv inv1,inv inv2
+where inv1.i_item_sk = inv2.i_item_sk
+  and inv1.w_warehouse_sk =  inv2.w_warehouse_sk
+  and inv1.d_moy=4
+  and inv2.d_moy=4+1
+  and inv1.cov > 1.5
+order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov
+        ,inv2.d_moy,inv2.mean, inv2.cov
 PREHOOK: type: QUERY
 PREHOOK: Input: default@date_dim
 PREHOOK: Input: default@inventory
 PREHOOK: Input: default@item
 PREHOOK: Input: default@warehouse
 #### A masked pattern was here ####
-POSTHOOK: query: with inv as (select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stdev,mean, case mean when 0 then null else stdev/mean end cov from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean from inventory ,item ,warehouse ,date_dim where inv_item_sk = i_item_sk and inv_warehouse_sk = w_warehouse_sk and inv_date_sk = d_date_sk and d_year =1999 group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo where case mean when 0 then 0 else stdev/mean end > 1) select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov from inv inv1,inv inv2 where inv1.i_item_sk = inv2.i_item_sk and inv1.w_warehouse_sk = inv2.w_warehouse_sk and inv1.d_moy=3 and inv2.d_moy=3+1 and inv1.cov > 1.5 order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov ,inv2.d_moy,inv2.mean, inv2.cov
+POSTHOOK: query: with inv as
+(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+       ,stdev,mean, case mean when 0 then null else stdev/mean end cov
+ from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+            ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean
+      from inventory
+          ,item
+          ,warehouse
+          ,date_dim
+      where inv_item_sk = i_item_sk
+        and inv_warehouse_sk = w_warehouse_sk
+        and inv_date_sk = d_date_sk
+        and d_year =1999
+      group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo
+ where case mean when 0 then 0 else stdev/mean end > 1)
+select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov
+        ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov
+from inv inv1,inv inv2
+where inv1.i_item_sk = inv2.i_item_sk
+  and inv1.w_warehouse_sk =  inv2.w_warehouse_sk
+  and inv1.d_moy=4
+  and inv2.d_moy=4+1
+  and inv1.cov > 1.5
+order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov
+        ,inv2.d_moy,inv2.mean, inv2.cov
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@date_dim
 POSTHOOK: Input: default@inventory

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query42.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query42.q.out b/ql/src/test/results/clientpositive/perf/query42.q.out
index 307ef98..1ccb4fd 100644
--- a/ql/src/test/results/clientpositive/perf/query42.q.out
+++ b/ql/src/test/results/clientpositive/perf/query42.q.out
@@ -1,6 +1,44 @@
-PREHOOK: query: explain select dt.d_year ,item.i_category_id ,item.i_category ,sum(ss_ext_sales_price) as s 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_manager_id = 1 and dt.d_moy=12 and dt.d_year=1998 group by dt.d_year ,item.i_category_id ,item.i_category order by s desc,dt.d_year ,item.i_category_id ,item.i_category limit 100
+PREHOOK: query: explain
+select  dt.d_year
+ 	,item.i_category_id
+ 	,item.i_category
+ 	,sum(ss_ext_sales_price)
+ 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_manager_id = 1  	
+ 	and dt.d_moy=12
+ 	and dt.d_year=1998
+ group by 	dt.d_year
+ 		,item.i_category_id
+ 		,item.i_category
+ order by       sum(ss_ext_sales_price) desc,dt.d_year
+ 		,item.i_category_id
+ 		,item.i_category
+limit 100
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select dt.d_year ,item.i_category_id ,item.i_category ,sum(ss_ext_sales_price) as s 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_manager_id = 1 and dt.d_moy=12 and dt.d_year=1998 group by dt.d_year ,item.i_category_id ,item.i_category order by s desc,dt.d_year ,item.i_category_id ,item.i_category limit 100
+POSTHOOK: query: explain
+select  dt.d_year
+ 	,item.i_category_id
+ 	,item.i_category
+ 	,sum(ss_ext_sales_price)
+ 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_manager_id = 1  	
+ 	and dt.d_moy=12
+ 	and dt.d_year=1998
+ group by 	dt.d_year
+ 		,item.i_category_id
+ 		,item.i_category
+ order by       sum(ss_ext_sales_price) desc,dt.d_year
+ 		,item.i_category_id
+ 		,item.i_category
+limit 100
 POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
@@ -24,45 +62,47 @@ Stage-0
               Output:["_col0","_col1","_col2"]
             <-Reducer 4 [SIMPLE_EDGE]
               SHUFFLE [RS_20]
-                Group By Operator [GBY_18] (rows=348477374 width=88)
-                  Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1
-                <-Reducer 3 [SIMPLE_EDGE]
-                  SHUFFLE [RS_17]
-                    PartitionCols:_col0, _col1
-                    Group By Operator [GBY_16] (rows=696954748 width=88)
-                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col7, _col8
-                      Merge Join Operator [MERGEJOIN_34] (rows=696954748 width=88)
-                        Conds:RS_12._col1=RS_13._col0(Inner),Output:["_col2","_col7","_col8"]
-                      <-Map 7 [SIMPLE_EDGE]
-                        SHUFFLE [RS_13]
-                          PartitionCols:_col0
-                          Select Operator [SEL_8] (rows=231000 width=1436)
-                            Output:["_col0","_col1","_col2"]
-                            Filter Operator [FIL_32] (rows=231000 width=1436)
-                              predicate:((i_manager_id = 1) and i_item_sk is not null)
-                              TableScan [TS_6] (rows=462000 width=1436)
-                                default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_category_id","i_category","i_manager_id"]
-                      <-Reducer 2 [SIMPLE_EDGE]
-                        SHUFFLE [RS_12]
-                          PartitionCols:_col1
-                          Merge Join Operator [MERGEJOIN_33] (rows=633595212 width=88)
-                            Conds:RS_9._col0=RS_10._col0(Inner),Output:["_col1","_col2"]
-                          <-Map 1 [SIMPLE_EDGE]
-                            SHUFFLE [RS_9]
-                              PartitionCols:_col0
-                              Select Operator [SEL_2] (rows=575995635 width=88)
-                                Output:["_col0","_col1","_col2"]
-                                Filter Operator [FIL_30] (rows=575995635 width=88)
-                                  predicate:(ss_sold_date_sk is not null and ss_item_sk is not null)
-                                  TableScan [TS_0] (rows=575995635 width=88)
-                                    default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_ext_sales_price"]
-                          <-Map 6 [SIMPLE_EDGE]
-                            SHUFFLE [RS_10]
-                              PartitionCols:_col0
-                              Select Operator [SEL_5] (rows=18262 width=1119)
-                                Output:["_col0"]
-                                Filter Operator [FIL_31] (rows=18262 width=1119)
-                                  predicate:((d_moy = 12) and (d_year = 1998) and d_date_sk is not null)
-                                  TableScan [TS_3] (rows=73049 width=1119)
-                                    default@date_dim,dt,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
+                Select Operator [SEL_19] (rows=348477374 width=88)
+                  Output:["_col0","_col1","_col3"]
+                  Group By Operator [GBY_18] (rows=348477374 width=88)
+                    Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1
+                  <-Reducer 3 [SIMPLE_EDGE]
+                    SHUFFLE [RS_17]
+                      PartitionCols:_col0, _col1
+                      Group By Operator [GBY_16] (rows=696954748 width=88)
+                        Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col7, _col8
+                        Merge Join Operator [MERGEJOIN_34] (rows=696954748 width=88)
+                          Conds:RS_12._col1=RS_13._col0(Inner),Output:["_col2","_col7","_col8"]
+                        <-Map 7 [SIMPLE_EDGE]
+                          SHUFFLE [RS_13]
+                            PartitionCols:_col0
+                            Select Operator [SEL_8] (rows=231000 width=1436)
+                              Output:["_col0","_col1","_col2"]
+                              Filter Operator [FIL_32] (rows=231000 width=1436)
+                                predicate:((i_manager_id = 1) and i_item_sk is not null)
+                                TableScan [TS_6] (rows=462000 width=1436)
+                                  default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_category_id","i_category","i_manager_id"]
+                        <-Reducer 2 [SIMPLE_EDGE]
+                          SHUFFLE [RS_12]
+                            PartitionCols:_col1
+                            Merge Join Operator [MERGEJOIN_33] (rows=633595212 width=88)
+                              Conds:RS_9._col0=RS_10._col0(Inner),Output:["_col1","_col2"]
+                            <-Map 1 [SIMPLE_EDGE]
+                              SHUFFLE [RS_9]
+                                PartitionCols:_col0
+                                Select Operator [SEL_2] (rows=575995635 width=88)
+                                  Output:["_col0","_col1","_col2"]
+                                  Filter Operator [FIL_30] (rows=575995635 width=88)
+                                    predicate:(ss_sold_date_sk is not null and ss_item_sk is not null)
+                                    TableScan [TS_0] (rows=575995635 width=88)
+                                      default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_ext_sales_price"]
+                            <-Map 6 [SIMPLE_EDGE]
+                              SHUFFLE [RS_10]
+                                PartitionCols:_col0
+                                Select Operator [SEL_5] (rows=18262 width=1119)
+                                  Output:["_col0"]
+                                  Filter Operator [FIL_31] (rows=18262 width=1119)
+                                    predicate:((d_moy = 12) and (d_year = 1998) and d_date_sk is not null)
+                                    TableScan [TS_3] (rows=73049 width=1119)
+                                      default@date_dim,dt,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query43.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query43.q.out b/ql/src/test/results/clientpositive/perf/query43.q.out
index 72712e8..6db0919 100644
--- a/ql/src/test/results/clientpositive/perf/query43.q.out
+++ b/ql/src/test/results/clientpositive/perf/query43.q.out
@@ -1,6 +1,38 @@
-PREHOOK: query: explain select s_store_name, s_store_id, sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales from date_dim, store_sales, store where date_dim.d_date_sk = store_sales.ss_sold_date_sk and store.s_store_sk = store_sales.ss_store_sk and s_gmt_offset = -6 and d_year = 1998 group by s_store_name, s_store_id order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales limit 100
+PREHOOK: query: explain
+select  s_store_name, s_store_id,
+        sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
+        sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
+        sum(case when (d_day_name='Tuesday') then ss_sales_price else  null end) tue_sales,
+        sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
+        sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
+        sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
+        sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
+ from date_dim, store_sales, store
+ where d_date_sk = ss_sold_date_sk and
+       s_store_sk = ss_store_sk and
+       s_gmt_offset = -6 and
+       d_year = 1998 
+ group by s_store_name, s_store_id
+ order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales
+ limit 100
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select s_store_name, s_store_id, sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales from date_dim, store_sales, store where date_dim.d_date_sk = store_sales.ss_sold_date_sk and store.s_store_sk = store_sales.ss_store_sk and s_gmt_offset = -6 and d_year = 1998 group by s_store_name, s_store_id order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales limit 100
+POSTHOOK: query: explain
+select  s_store_name, s_store_id,
+        sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
+        sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
+        sum(case when (d_day_name='Tuesday') then ss_sales_price else  null end) tue_sales,
+        sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
+        sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
+        sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
+        sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
+ from date_dim, store_sales, store
+ where d_date_sk = ss_sold_date_sk and
+       s_store_sk = ss_store_sk and
+       s_gmt_offset = -6 and
+       d_year = 1998 
+ group by s_store_name, s_store_id
+ order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales
+ limit 100
 POSTHOOK: type: QUERY
 Plan optimized by CBO.
 

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query44.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query44.q.out b/ql/src/test/results/clientpositive/perf/query44.q.out
new file mode 100644
index 0000000..5665480
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query44.q.out
@@ -0,0 +1,279 @@
+Warning: Shuffle Join MERGEJOIN[131][tables = [$hdt$_2, $hdt$_3, $hdt$_1]] in Stage 'Reducer 9' is a cross product
+Warning: Shuffle Join MERGEJOIN[133][tables = [$hdt$_4, $hdt$_5, $hdt$_3]] in Stage 'Reducer 13' is a cross product
+PREHOOK: query: explain
+select  asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing
+from(select *
+     from (select item_sk,rank() over (order by rank_col asc) rnk
+           from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col 
+                 from store_sales ss1
+                 where ss_store_sk = 410
+                 group by ss_item_sk
+                 having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col
+                                                  from store_sales
+                                                  where ss_store_sk = 410
+                                                    and ss_hdemo_sk is null
+                                                  group by ss_store_sk))V1)V11
+     where rnk  < 11) asceding,
+    (select *
+     from (select item_sk,rank() over (order by rank_col desc) rnk
+           from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col
+                 from store_sales ss1
+                 where ss_store_sk = 410
+                 group by ss_item_sk
+                 having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col
+                                                  from store_sales
+                                                  where ss_store_sk = 410
+                                                    and ss_hdemo_sk is null
+                                                  group by ss_store_sk))V2)V21
+     where rnk  < 11) descending,
+item i1,
+item i2
+where asceding.rnk = descending.rnk 
+  and i1.i_item_sk=asceding.item_sk
+  and i2.i_item_sk=descending.item_sk
+order by asceding.rnk
+limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing
+from(select *
+     from (select item_sk,rank() over (order by rank_col asc) rnk
+           from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col 
+                 from store_sales ss1
+                 where ss_store_sk = 410
+                 group by ss_item_sk
+                 having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col
+                                                  from store_sales
+                                                  where ss_store_sk = 410
+                                                    and ss_hdemo_sk is null
+                                                  group by ss_store_sk))V1)V11
+     where rnk  < 11) asceding,
+    (select *
+     from (select item_sk,rank() over (order by rank_col desc) rnk
+           from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col
+                 from store_sales ss1
+                 where ss_store_sk = 410
+                 group by ss_item_sk
+                 having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col
+                                                  from store_sales
+                                                  where ss_store_sk = 410
+                                                    and ss_hdemo_sk is null
+                                                  group by ss_store_sk))V2)V21
+     where rnk  < 11) descending,
+item i1,
+item i2
+where asceding.rnk = descending.rnk 
+  and i1.i_item_sk=asceding.item_sk
+  and i2.i_item_sk=descending.item_sk
+order by asceding.rnk
+limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 6 (SIMPLE_EDGE)
+Reducer 12 <- Reducer 11 (CUSTOM_SIMPLE_EDGE)
+Reducer 13 <- Reducer 12 (CUSTOM_SIMPLE_EDGE), Reducer 17 (CUSTOM_SIMPLE_EDGE), Reducer 20 (CUSTOM_SIMPLE_EDGE)
+Reducer 14 <- Reducer 13 (SIMPLE_EDGE)
+Reducer 16 <- Map 15 (SIMPLE_EDGE)
+Reducer 17 <- Map 15 (SIMPLE_EDGE)
+Reducer 19 <- Map 18 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
+Reducer 20 <- Map 18 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Map 1 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
+Reducer 7 <- Map 6 (SIMPLE_EDGE)
+Reducer 8 <- Reducer 7 (CUSTOM_SIMPLE_EDGE)
+Reducer 9 <- Reducer 16 (CUSTOM_SIMPLE_EDGE), Reducer 19 (CUSTOM_SIMPLE_EDGE), Reducer 8 (CUSTOM_SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:100
+    Stage-1
+      Reducer 4
+      File Output Operator [FS_104]
+        Limit [LIM_103] (rows=100 width=185)
+          Number of rows:100
+          Select Operator [SEL_102] (rows=1393898919384048 width=185)
+            Output:["_col0","_col1","_col2"]
+          <-Reducer 3 [SIMPLE_EDGE]
+            SHUFFLE [RS_101]
+              Select Operator [SEL_100] (rows=1393898919384048 width=185)
+                Output:["_col0","_col1","_col2"]
+                Merge Join Operator [MERGEJOIN_135] (rows=1393898919384048 width=185)
+                  Conds:RS_97._col3=RS_98._col3(Inner),Output:["_col1","_col3","_col5"]
+                <-Reducer 2 [SIMPLE_EDGE]
+                  SHUFFLE [RS_97]
+                    PartitionCols:_col3
+                    Merge Join Operator [MERGEJOIN_132] (rows=1267180808338276 width=185)
+                      Conds:RS_94._col0=RS_95._col0(Inner),Output:["_col1","_col3"]
+                    <-Map 1 [SIMPLE_EDGE]
+                      SHUFFLE [RS_94]
+                        PartitionCols:_col0
+                        Select Operator [SEL_2] (rows=462000 width=1436)
+                          Output:["_col0","_col1"]
+                          Filter Operator [FIL_121] (rows=462000 width=1436)
+                            predicate:i_item_sk is not null
+                            TableScan [TS_0] (rows=462000 width=1436)
+                              default@item,i1,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_product_name"]
+                    <-Reducer 10 [SIMPLE_EDGE]
+                      SHUFFLE [RS_95]
+                        PartitionCols:_col0
+                        Select Operator [SEL_41] (rows=1151982528066248 width=185)
+                          Output:["_col0","_col1"]
+                          Filter Operator [FIL_122] (rows=1151982528066248 width=185)
+                            predicate:((rank_window_0 < 11) and _col2 is not null)
+                            PTF Operator [PTF_40] (rows=3455947584198744 width=185)
+                              Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col3 ASC NULLS FIRST","partition by:":"0"}]
+                              Select Operator [SEL_39] (rows=3455947584198744 width=185)
+                                Output:["_col2","_col3"]
+                              <-Reducer 9 [SIMPLE_EDGE]
+                                SHUFFLE [RS_38]
+                                  PartitionCols:0
+                                  Filter Operator [FIL_37] (rows=3455947584198744 width=185)
+                                    predicate:(_col3 > (0.9 * _col1))
+                                    Merge Join Operator [MERGEJOIN_131] (rows=10367842752596232 width=185)
+                                      Conds:(Inner),(Inner),Output:["_col1","_col2","_col3"]
+                                    <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_34]
+                                        Select Operator [SEL_25] (rows=71999454 width=88)
+                                          Output:["_col0"]
+                                          Group By Operator [GBY_24] (rows=71999454 width=88)
+                                            Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
+                                          <-Map 15 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_23]
+                                              PartitionCols:_col0
+                                              Group By Operator [GBY_22] (rows=143998908 width=88)
+                                                Output:["_col0","_col1"],aggregations:["avg(_col1)"],keys:410
+                                                Select Operator [SEL_20] (rows=143998908 width=88)
+                                                  Output:["_col1"]
+                                                  Filter Operator [FIL_124] (rows=143998908 width=88)
+                                                    predicate:((ss_store_sk = 410) and ss_hdemo_sk is null)
+                                                    TableScan [TS_18] (rows=575995635 width=88)
+                                                      default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_hdemo_sk","ss_store_sk","ss_net_profit"]
+                                    <-Reducer 19 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_35]
+                                        Group By Operator [GBY_31] (rows=143998908 width=88)
+                                          Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
+                                        <-Map 18 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_30]
+                                            PartitionCols:_col0
+                                            Group By Operator [GBY_29] (rows=287997817 width=88)
+                                              Output:["_col0","_col1"],aggregations:["avg(ss_net_profit)"],keys:ss_item_sk
+                                              Select Operator [SEL_28] (rows=287997817 width=88)
+                                                Output:["ss_item_sk","ss_net_profit"]
+                                                Filter Operator [FIL_125] (rows=287997817 width=88)
+                                                  predicate:(ss_store_sk = 410)
+                                                  TableScan [TS_26] (rows=575995635 width=88)
+                                                    default@store_sales,ss1,Tbl:COMPLETE,Col:NONE,Output:["ss_item_sk","ss_store_sk","ss_net_profit"]
+                                    <-Reducer 8 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_33]
+                                        Select Operator [SEL_17] (rows=1 width=8)
+                                          Filter Operator [FIL_16] (rows=1 width=8)
+                                            predicate:(sq_count_check(_col0) <= 1)
+                                            Group By Operator [GBY_14] (rows=1 width=8)
+                                              Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                            <-Reducer 7 [CUSTOM_SIMPLE_EDGE]
+                                              PARTITION_ONLY_SHUFFLE [RS_13]
+                                                Group By Operator [GBY_12] (rows=1 width=8)
+                                                  Output:["_col0"],aggregations:["count()"]
+                                                  Select Operator [SEL_10] (rows=71999454 width=88)
+                                                    Group By Operator [GBY_9] (rows=71999454 width=88)
+                                                      Output:["_col0"],keys:KEY._col0
+                                                    <-Map 6 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_8]
+                                                        PartitionCols:_col0
+                                                        Group By Operator [GBY_7] (rows=143998908 width=88)
+                                                          Output:["_col0"],keys:410
+                                                          Select Operator [SEL_5] (rows=143998908 width=88)
+                                                            Filter Operator [FIL_123] (rows=143998908 width=88)
+                                                              predicate:((ss_store_sk = 410) and ss_hdemo_sk is null)
+                                                              TableScan [TS_3] (rows=575995635 width=88)
+                                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_hdemo_sk","ss_store_sk"]
+                <-Reducer 5 [SIMPLE_EDGE]
+                  SHUFFLE [RS_98]
+                    PartitionCols:_col3
+                    Merge Join Operator [MERGEJOIN_134] (rows=1267180808338276 width=185)
+                      Conds:RS_90._col0=RS_91._col0(Inner),Output:["_col1","_col3"]
+                    <-Map 1 [SIMPLE_EDGE]
+                      SHUFFLE [RS_90]
+                        PartitionCols:_col0
+                        Select Operator [SEL_47] (rows=462000 width=1436)
+                          Output:["_col0","_col1"]
+                          Filter Operator [FIL_126] (rows=462000 width=1436)
+                            predicate:i_item_sk is not null
+                             Please refer to the previous TableScan [TS_0]
+                    <-Reducer 14 [SIMPLE_EDGE]
+                      SHUFFLE [RS_91]
+                        PartitionCols:_col0
+                        Select Operator [SEL_86] (rows=1151982528066248 width=185)
+                          Output:["_col0","_col1"]
+                          Filter Operator [FIL_127] (rows=1151982528066248 width=185)
+                            predicate:((rank_window_0 < 11) and _col2 is not null)
+                            PTF Operator [PTF_85] (rows=3455947584198744 width=185)
+                              Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col3 DESC NULLS LAST","partition by:":"0"}]
+                              Select Operator [SEL_84] (rows=3455947584198744 width=185)
+                                Output:["_col2","_col3"]
+                              <-Reducer 13 [SIMPLE_EDGE]
+                                SHUFFLE [RS_83]
+                                  PartitionCols:0
+                                  Filter Operator [FIL_82] (rows=3455947584198744 width=185)
+                                    predicate:(_col3 > (0.9 * _col1))
+                                    Merge Join Operator [MERGEJOIN_133] (rows=10367842752596232 width=185)
+                                      Conds:(Inner),(Inner),Output:["_col1","_col2","_col3"]
+                                    <-Reducer 12 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_78]
+                                        Select Operator [SEL_62] (rows=1 width=8)
+                                          Filter Operator [FIL_61] (rows=1 width=8)
+                                            predicate:(sq_count_check(_col0) <= 1)
+                                            Group By Operator [GBY_59] (rows=1 width=8)
+                                              Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                            <-Reducer 11 [CUSTOM_SIMPLE_EDGE]
+                                              PARTITION_ONLY_SHUFFLE [RS_58]
+                                                Group By Operator [GBY_57] (rows=1 width=8)
+                                                  Output:["_col0"],aggregations:["count()"]
+                                                  Select Operator [SEL_55] (rows=71999454 width=88)
+                                                    Group By Operator [GBY_54] (rows=71999454 width=88)
+                                                      Output:["_col0"],keys:KEY._col0
+                                                    <-Map 6 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_53]
+                                                        PartitionCols:_col0
+                                                        Group By Operator [GBY_52] (rows=143998908 width=88)
+                                                          Output:["_col0"],keys:410
+                                                          Select Operator [SEL_50] (rows=143998908 width=88)
+                                                            Filter Operator [FIL_128] (rows=143998908 width=88)
+                                                              predicate:((ss_store_sk = 410) and ss_hdemo_sk is null)
+                                                               Please refer to the previous TableScan [TS_3]
+                                    <-Reducer 17 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_79]
+                                        Select Operator [SEL_70] (rows=71999454 width=88)
+                                          Output:["_col0"]
+                                          Group By Operator [GBY_69] (rows=71999454 width=88)
+                                            Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
+                                          <-Map 15 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_68]
+                                              PartitionCols:_col0
+                                              Group By Operator [GBY_67] (rows=143998908 width=88)
+                                                Output:["_col0","_col1"],aggregations:["avg(_col1)"],keys:410
+                                                Select Operator [SEL_65] (rows=143998908 width=88)
+                                                  Output:["_col1"]
+                                                  Filter Operator [FIL_129] (rows=143998908 width=88)
+                                                    predicate:((ss_store_sk = 410) and ss_hdemo_sk is null)
+                                                     Please refer to the previous TableScan [TS_18]
+                                    <-Reducer 20 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_80]
+                                        Group By Operator [GBY_76] (rows=143998908 width=88)
+                                          Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
+                                        <-Map 18 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_75]
+                                            PartitionCols:_col0
+                                            Group By Operator [GBY_74] (rows=287997817 width=88)
+                                              Output:["_col0","_col1"],aggregations:["avg(ss_net_profit)"],keys:ss_item_sk
+                                              Select Operator [SEL_73] (rows=287997817 width=88)
+                                                Output:["ss_item_sk","ss_net_profit"]
+                                                Filter Operator [FIL_130] (rows=287997817 width=88)
+                                                  predicate:(ss_store_sk = 410)
+                                                   Please refer to the previous TableScan [TS_26]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query45.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query45.q.out b/ql/src/test/results/clientpositive/perf/query45.q.out
new file mode 100644
index 0000000..19cf365
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/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 (SIMPLE_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_sold_date_sk is not null and ws_item_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 [SIMPLE_EDGE]
+                                        SHUFFLE [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_customer_sk is not null and c_current_addr_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"]
+


Mime
View raw message