http://git-wip-us.apache.org/repos/asf/hive/blob/09b6f9a3/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
new file mode 100644
index 0000000..193cf4f
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query34.q.out
@@ -0,0 +1,177 @@
+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: 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: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
+Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Map 11 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+
+Stage-0
+   Fetch Operator
+      limit:-1
+      Stage-1
+         Reducer 7
+         File Output Operator [FS_45]
+            compressed:false
+            Statistics:Num rows: 88000001 Data size: 75681779077 Basic stats: 
COMPLETE Column stats: NONE
+            table:{"input 
format:":"org.apache.hadoop.mapred.TextInputFormat","output 
format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat","serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"}
+            Select Operator [SEL_44]
+            |  
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5"]
+            |  Statistics:Num rows: 88000001 Data size: 75681779077 Basic 
stats: COMPLETE Column stats: NONE
+            |<-Reducer 6 [SIMPLE_EDGE]
+               Reduce Output Operator [RS_43]
+                  key expressions:_col0 (type: string), _col1 (type: string), 
_col2 (type: string), _col3 (type: string)
+                  sort order:+++-
+                  Statistics:Num rows: 88000001 Data size: 75681779077 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions:_col4 (type: int), _col5 (type: bigint)
+                  Select Operator [SEL_42]
+                     
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                     Statistics:Num rows: 88000001 Data size: 75681779077 
Basic stats: COMPLETE Column stats: NONE
+                     Merge Join Operator [MERGEJOIN_69]
+                     |  condition map:[{"":"Inner Join 0 to 1"}]
+                     |  keys:{"0":"_col1 (type: int)","1":"_col0 (type: int)"}
+                     |  
outputColumnNames:["_col0","_col2","_col4","_col5","_col6","_col7"]
+                     |  Statistics:Num rows: 88000001 Data size: 75681779077 
Basic stats: COMPLETE Column stats: NONE
+                     |<-Map 11 [SIMPLE_EDGE]
+                     |  Reduce Output Operator [RS_40]
+                     |     key expressions:_col0 (type: int)
+                     |     Map-reduce partition columns:_col0 (type: int)
+                     |     sort order:+
+                     |     Statistics:Num rows: 80000000 Data size: 
68801615852 Basic stats: COMPLETE Column stats: NONE
+                     |     value expressions:_col1 (type: string), _col2 
(type: string), _col3 (type: string), _col4 (type: string)
+                     |     Select Operator [SEL_36]
+                     |        
outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+                     |        Statistics:Num rows: 80000000 Data size: 
68801615852 Basic stats: COMPLETE Column stats: NONE
+                     |        Filter Operator [FIL_65]
+                     |           predicate:c_customer_sk is not null (type: 
boolean)
+                     |           Statistics:Num rows: 80000000 Data size: 
68801615852 Basic stats: COMPLETE Column stats: NONE
+                     |           TableScan [TS_34]
+                     |              alias:customer
+                     |              Statistics:Num rows: 80000000 Data size: 
68801615852 Basic stats: COMPLETE Column stats: NONE
+                     |<-Reducer 5 [SIMPLE_EDGE]
+                        Reduce Output Operator [RS_38]
+                           key expressions:_col1 (type: int)
+                           Map-reduce partition columns:_col1 (type: int)
+                           sort order:+
+                           Statistics:Num rows: 12153 Data size: 13599611 
Basic stats: COMPLETE Column stats: NONE
+                           value expressions:_col0 (type: int), _col2 (type: 
bigint)
+                           Select Operator [SEL_31]
+                              outputColumnNames:["_col0","_col1","_col2"]
+                              Statistics:Num rows: 12153 Data size: 13599611 
Basic stats: COMPLETE Column stats: NONE
+                              Filter Operator [FIL_60]
+                                 predicate:_col2 BETWEEN 15 AND 20 (type: 
boolean)
+                                 Statistics:Num rows: 12153 Data size: 
13599611 Basic stats: COMPLETE Column stats: NONE
+                                 Group By Operator [GBY_30]
+                                 |  aggregations:["count(VALUE._col0)"]
+                                 |  keys:KEY._col0 (type: int), KEY._col1 
(type: int)
+                                 |  outputColumnNames:["_col0","_col1","_col2"]
+                                 |  Statistics:Num rows: 24306 Data size: 
27199223 Basic stats: COMPLETE Column stats: NONE
+                                 |<-Reducer 4 [SIMPLE_EDGE]
+                                    Reduce Output Operator [RS_29]
+                                       key expressions:_col0 (type: int), 
_col1 (type: int)
+                                       Map-reduce partition columns:_col0 
(type: int), _col1 (type: int)
+                                       sort order:++
+                                       Statistics:Num rows: 48612 Data size: 
54398446 Basic stats: COMPLETE Column stats: NONE
+                                       value expressions:_col2 (type: bigint)
+                                       Group By Operator [GBY_28]
+                                          aggregations:["count()"]
+                                          keys:_col1 (type: int), _col4 (type: 
int)
+                                          
outputColumnNames:["_col0","_col1","_col2"]
+                                          Statistics:Num rows: 48612 Data 
size: 54398446 Basic stats: COMPLETE Column stats: NONE
+                                          Merge Join Operator [MERGEJOIN_68]
+                                          |  condition map:[{"":"Inner Join 0 
to 1"}]
+                                          |  keys:{"0":"_col2 (type: 
int)","1":"_col0 (type: int)"}
+                                          |  
outputColumnNames:["_col1","_col4"]
+                                          |  Statistics:Num rows: 48612 Data 
size: 54398446 Basic stats: COMPLETE Column stats: NONE
+                                          |<-Map 10 [SIMPLE_EDGE]
+                                          |  Reduce Output Operator [RS_25]
+                                          |     key expressions:_col0 (type: 
int)
+                                          |     Map-reduce partition 
columns:_col0 (type: int)
+                                          |     sort order:+
+                                          |     Statistics:Num rows: 800 Data 
size: 85600 Basic stats: COMPLETE Column stats: NONE
+                                          |     Select Operator [SEL_11]
+                                          |        outputColumnNames:["_col0"]
+                                          |        Statistics:Num rows: 800 
Data size: 85600 Basic stats: COMPLETE Column stats: NONE
+                                          |        Filter Operator [FIL_64]
+                                          |           predicate:((((CASE WHEN 
((hd_vehicle_count > 0)) THEN ((UDFToDouble(hd_dep_count) / 
UDFToDouble(hd_vehicle_count))) ELSE (null) END > 1.2) and ((hd_buy_potential = 
'1001-5000') or (hd_buy_potential = '5001-10000'))) and (hd_vehicle_count > 0)) 
and hd_demo_sk is not null) (type: boolean)
+                                          |           Statistics:Num rows: 800 
Data size: 85600 Basic stats: COMPLETE Column stats: NONE
+                                          |           TableScan [TS_9]
+                                          |              
alias:household_demographics
+                                          |              Statistics:Num rows: 
7200 Data size: 770400 Basic stats: COMPLETE Column stats: NONE
+                                          |<-Reducer 3 [SIMPLE_EDGE]
+                                             Reduce Output Operator [RS_23]
+                                                key expressions:_col2 (type: 
int)
+                                                Map-reduce partition 
columns:_col2 (type: int)
+                                                sort order:+
+                                                Statistics:Num rows: 44193 
Data size: 49453132 Basic stats: COMPLETE Column stats: NONE
+                                                value expressions:_col1 (type: 
int), _col4 (type: int)
+                                                Merge Join Operator 
[MERGEJOIN_67]
+                                                |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                                                |  keys:{"0":"_col3 (type: 
int)","1":"_col0 (type: int)"}
+                                                |  
outputColumnNames:["_col1","_col2","_col4"]
+                                                |  Statistics:Num rows: 44193 
Data size: 49453132 Basic stats: COMPLETE Column stats: NONE
+                                                |<-Map 9 [SIMPLE_EDGE]
+                                                |  Reduce Output Operator 
[RS_20]
+                                                |     key expressions:_col0 
(type: int)
+                                                |     Map-reduce partition 
columns:_col0 (type: int)
+                                                |     sort order:+
+                                                |     Statistics:Num rows: 852 
Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
+                                                |     Select Operator [SEL_8]
+                                                |        
outputColumnNames:["_col0"]
+                                                |        Statistics:Num rows: 
852 Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
+                                                |        Filter Operator 
[FIL_63]
+                                                |           
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) (type: boolean)
+                                                |           Statistics:Num 
rows: 852 Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
+                                                |           TableScan [TS_6]
+                                                |              alias:store
+                                                |              Statistics:Num 
rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                                                |<-Reducer 2 [SIMPLE_EDGE]
+                                                   Reduce Output Operator 
[RS_18]
+                                                      key expressions:_col3 
(type: int)
+                                                      Map-reduce partition 
columns:_col3 (type: int)
+                                                      sort order:+
+                                                      Statistics:Num rows: 
40176 Data size: 44957392 Basic stats: COMPLETE Column stats: NONE
+                                                      value expressions:_col1 
(type: int), _col2 (type: int), _col4 (type: int)
+                                                      Merge Join Operator 
[MERGEJOIN_66]
+                                                      |  condition 
map:[{"":"Inner Join 0 to 1"}]
+                                                      |  keys:{"0":"_col0 
(type: int)","1":"_col0 (type: int)"}
+                                                      |  
outputColumnNames:["_col1","_col2","_col3","_col4"]
+                                                      |  Statistics:Num rows: 
40176 Data size: 44957392 Basic stats: COMPLETE Column stats: NONE
+                                                      |<-Map 1 [SIMPLE_EDGE]
+                                                      |  Reduce Output 
Operator [RS_13]
+                                                      |     key 
expressions:_col0 (type: int)
+                                                      |     Map-reduce 
partition columns:_col0 (type: int)
+                                                      |     sort order:+
+                                                      |     Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                      |     value 
expressions:_col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 
(type: int)
+                                                      |     Select Operator 
[SEL_2]
+                                                      |        
outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+                                                      |        Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                      |        Filter Operator 
[FIL_61]
+                                                      |           
predicate:(((ss_sold_date_sk is not null and ss_store_sk is not null) and 
ss_hdemo_sk is not null) and ss_customer_sk is not null) (type: boolean)
+                                                      |           
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                      |           TableScan 
[TS_0]
+                                                      |              
alias:store_sales
+                                                      |              
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                      |<-Map 8 [SIMPLE_EDGE]
+                                                         Reduce Output 
Operator [RS_15]
+                                                            key 
expressions:_col0 (type: int)
+                                                            Map-reduce 
partition columns:_col0 (type: int)
+                                                            sort order:+
+                                                            Statistics:Num 
rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
+                                                            Select Operator 
[SEL_5]
+                                                               
outputColumnNames:["_col0"]
+                                                               Statistics:Num 
rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
+                                                               Filter Operator 
[FIL_62]
+                                                                  
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) (type: boolean)
+                                                                  
Statistics:Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column 
stats: NONE
+                                                                  TableScan 
[TS_3]
+                                                                     
alias:date_dim
+                                                                     
Statistics:Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column 
stats: NONE
+

http://git-wip-us.apache.org/repos/asf/hive/blob/09b6f9a3/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
new file mode 100644
index 0000000..0ad62cc
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query39.q.out
@@ -0,0 +1,313 @@
+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: 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: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 12 <- Map 11 (SIMPLE_EDGE), Map 16 (SIMPLE_EDGE)
+Reducer 13 <- Map 17 (SIMPLE_EDGE), Reducer 12 (SIMPLE_EDGE)
+Reducer 14 <- Map 18 (SIMPLE_EDGE), Reducer 13 (SIMPLE_EDGE)
+Reducer 15 <- Reducer 14 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
+Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 15 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+
+Stage-0
+   Fetch Operator
+      limit:-1
+      Stage-1
+         Reducer 7
+         File Output Operator [FS_76]
+            compressed:false
+            Statistics:Num rows: 112735 Data size: 161919824 Basic stats: 
COMPLETE Column stats: NONE
+            table:{"input 
format:":"org.apache.hadoop.mapred.TextInputFormat","output 
format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat","serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"}
+            Select Operator [SEL_75]
+            |  
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
+            |  Statistics:Num rows: 112735 Data size: 161919824 Basic stats: 
COMPLETE Column stats: NONE
+            |<-Reducer 6 [SIMPLE_EDGE]
+               Reduce Output Operator [RS_74]
+                  key expressions:_col0 (type: int), _col1 (type: int), _col2 
(type: int), _col3 (type: double), _col4 (type: double), _col7 (type: int), 
_col8 (type: double), _col9 (type: double)
+                  sort order:++++++++
+                  Statistics:Num rows: 112735 Data size: 161919824 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions:_col5 (type: int), _col6 (type: int)
+                  Select Operator [SEL_73]
+                     
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
+                     Statistics:Num rows: 112735 Data size: 161919824 Basic 
stats: COMPLETE Column stats: NONE
+                     Merge Join Operator [MERGEJOIN_121]
+                     |  condition map:[{"":"Inner Join 0 to 1"}]
+                     |  keys:{"0":"_col2 (type: int), _col1 (type: 
int)","1":"_col2 (type: int), _col1 (type: int)"}
+                     |  
outputColumnNames:["_col1","_col2","_col3","_col4","_col5","_col7","_col8","_col9","_col10","_col11"]
+                     |  Statistics:Num rows: 112735 Data size: 161919824 Basic 
stats: COMPLETE Column stats: NONE
+                     |<-Reducer 15 [SIMPLE_EDGE]
+                     |  Reduce Output Operator [RS_71]
+                     |     key expressions:_col2 (type: int), _col1 (type: int)
+                     |     Map-reduce partition columns:_col2 (type: int), 
_col1 (type: int)
+                     |     sort order:++
+                     |     Statistics:Num rows: 102487 Data size: 147199837 
Basic stats: COMPLETE Column stats: NONE
+                     |     value expressions:_col3 (type: int), _col4 (type: 
double), _col5 (type: double)
+                     |     Select Operator [SEL_65]
+                     |        
outputColumnNames:["_col1","_col2","_col3","_col4","_col5"]
+                     |        Statistics:Num rows: 102487 Data size: 147199837 
Basic stats: COMPLETE Column stats: NONE
+                     |        Filter Operator [FIL_108]
+                     |           predicate:(CASE (_col5) WHEN (0) THEN (0) 
ELSE ((_col4 / _col5)) END > 1.0) (type: boolean)
+                     |           Statistics:Num rows: 102487 Data size: 
147199837 Basic stats: COMPLETE Column stats: NONE
+                     |           Select Operator [SEL_113]
+                     |              
outputColumnNames:["_col0","_col1","_col3","_col4","_col5"]
+                     |              Statistics:Num rows: 307461 Data size: 
441599512 Basic stats: COMPLETE Column stats: NONE
+                     |              Group By Operator [GBY_64]
+                     |              |  
aggregations:["stddev_samp(VALUE._col0)","avg(VALUE._col1)"]
+                     |              |  keys:KEY._col0 (type: int), KEY._col1 
(type: int), KEY._col2 (type: string), KEY._col3 (type: int)
+                     |              |  
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                     |              |  Statistics:Num rows: 307461 Data size: 
441599512 Basic stats: COMPLETE Column stats: NONE
+                     |              |<-Reducer 14 [SIMPLE_EDGE]
+                     |                 Reduce Output Operator [RS_63]
+                     |                    key expressions:_col0 (type: int), 
_col1 (type: int), _col2 (type: string), _col3 (type: int)
+                     |                    Map-reduce partition columns:_col0 
(type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int)
+                     |                    sort order:++++
+                     |                    Statistics:Num rows: 614922 Data 
size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                     |                    value expressions:_col4 (type: 
struct<count:bigint,sum:double,variance:double>), _col5 (type: 
struct<count:bigint,sum:double,input:int>)
+                     |                    Group By Operator [GBY_62]
+                     |                       
aggregations:["stddev_samp(_col3)","avg(_col3)"]
+                     |                       keys:_col4 (type: int), _col5 
(type: int), _col6 (type: string), _col9 (type: int)
+                     |                       
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                     |                       Statistics:Num rows: 614922 Data 
size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                     |                       Select Operator [SEL_61]
+                     |                          
outputColumnNames:["_col4","_col5","_col6","_col9","_col3"]
+                     |                          Statistics:Num rows: 614922 
Data size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                     |                          Merge Join Operator 
[MERGEJOIN_120]
+                     |                          |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                     |                          |  keys:{"0":"_col0 (type: 
int)","1":"_col0 (type: int)"}
+                     |                          |  
outputColumnNames:["_col3","_col4","_col5","_col6"]
+                     |                          |  Statistics:Num rows: 614922 
Data size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                     |                          |<-Map 18 [SIMPLE_EDGE]
+                     |                          |  Reduce Output Operator 
[RS_59]
+                     |                          |     key expressions:_col0 
(type: int)
+                     |                          |     Map-reduce partition 
columns:_col0 (type: int)
+                     |                          |     sort order:+
+                     |                          |     Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                     |                          |     Select Operator [SEL_45]
+                     |                          |        
outputColumnNames:["_col0"]
+                     |                          |        Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                     |                          |        Filter Operator 
[FIL_112]
+                     |                          |           predicate:(((d_moy 
= 4) and d_date_sk is not null) and (d_year = 1999)) (type: boolean)
+                     |                          |           Statistics:Num 
rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                     |                          |           TableScan [TS_43]
+                     |                          |              alias:date_dim
+                     |                          |              Statistics:Num 
rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+                     |                          |<-Reducer 13 [SIMPLE_EDGE]
+                     |                             Reduce Output Operator 
[RS_57]
+                     |                                key expressions:_col0 
(type: int)
+                     |                                Map-reduce partition 
columns:_col0 (type: int)
+                     |                                sort order:+
+                     |                                Statistics:Num rows: 
559020 Data size: 802908187 Basic stats: COMPLETE Column stats: NONE
+                     |                                value expressions:_col3 
(type: int), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                     |                                Merge Join Operator 
[MERGEJOIN_119]
+                     |                                |  condition 
map:[{"":"Inner Join 0 to 1"}]
+                     |                                |  keys:{"0":"_col2 
(type: int)","1":"_col0 (type: int)"}
+                     |                                |  
outputColumnNames:["_col0","_col3","_col4","_col5","_col6"]
+                     |                                |  Statistics:Num rows: 
559020 Data size: 802908187 Basic stats: COMPLETE Column stats: NONE
+                     |                                |<-Map 17 [SIMPLE_EDGE]
+                     |                                |  Reduce Output 
Operator [RS_54]
+                     |                                |     key 
expressions:_col0 (type: int)
+                     |                                |     Map-reduce 
partition columns:_col0 (type: int)
+                     |                                |     sort order:+
+                     |                                |     Statistics:Num 
rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                     |                                |     value 
expressions:_col1 (type: string)
+                     |                                |     Select Operator 
[SEL_42]
+                     |                                |        
outputColumnNames:["_col0","_col1"]
+                     |                                |        Statistics:Num 
rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                     |                                |        Filter Operator 
[FIL_111]
+                     |                                |           
predicate:w_warehouse_sk is not null (type: boolean)
+                     |                                |           
Statistics:Num rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: 
NONE
+                     |                                |           TableScan 
[TS_40]
+                     |                                |              
alias:warehouse
+                     |                                |              
Statistics:Num rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: 
NONE
+                     |                                |<-Reducer 12 
[SIMPLE_EDGE]
+                     |                                   Reduce Output 
Operator [RS_52]
+                     |                                      key 
expressions:_col2 (type: int)
+                     |                                      Map-reduce 
partition columns:_col2 (type: int)
+                     |                                      sort order:+
+                     |                                      Statistics:Num 
rows: 508200 Data size: 729916518 Basic stats: COMPLETE Column stats: NONE
+                     |                                      value 
expressions:_col0 (type: int), _col3 (type: int), _col4 (type: int)
+                     |                                      Merge Join 
Operator [MERGEJOIN_118]
+                     |                                      |  condition 
map:[{"":"Inner Join 0 to 1"}]
+                     |                                      |  
keys:{"0":"_col1 (type: int)","1":"_col0 (type: int)"}
+                     |                                      |  
outputColumnNames:["_col0","_col2","_col3","_col4"]
+                     |                                      |  Statistics:Num 
rows: 508200 Data size: 729916518 Basic stats: COMPLETE Column stats: NONE
+                     |                                      |<-Map 11 
[SIMPLE_EDGE]
+                     |                                      |  Reduce Output 
Operator [RS_47]
+                     |                                      |     key 
expressions:_col1 (type: int)
+                     |                                      |     Map-reduce 
partition columns:_col1 (type: int)
+                     |                                      |     sort order:+
+                     |                                      |     
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                     |                                      |     value 
expressions:_col0 (type: int), _col2 (type: int), _col3 (type: int)
+                     |                                      |     Select 
Operator [SEL_36]
+                     |                                      |        
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                     |                                      |        
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                     |                                      |        Filter 
Operator [FIL_109]
+                     |                                      |           
predicate:((inv_item_sk is not null and inv_warehouse_sk is not null) and 
inv_date_sk is not null) (type: boolean)
+                     |                                      |           
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                     |                                      |           
TableScan [TS_34]
+                     |                                      |              
alias:inventory
+                     |                                      |              
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                     |                                      |<-Map 16 
[SIMPLE_EDGE]
+                     |                                         Reduce Output 
Operator [RS_49]
+                     |                                            key 
expressions:_col0 (type: int)
+                     |                                            Map-reduce 
partition columns:_col0 (type: int)
+                     |                                            sort order:+
+                     |                                            
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                     |                                            Select 
Operator [SEL_39]
+                     |                                               
outputColumnNames:["_col0"]
+                     |                                               
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                     |                                               Filter 
Operator [FIL_110]
+                     |                                                  
predicate:i_item_sk is not null (type: boolean)
+                     |                                                  
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                     |                                                  
TableScan [TS_37]
+                     |                                                     
alias:item
+                     |                                                     
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                     |<-Reducer 5 [SIMPLE_EDGE]
+                        Reduce Output Operator [RS_69]
+                           key expressions:_col2 (type: int), _col1 (type: int)
+                           Map-reduce partition columns:_col2 (type: int), 
_col1 (type: int)
+                           sort order:++
+                           Statistics:Num rows: 102487 Data size: 147199837 
Basic stats: COMPLETE Column stats: NONE
+                           value expressions:_col3 (type: int), _col4 (type: 
double), _col5 (type: double)
+                           Select Operator [SEL_31]
+                              
outputColumnNames:["_col1","_col2","_col3","_col4","_col5"]
+                              Statistics:Num rows: 102487 Data size: 147199837 
Basic stats: COMPLETE Column stats: NONE
+                              Filter Operator [FIL_103]
+                                 predicate:(CASE (_col5) WHEN (0) THEN (0) 
ELSE ((_col4 / _col5)) END > 1.0) (type: boolean)
+                                 Statistics:Num rows: 102487 Data size: 
147199837 Basic stats: COMPLETE Column stats: NONE
+                                 Select Operator [SEL_114]
+                                    
outputColumnNames:["_col0","_col1","_col3","_col4","_col5"]
+                                    Statistics:Num rows: 307461 Data size: 
441599512 Basic stats: COMPLETE Column stats: NONE
+                                    Group By Operator [GBY_30]
+                                    |  
aggregations:["stddev_samp(VALUE._col0)","avg(VALUE._col1)"]
+                                    |  keys:KEY._col0 (type: int), KEY._col1 
(type: int), KEY._col2 (type: string), KEY._col3 (type: int)
+                                    |  
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                                    |  Statistics:Num rows: 307461 Data size: 
441599512 Basic stats: COMPLETE Column stats: NONE
+                                    |<-Reducer 4 [SIMPLE_EDGE]
+                                       Reduce Output Operator [RS_29]
+                                          key expressions:_col0 (type: int), 
_col1 (type: int), _col2 (type: string), _col3 (type: int)
+                                          Map-reduce partition columns:_col0 
(type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int)
+                                          sort order:++++
+                                          Statistics:Num rows: 614922 Data 
size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                                          value expressions:_col4 (type: 
struct<count:bigint,sum:double,variance:double>), _col5 (type: 
struct<count:bigint,sum:double,input:int>)
+                                          Group By Operator [GBY_28]
+                                             
aggregations:["stddev_samp(_col3)","avg(_col3)"]
+                                             keys:_col4 (type: int), _col5 
(type: int), _col6 (type: string), _col9 (type: int)
+                                             
outputColumnNames:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                                             Statistics:Num rows: 614922 Data 
size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                                             Select Operator [SEL_27]
+                                                
outputColumnNames:["_col4","_col5","_col6","_col9","_col3"]
+                                                Statistics:Num rows: 614922 
Data size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                                                Merge Join Operator 
[MERGEJOIN_117]
+                                                |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                                                |  keys:{"0":"_col0 (type: 
int)","1":"_col0 (type: int)"}
+                                                |  
outputColumnNames:["_col3","_col4","_col5","_col6"]
+                                                |  Statistics:Num rows: 614922 
Data size: 883199024 Basic stats: COMPLETE Column stats: NONE
+                                                |<-Map 10 [SIMPLE_EDGE]
+                                                |  Reduce Output Operator 
[RS_25]
+                                                |     key expressions:_col0 
(type: int)
+                                                |     Map-reduce partition 
columns:_col0 (type: int)
+                                                |     sort order:+
+                                                |     Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                                |     Select Operator [SEL_11]
+                                                |        
outputColumnNames:["_col0"]
+                                                |        Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                                |        Filter Operator 
[FIL_107]
+                                                |           predicate:(((d_moy 
= 3) and d_date_sk is not null) and (d_year = 1999)) (type: boolean)
+                                                |           Statistics:Num 
rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                                |           TableScan [TS_9]
+                                                |              alias:date_dim
+                                                |              Statistics:Num 
rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+                                                |<-Reducer 3 [SIMPLE_EDGE]
+                                                   Reduce Output Operator 
[RS_23]
+                                                      key expressions:_col0 
(type: int)
+                                                      Map-reduce partition 
columns:_col0 (type: int)
+                                                      sort order:+
+                                                      Statistics:Num rows: 
559020 Data size: 802908187 Basic stats: COMPLETE Column stats: NONE
+                                                      value expressions:_col3 
(type: int), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                                                      Merge Join Operator 
[MERGEJOIN_116]
+                                                      |  condition 
map:[{"":"Inner Join 0 to 1"}]
+                                                      |  keys:{"0":"_col2 
(type: int)","1":"_col0 (type: int)"}
+                                                      |  
outputColumnNames:["_col0","_col3","_col4","_col5","_col6"]
+                                                      |  Statistics:Num rows: 
559020 Data size: 802908187 Basic stats: COMPLETE Column stats: NONE
+                                                      |<-Map 9 [SIMPLE_EDGE]
+                                                      |  Reduce Output 
Operator [RS_20]
+                                                      |     key 
expressions:_col0 (type: int)
+                                                      |     Map-reduce 
partition columns:_col0 (type: int)
+                                                      |     sort order:+
+                                                      |     Statistics:Num 
rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                                                      |     value 
expressions:_col1 (type: string)
+                                                      |     Select Operator 
[SEL_8]
+                                                      |        
outputColumnNames:["_col0","_col1"]
+                                                      |        Statistics:Num 
rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                                                      |        Filter Operator 
[FIL_106]
+                                                      |           
predicate:w_warehouse_sk is not null (type: boolean)
+                                                      |           
Statistics:Num rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: 
NONE
+                                                      |           TableScan 
[TS_6]
+                                                      |              
alias:warehouse
+                                                      |              
Statistics:Num rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: 
NONE
+                                                      |<-Reducer 2 
[SIMPLE_EDGE]
+                                                         Reduce Output 
Operator [RS_18]
+                                                            key 
expressions:_col2 (type: int)
+                                                            Map-reduce 
partition columns:_col2 (type: int)
+                                                            sort order:+
+                                                            Statistics:Num 
rows: 508200 Data size: 729916518 Basic stats: COMPLETE Column stats: NONE
+                                                            value 
expressions:_col0 (type: int), _col3 (type: int), _col4 (type: int)
+                                                            Merge Join 
Operator [MERGEJOIN_115]
+                                                            |  condition 
map:[{"":"Inner Join 0 to 1"}]
+                                                            |  
keys:{"0":"_col1 (type: int)","1":"_col0 (type: int)"}
+                                                            |  
outputColumnNames:["_col0","_col2","_col3","_col4"]
+                                                            |  Statistics:Num 
rows: 508200 Data size: 729916518 Basic stats: COMPLETE Column stats: NONE
+                                                            |<-Map 1 
[SIMPLE_EDGE]
+                                                            |  Reduce Output 
Operator [RS_13]
+                                                            |     key 
expressions:_col1 (type: int)
+                                                            |     Map-reduce 
partition columns:_col1 (type: int)
+                                                            |     sort order:+
+                                                            |     
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                            |     value 
expressions:_col0 (type: int), _col2 (type: int), _col3 (type: int)
+                                                            |     Select 
Operator [SEL_2]
+                                                            |        
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                                            |        
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                            |        Filter 
Operator [FIL_104]
+                                                            |           
predicate:((inv_item_sk is not null and inv_warehouse_sk is not null) and 
inv_date_sk is not null) (type: boolean)
+                                                            |           
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                            |           
TableScan [TS_0]
+                                                            |              
alias:inventory
+                                                            |              
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                            |<-Map 8 
[SIMPLE_EDGE]
+                                                               Reduce Output 
Operator [RS_15]
+                                                                  key 
expressions:_col0 (type: int)
+                                                                  Map-reduce 
partition columns:_col0 (type: int)
+                                                                  sort order:+
+                                                                  
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                                                                  Select 
Operator [SEL_5]
+                                                                     
outputColumnNames:["_col0"]
+                                                                     
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                                                                     Filter 
Operator [FIL_105]
+                                                                        
predicate:i_item_sk is not null (type: boolean)
+                                                                        
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+                                                                        
TableScan [TS_3]
+                                                                           
alias:item
+                                                                           
Statistics:Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column 
stats: NONE
+
+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: 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: type: QUERY
+POSTHOOK: Input: default@date_dim
+POSTHOOK: Input: default@inventory
+POSTHOOK: Input: default@item
+POSTHOOK: Input: default@warehouse
+#### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/09b6f9a3/ql/src/test/results/clientpositive/perf/query40.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query40.q.out 
b/ql/src/test/results/clientpositive/perf/query40.q.out
new file mode 100644
index 0000000..08c3e49
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query40.q.out
@@ -0,0 +1,177 @@
+PREHOOK: query: explain select w_state ,i_item_id ,sum(case when (cast(d_date 
as date) < cast ('1998-04-08' as date)) then cs_sales_price - 
coalesce(cr_refunded_cash,0) else 0 end) as sales_before ,sum(case when 
(cast(d_date as date) >= cast ('1998-04-08' as date)) then cs_sales_price - 
coalesce(cr_refunded_cash,0) else 0 end) as sales_after from catalog_sales left 
outer join catalog_returns on (catalog_sales.cs_order_number = 
catalog_returns.cr_order_number and catalog_sales.cs_item_sk = 
catalog_returns.cr_item_sk) ,warehouse ,item ,date_dim where i_current_price 
between 0.99 and 1.49 and item.i_item_sk = catalog_sales.cs_item_sk and 
catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk and 
catalog_sales.cs_sold_date_sk = date_dim.d_date_sk and date_dim.d_date between 
'1998-03-09' and '1998-05-08' group by w_state,i_item_id order by 
w_state,i_item_id limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select w_state ,i_item_id ,sum(case when (cast(d_date 
as date) < cast ('1998-04-08' as date)) then cs_sales_price - 
coalesce(cr_refunded_cash,0) else 0 end) as sales_before ,sum(case when 
(cast(d_date as date) >= cast ('1998-04-08' as date)) then cs_sales_price - 
coalesce(cr_refunded_cash,0) else 0 end) as sales_after from catalog_sales left 
outer join catalog_returns on (catalog_sales.cs_order_number = 
catalog_returns.cr_order_number and catalog_sales.cs_item_sk = 
catalog_returns.cr_item_sk) ,warehouse ,item ,date_dim where i_current_price 
between 0.99 and 1.49 and item.i_item_sk = catalog_sales.cs_item_sk and 
catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk and 
catalog_sales.cs_sold_date_sk = date_dim.d_date_sk and date_dim.d_date between 
'1998-03-09' and '1998-05-08' group by w_state,i_item_id order by 
w_state,i_item_id limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
+Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Map 11 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+
+Stage-0
+   Fetch Operator
+      limit:100
+      Stage-1
+         Reducer 7
+         File Output Operator [FS_41]
+            compressed:false
+            Statistics:Num rows: 100 Data size: 143600 Basic stats: COMPLETE 
Column stats: NONE
+            table:{"input 
format:":"org.apache.hadoop.mapred.TextInputFormat","output 
format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat","serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"}
+            Limit [LIM_40]
+               Number of rows:100
+               Statistics:Num rows: 100 Data size: 143600 Basic stats: 
COMPLETE Column stats: NONE
+               Select Operator [SEL_39]
+               |  outputColumnNames:["_col0","_col1","_col2","_col3"]
+               |  Statistics:Num rows: 139755 Data size: 200727046 Basic 
stats: COMPLETE Column stats: NONE
+               |<-Reducer 6 [SIMPLE_EDGE]
+                  Reduce Output Operator [RS_38]
+                     key expressions:_col0 (type: string), _col1 (type: string)
+                     sort order:++
+                     Statistics:Num rows: 139755 Data size: 200727046 Basic 
stats: COMPLETE Column stats: NONE
+                     value expressions:_col2 (type: decimal(23,2)), _col3 
(type: decimal(23,2))
+                     Group By Operator [GBY_36]
+                     |  aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
+                     |  keys:KEY._col0 (type: string), KEY._col1 (type: string)
+                     |  outputColumnNames:["_col0","_col1","_col2","_col3"]
+                     |  Statistics:Num rows: 139755 Data size: 200727046 Basic 
stats: COMPLETE Column stats: NONE
+                     |<-Reducer 5 [SIMPLE_EDGE]
+                        Reduce Output Operator [RS_35]
+                           key expressions:_col0 (type: string), _col1 (type: 
string)
+                           Map-reduce partition columns:_col0 (type: string), 
_col1 (type: string)
+                           sort order:++
+                           Statistics:Num rows: 279510 Data size: 401454092 
Basic stats: COMPLETE Column stats: NONE
+                           value expressions:_col2 (type: decimal(23,2)), 
_col3 (type: decimal(23,2))
+                           Group By Operator [GBY_34]
+                              aggregations:["sum(_col2)","sum(_col3)"]
+                              keys:_col0 (type: string), _col1 (type: string)
+                              
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                              Statistics:Num rows: 279510 Data size: 401454092 
Basic stats: COMPLETE Column stats: NONE
+                              Select Operator [SEL_32]
+                                 
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                 Statistics:Num rows: 279510 Data size: 
401454092 Basic stats: COMPLETE Column stats: NONE
+                                 Merge Join Operator [MERGEJOIN_63]
+                                 |  condition map:[{"":"Inner Join 0 to 1"}]
+                                 |  keys:{"0":"_col0 (type: int)","1":"_col0 
(type: int)"}
+                                 |  
outputColumnNames:["_col4","_col7","_col9","_col11","_col14"]
+                                 |  Statistics:Num rows: 279510 Data size: 
401454092 Basic stats: COMPLETE Column stats: NONE
+                                 |<-Map 11 [SIMPLE_EDGE]
+                                 |  Reduce Output Operator [RS_30]
+                                 |     key expressions:_col0 (type: int)
+                                 |     Map-reduce partition columns:_col0 
(type: int)
+                                 |     sort order:+
+                                 |     Statistics:Num rows: 36524 Data size: 
40870356 Basic stats: COMPLETE Column stats: NONE
+                                 |     value expressions:_col1 (type: string)
+                                 |     Select Operator [SEL_13]
+                                 |        outputColumnNames:["_col0","_col1"]
+                                 |        Statistics:Num rows: 36524 Data 
size: 40870356 Basic stats: COMPLETE Column stats: NONE
+                                 |        Filter Operator [FIL_59]
+                                 |           predicate:(d_date BETWEEN 
'1998-03-09' AND '1998-05-08' and d_date_sk is not null) (type: boolean)
+                                 |           Statistics:Num rows: 36524 Data 
size: 40870356 Basic stats: COMPLETE Column stats: NONE
+                                 |           TableScan [TS_11]
+                                 |              alias:date_dim
+                                 |              Statistics:Num rows: 73049 
Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+                                 |<-Reducer 4 [SIMPLE_EDGE]
+                                    Reduce Output Operator [RS_28]
+                                       key expressions:_col0 (type: int)
+                                       Map-reduce partition columns:_col0 
(type: int)
+                                       sort order:+
+                                       Statistics:Num rows: 254100 Data size: 
364958258 Basic stats: COMPLETE Column stats: NONE
+                                       value expressions:_col4 (type: 
decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: string), _col11 (type: 
string)
+                                       Merge Join Operator [MERGEJOIN_62]
+                                       |  condition map:[{"":"Inner Join 0 to 
1"}]
+                                       |  keys:{"0":"_col2 (type: 
int)","1":"_col0 (type: int)"}
+                                       |  
outputColumnNames:["_col0","_col4","_col7","_col9","_col11"]
+                                       |  Statistics:Num rows: 254100 Data 
size: 364958258 Basic stats: COMPLETE Column stats: NONE
+                                       |<-Map 10 [SIMPLE_EDGE]
+                                       |  Reduce Output Operator [RS_25]
+                                       |     key expressions:_col0 (type: int)
+                                       |     Map-reduce partition 
columns:_col0 (type: int)
+                                       |     sort order:+
+                                       |     Statistics:Num rows: 231000 Data 
size: 331780228 Basic stats: COMPLETE Column stats: NONE
+                                       |     value expressions:_col1 (type: 
string)
+                                       |     Select Operator [SEL_10]
+                                       |        
outputColumnNames:["_col0","_col1"]
+                                       |        Statistics:Num rows: 231000 
Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
+                                       |        Filter Operator [FIL_58]
+                                       |           predicate:(i_current_price 
BETWEEN 0.99 AND 1.49 and i_item_sk is not null) (type: boolean)
+                                       |           Statistics:Num rows: 231000 
Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
+                                       |           TableScan [TS_8]
+                                       |              alias:item
+                                       |              Statistics:Num rows: 
462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
+                                       |<-Reducer 3 [SIMPLE_EDGE]
+                                          Reduce Output Operator [RS_23]
+                                             key expressions:_col2 (type: int)
+                                             Map-reduce partition 
columns:_col2 (type: int)
+                                             sort order:+
+                                             Statistics:Num rows: 29 Data 
size: 30582 Basic stats: COMPLETE Column stats: NONE
+                                             value expressions:_col0 (type: 
int), _col4 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: 
string)
+                                             Merge Join Operator [MERGEJOIN_61]
+                                             |  condition map:[{"":"Inner Join 
0 to 1"}]
+                                             |  keys:{"0":"_col1 (type: 
int)","1":"_col0 (type: int)"}
+                                             |  
outputColumnNames:["_col0","_col2","_col4","_col7","_col9"]
+                                             |  Statistics:Num rows: 29 Data 
size: 30582 Basic stats: COMPLETE Column stats: NONE
+                                             |<-Map 9 [SIMPLE_EDGE]
+                                             |  Reduce Output Operator [RS_20]
+                                             |     key expressions:_col0 
(type: int)
+                                             |     Map-reduce partition 
columns:_col0 (type: int)
+                                             |     sort order:+
+                                             |     Statistics:Num rows: 27 
Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                                             |     value expressions:_col1 
(type: string)
+                                             |     Select Operator [SEL_7]
+                                             |        
outputColumnNames:["_col0","_col1"]
+                                             |        Statistics:Num rows: 27 
Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                                             |        Filter Operator [FIL_57]
+                                             |           
predicate:w_warehouse_sk is not null (type: boolean)
+                                             |           Statistics:Num rows: 
27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                                             |           TableScan [TS_5]
+                                             |              alias:warehouse
+                                             |              Statistics:Num 
rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
+                                             |<-Reducer 2 [SIMPLE_EDGE]
+                                                Reduce Output Operator [RS_18]
+                                                   key expressions:_col1 
(type: int)
+                                                   Map-reduce partition 
columns:_col1 (type: int)
+                                                   sort order:+
+                                                   Statistics:Num rows: 1 Data 
size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   value expressions:_col0 
(type: int), _col2 (type: int), _col4 (type: decimal(7,2)), _col7 (type: 
decimal(7,2))
+                                                   Merge Join Operator 
[MERGEJOIN_60]
+                                                   |  condition map:[{"":"Left 
Outer Join0 to 1"}]
+                                                   |  keys:{"0":"_col3 (type: 
int), _col2 (type: int)","1":"_col1 (type: int), _col0 (type: int)"}
+                                                   |  
outputColumnNames:["_col0","_col1","_col2","_col4","_col7"]
+                                                   |  Statistics:Num rows: 1 
Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   |<-Map 1 [SIMPLE_EDGE]
+                                                   |  Reduce Output Operator 
[RS_14]
+                                                   |     key expressions:_col3 
(type: int), _col2 (type: int)
+                                                   |     Map-reduce partition 
columns:_col3 (type: int), _col2 (type: int)
+                                                   |     sort order:++
+                                                   |     Statistics:Num rows: 
1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   |     value 
expressions:_col0 (type: int), _col1 (type: int), _col4 (type: decimal(7,2))
+                                                   |     Select Operator 
[SEL_2]
+                                                   |        
outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+                                                   |        Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   |        Filter Operator 
[FIL_55]
+                                                   |           
predicate:((cs_warehouse_sk is not null and cs_item_sk is not null) and 
cs_sold_date_sk is not null) (type: boolean)
+                                                   |           Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   |           TableScan [TS_0]
+                                                   |              
alias:catalog_sales
+                                                   |              
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   |<-Map 8 [SIMPLE_EDGE]
+                                                      Reduce Output Operator 
[RS_15]
+                                                         key expressions:_col1 
(type: int), _col0 (type: int)
+                                                         Map-reduce partition 
columns:_col1 (type: int), _col0 (type: int)
+                                                         sort order:++
+                                                         Statistics:Num rows: 
1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                         value 
expressions:_col2 (type: decimal(7,2))
+                                                         Select Operator 
[SEL_4]
+                                                            
outputColumnNames:["_col0","_col1","_col2"]
+                                                            Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                            Filter Operator 
[FIL_56]
+                                                               
predicate:cr_item_sk is not null (type: boolean)
+                                                               Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                               TableScan [TS_3]
+                                                                  
alias:catalog_returns
+                                                                  
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+

http://git-wip-us.apache.org/repos/asf/hive/blob/09b6f9a3/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
new file mode 100644
index 0000000..a3264c7
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query42.q.out
@@ -0,0 +1,117 @@
+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: 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: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+Reducer 3 <- Map 7 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+
+Stage-0
+   Fetch Operator
+      limit:100
+      Stage-1
+         Reducer 5
+         File Output Operator [FS_27]
+            compressed:false
+            Statistics:Num rows: 100 Data size: 143600 Basic stats: COMPLETE 
Column stats: NONE
+            table:{"input 
format:":"org.apache.hadoop.mapred.TextInputFormat","output 
format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat","serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"}
+            Limit [LIM_26]
+               Number of rows:100
+               Statistics:Num rows: 100 Data size: 143600 Basic stats: 
COMPLETE Column stats: NONE
+               Select Operator [SEL_25]
+               |  outputColumnNames:["_col0","_col1","_col2","_col3"]
+               |  Statistics:Num rows: 127050 Data size: 182479129 Basic 
stats: COMPLETE Column stats: NONE
+               |<-Reducer 4 [SIMPLE_EDGE]
+                  Reduce Output Operator [RS_24]
+                     key expressions:_col3 (type: decimal(17,2)), _col0 (type: 
int), _col1 (type: int), _col2 (type: string)
+                     sort order:-+++
+                     Statistics:Num rows: 127050 Data size: 182479129 Basic 
stats: COMPLETE Column stats: NONE
+                     Group By Operator [GBY_22]
+                     |  aggregations:["sum(VALUE._col0)"]
+                     |  keys:KEY._col0 (type: int), KEY._col1 (type: int), 
KEY._col2 (type: string)
+                     |  outputColumnNames:["_col0","_col1","_col2","_col3"]
+                     |  Statistics:Num rows: 127050 Data size: 182479129 Basic 
stats: COMPLETE Column stats: NONE
+                     |<-Reducer 3 [SIMPLE_EDGE]
+                        Reduce Output Operator [RS_21]
+                           key expressions:_col0 (type: int), _col1 (type: 
int), _col2 (type: string)
+                           Map-reduce partition columns:_col0 (type: int), 
_col1 (type: int), _col2 (type: string)
+                           sort order:+++
+                           Statistics:Num rows: 254100 Data size: 364958258 
Basic stats: COMPLETE Column stats: NONE
+                           value expressions:_col3 (type: decimal(17,2))
+                           Group By Operator [GBY_20]
+                              aggregations:["sum(_col5)"]
+                              keys:_col1 (type: int), _col7 (type: int), _col8 
(type: string)
+                              
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                              Statistics:Num rows: 254100 Data size: 364958258 
Basic stats: COMPLETE Column stats: NONE
+                              Select Operator [SEL_19]
+                                 
outputColumnNames:["_col1","_col7","_col8","_col5"]
+                                 Statistics:Num rows: 254100 Data size: 
364958258 Basic stats: COMPLETE Column stats: NONE
+                                 Merge Join Operator [MERGEJOIN_37]
+                                 |  condition map:[{"":"Inner Join 0 to 1"}]
+                                 |  keys:{"0":"_col4 (type: int)","1":"_col0 
(type: int)"}
+                                 |  outputColumnNames:["_col5","_col7","_col8"]
+                                 |  Statistics:Num rows: 254100 Data size: 
364958258 Basic stats: COMPLETE Column stats: NONE
+                                 |<-Map 7 [SIMPLE_EDGE]
+                                 |  Reduce Output Operator [RS_17]
+                                 |     key expressions:_col0 (type: int)
+                                 |     Map-reduce partition columns:_col0 
(type: int)
+                                 |     sort order:+
+                                 |     Statistics:Num rows: 231000 Data size: 
331780228 Basic stats: COMPLETE Column stats: NONE
+                                 |     value expressions:_col1 (type: int), 
_col2 (type: string)
+                                 |     Select Operator [SEL_8]
+                                 |        
outputColumnNames:["_col0","_col1","_col2"]
+                                 |        Statistics:Num rows: 231000 Data 
size: 331780228 Basic stats: COMPLETE Column stats: NONE
+                                 |        Filter Operator [FIL_35]
+                                 |           predicate:((i_manager_id = 1) and 
i_item_sk is not null) (type: boolean)
+                                 |           Statistics:Num rows: 231000 Data 
size: 331780228 Basic stats: COMPLETE Column stats: NONE
+                                 |           TableScan [TS_6]
+                                 |              alias:item
+                                 |              Statistics:Num rows: 462000 
Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
+                                 |<-Reducer 2 [SIMPLE_EDGE]
+                                    Reduce Output Operator [RS_15]
+                                       key expressions:_col4 (type: int)
+                                       Map-reduce partition columns:_col4 
(type: int)
+                                       sort order:+
+                                       Statistics:Num rows: 20088 Data size: 
22478696 Basic stats: COMPLETE Column stats: NONE
+                                       value expressions:_col5 (type: 
decimal(7,2))
+                                       Merge Join Operator [MERGEJOIN_36]
+                                       |  condition map:[{"":"Inner Join 0 to 
1"}]
+                                       |  keys:{"0":"_col0 (type: 
int)","1":"_col0 (type: int)"}
+                                       |  outputColumnNames:["_col4","_col5"]
+                                       |  Statistics:Num rows: 20088 Data 
size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                       |<-Map 1 [SIMPLE_EDGE]
+                                       |  Reduce Output Operator [RS_10]
+                                       |     key expressions:_col0 (type: int)
+                                       |     Map-reduce partition 
columns:_col0 (type: int)
+                                       |     sort order:+
+                                       |     Statistics:Num rows: 18262 Data 
size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |     Select Operator [SEL_2]
+                                       |        outputColumnNames:["_col0"]
+                                       |        Statistics:Num rows: 18262 
Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |        Filter Operator [FIL_33]
+                                       |           predicate:(((d_year = 1998) 
and (d_moy = 12)) and d_date_sk is not null) (type: boolean)
+                                       |           Statistics:Num rows: 18262 
Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |           TableScan [TS_0]
+                                       |              alias:dt
+                                       |              Statistics:Num rows: 
73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+                                       |<-Map 6 [SIMPLE_EDGE]
+                                          Reduce Output Operator [RS_12]
+                                             key expressions:_col0 (type: int)
+                                             Map-reduce partition 
columns:_col0 (type: int)
+                                             sort order:+
+                                             Statistics:Num rows: 1 Data size: 
0 Basic stats: PARTIAL Column stats: NONE
+                                             value expressions:_col1 (type: 
int), _col2 (type: decimal(7,2))
+                                             Select Operator [SEL_5]
+                                                
outputColumnNames:["_col0","_col1","_col2"]
+                                                Statistics:Num rows: 1 Data 
size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                Filter Operator [FIL_34]
+                                                   predicate:(ss_sold_date_sk 
is not null and ss_item_sk is not null) (type: boolean)
+                                                   Statistics:Num rows: 1 Data 
size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                   TableScan [TS_3]
+                                                      alias:store_sales
+                                                      Statistics:Num rows: 1 
Data size: 0 Basic stats: PARTIAL Column stats: NONE
+

Reply via email to