http://git-wip-us.apache.org/repos/asf/hive/blob/09b6f9a3/ql/src/test/results/clientpositive/perf/query70.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query70.q.out 
b/ql/src/test/results/clientpositive/perf/query70.q.out
new file mode 100644
index 0000000..22a94b0
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query70.q.out
@@ -0,0 +1,268 @@
+PREHOOK: query: explain select sum(ss_net_profit) as total_sum ,s_state 
,s_county ,grouping__id as lochierarchy , rank() over(partition by 
grouping__id, case when grouping__id == 2 then s_state end order by 
sum(ss_net_profit)) as rank_within_parent from store_sales ss join date_dim d1 
on d1.d_date_sk = ss.ss_sold_date_sk join store s on s.s_store_sk = 
ss.ss_store_sk where d1.d_month_seq between 1193 and 1193+11 and s.s_state in ( 
select s_state from (select s_state as s_state, sum(ss_net_profit), rank() over 
( partition by s_state order by sum(ss_net_profit) desc) as ranking from 
store_sales, store, date_dim where d_month_seq between 1193 and 1193+11 and 
date_dim.d_date_sk = store_sales.ss_sold_date_sk and store.s_store_sk = 
store_sales.ss_store_sk group by s_state ) tmp1 where ranking <= 5 ) group by 
s_state,s_county with rollup order by lochierarchy desc ,case when lochierarchy 
= 0 then s_state end ,rank_within_parent limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select sum(ss_net_profit) as total_sum ,s_state 
,s_county ,grouping__id as lochierarchy , rank() over(partition by 
grouping__id, case when grouping__id == 2 then s_state end order by 
sum(ss_net_profit)) as rank_within_parent from store_sales ss join date_dim d1 
on d1.d_date_sk = ss.ss_sold_date_sk join store s on s.s_store_sk = 
ss.ss_store_sk where d1.d_month_seq between 1193 and 1193+11 and s.s_state in ( 
select s_state from (select s_state as s_state, sum(ss_net_profit), rank() over 
( partition by s_state order by sum(ss_net_profit) desc) as ranking from 
store_sales, store, date_dim where d_month_seq between 1193 and 1193+11 and 
date_dim.d_date_sk = store_sales.ss_sold_date_sk and store.s_store_sk = 
store_sales.ss_store_sk group by s_state ) tmp1 where ranking <= 5 ) group by 
s_state,s_county with rollup order by lochierarchy desc ,case when lochierarchy 
= 0 then s_state end ,rank_within_parent limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 11 <- Map 10 (SIMPLE_EDGE), Map 15 (SIMPLE_EDGE)
+Reducer 12 <- Map 16 (SIMPLE_EDGE), Reducer 11 (SIMPLE_EDGE)
+Reducer 13 <- Reducer 12 (SIMPLE_EDGE)
+Reducer 14 <- Reducer 13 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 9 <- Map 8 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
+
+Stage-0
+   Fetch Operator
+      limit:100
+      Stage-1
+         Reducer 6
+         File Output Operator [FS_71]
+            compressed:false
+            Statistics:Num rows: 100 Data size: 111900 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_70]
+               Number of rows:100
+               Statistics:Num rows: 100 Data size: 111900 Basic stats: 
COMPLETE Column stats: NONE
+               Select Operator [SEL_69]
+               |  outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+               |  Statistics:Num rows: 66289 Data size: 74179138 Basic stats: 
COMPLETE Column stats: NONE
+               |<-Reducer 5 [SIMPLE_EDGE]
+                  Reduce Output Operator [RS_68]
+                     key expressions:_col3 (type: string), CASE WHEN ((_col3 = 
0)) THEN (_col1) END (type: string), _col4 (type: int)
+                     sort order:-++
+                     Statistics:Num rows: 66289 Data size: 74179138 Basic 
stats: COMPLETE Column stats: NONE
+                     value expressions:_col0 (type: decimal(17,2)), _col1 
(type: string), _col2 (type: string)
+                     Select Operator [SEL_66]
+                        
outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+                        Statistics:Num rows: 66289 Data size: 74179138 Basic 
stats: COMPLETE Column stats: NONE
+                        PTF Operator [PTF_65]
+                           Function definitions:[{"Input 
definition":{"type:":"WINDOWING"}},{"name:":"windowingtablefunction","order 
by:":"_col4","partition by:":"_col5, CASE WHEN ((_col5 = 2)) THEN (_col0) END"}]
+                           Statistics:Num rows: 66289 Data size: 74179138 
Basic stats: COMPLETE Column stats: NONE
+                           Select Operator [SEL_64]
+                           |  
outputColumnNames:["_col0","_col1","_col4","_col5"]
+                           |  Statistics:Num rows: 66289 Data size: 74179138 
Basic stats: COMPLETE Column stats: NONE
+                           |<-Reducer 4 [SIMPLE_EDGE]
+                              Reduce Output Operator [RS_63]
+                                 key expressions:_col5 (type: string), CASE 
WHEN ((_col5 = 2)) THEN (_col0) END (type: string), _col4 (type: decimal(17,2))
+                                 Map-reduce partition columns:_col5 (type: 
string), CASE WHEN ((_col5 = 2)) THEN (_col0) END (type: string)
+                                 sort order:+++
+                                 Statistics:Num rows: 66289 Data size: 
74179138 Basic stats: COMPLETE Column stats: NONE
+                                 value expressions:_col0 (type: string), _col1 
(type: string)
+                                 Select Operator [SEL_62]
+                                    
outputColumnNames:["_col0","_col1","_col4","_col5"]
+                                    Statistics:Num rows: 66289 Data size: 
74179138 Basic stats: COMPLETE Column stats: NONE
+                                    Group By Operator [GBY_61]
+                                    |  aggregations:["sum(VALUE._col0)"]
+                                    |  keys:KEY._col0 (type: string), 
KEY._col1 (type: string), KEY._col2 (type: string)
+                                    |  
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                    |  Statistics:Num rows: 66289 Data size: 
74179138 Basic stats: COMPLETE Column stats: NONE
+                                    |<-Reducer 3 [SIMPLE_EDGE]
+                                       Reduce Output Operator [RS_60]
+                                          key expressions:_col0 (type: 
string), _col1 (type: string), _col2 (type: string)
+                                          Map-reduce partition columns:_col0 
(type: string), _col1 (type: string), _col2 (type: string)
+                                          sort order:+++
+                                          Statistics:Num rows: 132579 Data 
size: 148359396 Basic stats: COMPLETE Column stats: NONE
+                                          value expressions:_col3 (type: 
decimal(17,2))
+                                          Group By Operator [GBY_59]
+                                             aggregations:["sum(_col2)"]
+                                             keys:_col6 (type: string), _col7 
(type: string), '0' (type: string)
+                                             
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                             Statistics:Num rows: 132579 Data 
size: 148359396 Basic stats: COMPLETE Column stats: NONE
+                                             Select Operator [SEL_58]
+                                                
outputColumnNames:["_col6","_col7","_col2"]
+                                                Statistics:Num rows: 44193 
Data size: 49453132 Basic stats: COMPLETE Column stats: NONE
+                                                Merge Join Operator 
[MERGEJOIN_100]
+                                                |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                                                |  keys:{"0":"_col1 (type: 
int)","1":"_col0 (type: int)"}
+                                                |  
outputColumnNames:["_col2","_col6","_col7"]
+                                                |  Statistics:Num rows: 44193 
Data size: 49453132 Basic stats: COMPLETE Column stats: NONE
+                                                |<-Reducer 2 [SIMPLE_EDGE]
+                                                |  Reduce Output Operator 
[RS_54]
+                                                |     key expressions:_col1 
(type: int)
+                                                |     Map-reduce partition 
columns:_col1 (type: int)
+                                                |     sort order:+
+                                                |     Statistics:Num rows: 
40176 Data size: 44957392 Basic stats: COMPLETE Column stats: NONE
+                                                |     value expressions:_col2 
(type: decimal(7,2))
+                                                |     Merge Join Operator 
[MERGEJOIN_96]
+                                                |     |  condition 
map:[{"":"Inner Join 0 to 1"}]
+                                                |     |  keys:{"0":"_col0 
(type: int)","1":"_col0 (type: int)"}
+                                                |     |  
outputColumnNames:["_col1","_col2"]
+                                                |     |  Statistics:Num rows: 
40176 Data size: 44957392 Basic stats: COMPLETE Column stats: NONE
+                                                |     |<-Map 1 [SIMPLE_EDGE]
+                                                |     |  Reduce Output 
Operator [RS_49]
+                                                |     |     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_2]
+                                                |     |        
outputColumnNames:["_col0","_col1","_col2"]
+                                                |     |        Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                |     |        Filter Operator 
[FIL_89]
+                                                |     |           
predicate:(ss_sold_date_sk is not null and ss_store_sk is not null) (type: 
boolean)
+                                                |     |           
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                |     |           TableScan 
[TS_0]
+                                                |     |              alias:ss
+                                                |     |              
Statistics:Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                |     |<-Map 7 [SIMPLE_EDGE]
+                                                |        Reduce Output 
Operator [RS_51]
+                                                |           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_90]
+                                                |                 
predicate:(d_month_seq BETWEEN 1193 AND 1204 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:d1
+                                                |                    
Statistics:Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column 
stats: NONE
+                                                |<-Reducer 9 [SIMPLE_EDGE]
+                                                   Reduce Output Operator 
[RS_56]
+                                                      key expressions:_col0 
(type: int)
+                                                      Map-reduce partition 
columns:_col0 (type: int)
+                                                      sort order:+
+                                                      Statistics:Num rows: 
7365 Data size: 8242187 Basic stats: COMPLETE Column stats: NONE
+                                                      value expressions:_col1 
(type: string), _col2 (type: string)
+                                                      Merge Join Operator 
[MERGEJOIN_99]
+                                                      |  condition 
map:[{"":"Left Semi Join 0 to 1"}]
+                                                      |  keys:{"0":"_col2 
(type: string)","1":"_col0 (type: string)"}
+                                                      |  
outputColumnNames:["_col0","_col1","_col2"]
+                                                      |  Statistics:Num rows: 
7365 Data size: 8242187 Basic stats: COMPLETE Column stats: NONE
+                                                      |<-Map 8 [SIMPLE_EDGE]
+                                                      |  Reduce Output 
Operator [RS_43]
+                                                      |     key 
expressions:_col2 (type: string)
+                                                      |     Map-reduce 
partition columns:_col2 (type: string)
+                                                      |     sort order:+
+                                                      |     Statistics:Num 
rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                                                      |     value 
expressions:_col0 (type: int), _col1 (type: string)
+                                                      |     Select Operator 
[SEL_8]
+                                                      |        
outputColumnNames:["_col0","_col1","_col2"]
+                                                      |        Statistics:Num 
rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                                                      |        Filter Operator 
[FIL_91]
+                                                      |           
predicate:(s_store_sk is not null and s_state is not null) (type: boolean)
+                                                      |           
Statistics:Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column 
stats: NONE
+                                                      |           TableScan 
[TS_6]
+                                                      |              alias:s
+                                                      |              
Statistics:Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column 
stats: NONE
+                                                      |<-Reducer 14 
[SIMPLE_EDGE]
+                                                         Reduce Output 
Operator [RS_45]
+                                                            key 
expressions:_col0 (type: string)
+                                                            Map-reduce 
partition columns:_col0 (type: string)
+                                                            sort order:+
+                                                            Statistics:Num 
rows: 6696 Data size: 7492898 Basic stats: COMPLETE Column stats: NONE
+                                                            Group By Operator 
[GBY_41]
+                                                               keys:_col0 
(type: string)
+                                                               
outputColumnNames:["_col0"]
+                                                               Statistics:Num 
rows: 6696 Data size: 7492898 Basic stats: COMPLETE Column stats: NONE
+                                                               Select Operator 
[SEL_35]
+                                                                  
outputColumnNames:["_col0"]
+                                                                  
Statistics:Num rows: 6696 Data size: 7492898 Basic stats: COMPLETE Column 
stats: NONE
+                                                                  Filter 
Operator [FIL_92]
+                                                                     
predicate:((rank_window_0 <= 5) and _col0 is not null) (type: boolean)
+                                                                     
Statistics:Num rows: 6696 Data size: 7492898 Basic stats: COMPLETE Column 
stats: NONE
+                                                                     PTF 
Operator [PTF_34]
+                                                                        
Function definitions:[{"Input 
definition":{"type:":"WINDOWING"}},{"name:":"windowingtablefunction","order 
by:":"_col1(DESC)","partition by:":"_col0"}]
+                                                                        
Statistics:Num rows: 20088 Data size: 22478696 Basic stats: COMPLETE Column 
stats: NONE
+                                                                        Select 
Operator [SEL_33]
+                                                                        |  
outputColumnNames:["_col0","_col1"]
+                                                                        |  
Statistics:Num rows: 20088 Data size: 22478696 Basic stats: COMPLETE Column 
stats: NONE
+                                                                        
|<-Reducer 13 [SIMPLE_EDGE]
+                                                                           
Reduce Output Operator [RS_32]
+                                                                              
key expressions:_col0 (type: string), _col1 (type: decimal(17,2))
+                                                                              
Map-reduce partition columns:_col0 (type: string)
+                                                                              
sort order:+-
+                                                                              
Statistics:Num rows: 20088 Data size: 22478696 Basic stats: COMPLETE Column 
stats: NONE
+                                                                              
value expressions:_col1 (type: decimal(17,2))
+                                                                              
Group By Operator [GBY_31]
+                                                                              
|  aggregations:["sum(VALUE._col0)"]
+                                                                              
|  keys:KEY._col0 (type: string)
+                                                                              
|  outputColumnNames:["_col0","_col1"]
+                                                                              
|  Statistics:Num rows: 20088 Data size: 22478696 Basic stats: COMPLETE Column 
stats: NONE
+                                                                              
|<-Reducer 12 [SIMPLE_EDGE]
+                                                                               
  Reduce Output Operator [RS_30]
+                                                                               
     key expressions:_col0 (type: string)
+                                                                               
     Map-reduce partition columns:_col0 (type: string)
+                                                                               
     sort order:+
+                                                                               
     Statistics:Num rows: 40176 Data size: 44957392 Basic stats: COMPLETE 
Column stats: NONE
+                                                                               
     value expressions:_col1 (type: decimal(17,2))
+                                                                               
     Group By Operator [GBY_29]
+                                                                               
        aggregations:["sum(_col2)"]
+                                                                               
        keys:_col4 (type: string)
+                                                                               
        outputColumnNames:["_col0","_col1"]
+                                                                               
        Statistics:Num rows: 40176 Data size: 44957392 Basic stats: COMPLETE 
Column stats: NONE
+                                                                               
        Select Operator [SEL_28]
+                                                                               
           outputColumnNames:["_col4","_col2"]
+                                                                               
           Statistics:Num rows: 40176 Data size: 44957392 Basic stats: COMPLETE 
Column stats: NONE
+                                                                               
           Merge Join Operator [MERGEJOIN_98]
+                                                                               
           |  condition map:[{"":"Inner Join 0 to 1"}]
+                                                                               
           |  keys:{"0":"_col0 (type: int)","1":"_col0 (type: int)"}
+                                                                               
           |  outputColumnNames:["_col2","_col4"]
+                                                                               
           |  Statistics:Num rows: 40176 Data size: 44957392 Basic stats: 
COMPLETE Column stats: NONE
+                                                                               
           |<-Map 16 [SIMPLE_EDGE]
+                                                                               
           |  Reduce Output Operator [RS_26]
+                                                                               
           |     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_17]
+                                                                               
           |        outputColumnNames:["_col0"]
+                                                                               
           |        Statistics:Num rows: 36524 Data size: 40870356 Basic stats: 
COMPLETE Column stats: NONE
+                                                                               
           |        Filter Operator [FIL_95]
+                                                                               
           |           predicate:(d_month_seq BETWEEN 1193 AND 1204 and 
d_date_sk is not null) (type: boolean)
+                                                                               
           |           Statistics:Num rows: 36524 Data size: 40870356 Basic 
stats: COMPLETE Column stats: NONE
+                                                                               
           |           TableScan [TS_15]
+                                                                               
           |              alias:d1
+                                                                               
           |              Statistics:Num rows: 73049 Data size: 81741831 Basic 
stats: COMPLETE Column stats: NONE
+                                                                               
           |<-Reducer 11 [SIMPLE_EDGE]
+                                                                               
              Reduce Output Operator [RS_24]
+                                                                               
                 key expressions:_col0 (type: int)
+                                                                               
                 Map-reduce partition columns:_col0 (type: int)
+                                                                               
                 sort order:+
+                                                                               
                 Statistics:Num rows: 1874 Data size: 3581903 Basic stats: 
COMPLETE Column stats: NONE
+                                                                               
                 value expressions:_col2 (type: decimal(7,2)), _col4 (type: 
string)
+                                                                               
                 Merge Join Operator [MERGEJOIN_97]
+                                                                               
                 |  condition map:[{"":"Inner Join 0 to 1"}]
+                                                                               
                 |  keys:{"0":"_col1 (type: int)","1":"_col0 (type: int)"}
+                                                                               
                 |  outputColumnNames:["_col0","_col2","_col4"]
+                                                                               
                 |  Statistics:Num rows: 1874 Data size: 3581903 Basic stats: 
COMPLETE Column stats: NONE
+                                                                               
                 |<-Map 10 [SIMPLE_EDGE]
+                                                                               
                 |  Reduce Output Operator [RS_19]
+                                                                               
                 |     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: 
decimal(7,2))
+                                                                               
                 |     Select Operator [SEL_11]
+                                                                               
                 |        outputColumnNames:["_col0","_col1","_col2"]
+                                                                               
                 |        Statistics:Num rows: 1 Data size: 0 Basic stats: 
PARTIAL Column stats: NONE
+                                                                               
                 |        Filter Operator [FIL_93]
+                                                                               
                 |           predicate:(ss_store_sk is not null and 
ss_sold_date_sk is not null) (type: boolean)
+                                                                               
                 |           Statistics:Num rows: 1 Data size: 0 Basic stats: 
PARTIAL Column stats: NONE
+                                                                               
                 |           TableScan [TS_9]
+                                                                               
                 |              alias:ss
+                                                                               
                 |              Statistics:Num rows: 1 Data size: 0 Basic 
stats: PARTIAL Column stats: NONE
+                                                                               
                 |<-Map 15 [SIMPLE_EDGE]
+                                                                               
                    Reduce Output Operator [RS_21]
+                                                                               
                       key expressions:_col0 (type: int)
+                                                                               
                       Map-reduce partition columns:_col0 (type: int)
+                                                                               
                       sort order:+
+                                                                               
                       Statistics:Num rows: 1704 Data size: 3256276 Basic 
stats: COMPLETE Column stats: NONE
+                                                                               
                       value expressions:_col1 (type: string)
+                                                                               
                       Select Operator [SEL_14]
+                                                                               
                          outputColumnNames:["_col0","_col1"]
+                                                                               
                          Statistics:Num rows: 1704 Data size: 3256276 Basic 
stats: COMPLETE Column stats: NONE
+                                                                               
                          Filter Operator [FIL_94]
+                                                                               
                             predicate:s_store_sk is not null (type: boolean)
+                                                                               
                             Statistics:Num rows: 1704 Data size: 3256276 Basic 
stats: COMPLETE Column stats: NONE
+                                                                               
                             TableScan [TS_12]
+                                                                               
                                alias:s
+                                                                               
                                Statistics:Num rows: 1704 Data size: 3256276 
Basic stats: COMPLETE Column stats: NONE
+

http://git-wip-us.apache.org/repos/asf/hive/blob/09b6f9a3/ql/src/test/results/clientpositive/perf/query71.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query71.q.out 
b/ql/src/test/results/clientpositive/perf/query71.q.out
new file mode 100644
index 0000000..be00aec
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query71.q.out
@@ -0,0 +1,242 @@
+PREHOOK: query: explain select i_brand_id brand_id, i_brand 
brand,t_hour,t_minute, sum(ext_price) ext_price from item JOIN (select 
ws_ext_sales_price as ext_price, ws_sold_date_sk as sold_date_sk, ws_item_sk as 
sold_item_sk, ws_sold_time_sk as time_sk from web_sales,date_dim where 
date_dim.d_date_sk = web_sales.ws_sold_date_sk and d_moy=12 and d_year=2001 
union all select cs_ext_sales_price as ext_price, cs_sold_date_sk as 
sold_date_sk, cs_item_sk as sold_item_sk, cs_sold_time_sk as time_sk from 
catalog_sales,date_dim where date_dim.d_date_sk = catalog_sales.cs_sold_date_sk 
and d_moy=12 and d_year=2001 union all select ss_ext_sales_price as ext_price, 
ss_sold_date_sk as sold_date_sk, ss_item_sk as sold_item_sk, ss_sold_time_sk as 
time_sk from store_sales,date_dim where date_dim.d_date_sk = 
store_sales.ss_sold_date_sk and d_moy=12 and d_year=2001 ) tmp ON 
tmp.sold_item_sk = item.i_item_sk JOIN time_dim ON tmp.time_sk = 
time_dim.t_time_sk where i_manager_id=1 and (t_meal_time = 'break
 fast' or t_meal_time = 'dinner') group by i_brand, i_brand_id,t_hour,t_minute 
order by ext_price desc, i_brand_id
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select i_brand_id brand_id, i_brand 
brand,t_hour,t_minute, sum(ext_price) ext_price from item JOIN (select 
ws_ext_sales_price as ext_price, ws_sold_date_sk as sold_date_sk, ws_item_sk as 
sold_item_sk, ws_sold_time_sk as time_sk from web_sales,date_dim where 
date_dim.d_date_sk = web_sales.ws_sold_date_sk and d_moy=12 and d_year=2001 
union all select cs_ext_sales_price as ext_price, cs_sold_date_sk as 
sold_date_sk, cs_item_sk as sold_item_sk, cs_sold_time_sk as time_sk from 
catalog_sales,date_dim where date_dim.d_date_sk = catalog_sales.cs_sold_date_sk 
and d_moy=12 and d_year=2001 union all select ss_ext_sales_price as ext_price, 
ss_sold_date_sk as sold_date_sk, ss_item_sk as sold_item_sk, ss_sold_time_sk as 
time_sk from store_sales,date_dim where date_dim.d_date_sk = 
store_sales.ss_sold_date_sk and d_moy=12 and d_year=2001 ) tmp ON 
tmp.sold_item_sk = item.i_item_sk JOIN time_dim ON tmp.time_sk = 
time_dim.t_time_sk where i_manager_id=1 and (t_meal_time = 'brea
 kfast' or t_meal_time = 'dinner') group by i_brand, i_brand_id,t_hour,t_minute 
order by ext_price desc, i_brand_id
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 11 <- Map 10 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE), Union 8 (CONTAINS)
+Reducer 14 <- Map 13 (SIMPLE_EDGE), Map 15 (SIMPLE_EDGE), Union 8 (CONTAINS)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Union 8 (SIMPLE_EDGE)
+Reducer 3 <- Map 16 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 7 <- Map 6 (SIMPLE_EDGE), Map 9 (SIMPLE_EDGE), Union 8 (CONTAINS)
+
+Stage-0
+   Fetch Operator
+      limit:-1
+      Stage-1
+         Reducer 5
+         File Output Operator [FS_63]
+            compressed:false
+            Statistics:Num rows: 139755 Data size: 200727046 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_62]
+            |  outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+            |  Statistics:Num rows: 139755 Data size: 200727046 Basic stats: 
COMPLETE Column stats: NONE
+            |<-Reducer 4 [SIMPLE_EDGE]
+               Reduce Output Operator [RS_61]
+                  key expressions:_col4 (type: decimal(17,2)), _col0 (type: 
int)
+                  sort order:-+
+                  Statistics:Num rows: 139755 Data size: 200727046 Basic 
stats: COMPLETE Column stats: NONE
+                  value expressions:_col1 (type: string), _col2 (type: int), 
_col3 (type: int)
+                  Group By Operator [GBY_58]
+                  |  aggregations:["sum(VALUE._col0)"]
+                  |  keys:KEY._col0 (type: int), KEY._col1 (type: string), 
KEY._col2 (type: int), KEY._col3 (type: int)
+                  |  
outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+                  |  Statistics:Num rows: 139755 Data size: 200727046 Basic 
stats: COMPLETE Column stats: NONE
+                  |<-Reducer 3 [SIMPLE_EDGE]
+                     Reduce Output Operator [RS_57]
+                        key expressions:_col0 (type: int), _col1 (type: 
string), _col2 (type: int), _col3 (type: int)
+                        Map-reduce partition columns:_col0 (type: int), _col1 
(type: string), _col2 (type: int), _col3 (type: int)
+                        sort order:++++
+                        Statistics:Num rows: 279510 Data size: 401454092 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions:_col4 (type: decimal(17,2))
+                        Group By Operator [GBY_56]
+                           aggregations:["sum(_col4)"]
+                           keys:_col1 (type: int), _col2 (type: string), _col8 
(type: int), _col9 (type: int)
+                           
outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
+                           Statistics:Num rows: 279510 Data size: 401454092 
Basic stats: COMPLETE Column stats: NONE
+                           Select Operator [SEL_55]
+                              
outputColumnNames:["_col1","_col2","_col8","_col9","_col4"]
+                              Statistics:Num rows: 279510 Data size: 401454092 
Basic stats: COMPLETE Column stats: NONE
+                              Merge Join Operator [MERGEJOIN_97]
+                              |  condition map:[{"":"Inner Join 0 to 1"}]
+                              |  keys:{"0":"_col6 (type: int)","1":"_col0 
(type: int)"}
+                              |  
outputColumnNames:["_col1","_col2","_col4","_col8","_col9"]
+                              |  Statistics:Num rows: 279510 Data size: 
401454092 Basic stats: COMPLETE Column stats: NONE
+                              |<-Map 16 [SIMPLE_EDGE]
+                              |  Reduce Output Operator [RS_53]
+                              |     key expressions:_col0 (type: int)
+                              |     Map-reduce partition columns:_col0 (type: 
int)
+                              |     sort order:+
+                              |     Statistics:Num rows: 86400 Data size: 
40694400 Basic stats: COMPLETE Column stats: NONE
+                              |     value expressions:_col1 (type: int), _col2 
(type: int)
+                              |     Select Operator [SEL_44]
+                              |        
outputColumnNames:["_col0","_col1","_col2"]
+                              |        Statistics:Num rows: 86400 Data size: 
40694400 Basic stats: COMPLETE Column stats: NONE
+                              |        Filter Operator [FIL_92]
+                              |           predicate:(((t_meal_time = 
'breakfast') or (t_meal_time = 'dinner')) and t_time_sk is not null) (type: 
boolean)
+                              |           Statistics:Num rows: 86400 Data 
size: 40694400 Basic stats: COMPLETE Column stats: NONE
+                              |           TableScan [TS_42]
+                              |              alias:time_dim
+                              |              Statistics:Num rows: 86400 Data 
size: 40694400 Basic stats: COMPLETE Column stats: NONE
+                              |<-Reducer 2 [SIMPLE_EDGE]
+                                 Reduce Output Operator [RS_51]
+                                    key expressions:_col6 (type: int)
+                                    Map-reduce partition columns:_col6 (type: 
int)
+                                    sort order:+
+                                    Statistics:Num rows: 254100 Data size: 
364958258 Basic stats: COMPLETE Column stats: NONE
+                                    value expressions:_col1 (type: int), _col2 
(type: string), _col4 (type: decimal(7,2))
+                                    Merge Join Operator [MERGEJOIN_96]
+                                    |  condition map:[{"":"Inner Join 0 to 1"}]
+                                    |  keys:{"0":"_col0 (type: 
int)","1":"_col1 (type: int)"}
+                                    |  
outputColumnNames:["_col1","_col2","_col4","_col6"]
+                                    |  Statistics:Num rows: 254100 Data size: 
364958258 Basic stats: COMPLETE Column stats: NONE
+                                    |<-Map 1 [SIMPLE_EDGE]
+                                    |  Reduce Output Operator [RS_46]
+                                    |     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_2]
+                                    |        
outputColumnNames:["_col0","_col1","_col2"]
+                                    |        Statistics:Num rows: 231000 Data 
size: 331780228 Basic stats: COMPLETE Column stats: NONE
+                                    |        Filter Operator [FIL_85]
+                                    |           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_0]
+                                    |              alias:item
+                                    |              Statistics:Num rows: 462000 
Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
+                                    |<-Union 8 [SIMPLE_EDGE]
+                                       |<-Reducer 11 [CONTAINS]
+                                       |  Reduce Output Operator [RS_48]
+                                       |     key expressions:_col1 (type: int)
+                                       |     Map-reduce partition 
columns:_col1 (type: int)
+                                       |     sort order:+
+                                       |     Statistics:Num rows: 60264 Data 
size: 67436088 Basic stats: COMPLETE Column stats: NONE
+                                       |     value expressions:_col0 (type: 
decimal(7,2)), _col2 (type: int)
+                                       |     Select Operator [SEL_26]
+                                       |        
outputColumnNames:["_col0","_col1","_col2"]
+                                       |        Statistics:Num rows: 20088 
Data size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                       |        Merge Join Operator 
[MERGEJOIN_94]
+                                       |        |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                                       |        |  keys:{"0":"_col0 (type: 
int)","1":"_col0 (type: int)"}
+                                       |        |  
outputColumnNames:["_col1","_col2","_col3"]
+                                       |        |  Statistics:Num rows: 20088 
Data size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                       |        |<-Map 10 [SIMPLE_EDGE]
+                                       |        |  Reduce Output Operator 
[RS_22]
+                                       |        |     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: decimal(7,2))
+                                       |        |     Select Operator [SEL_17]
+                                       |        |        
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                       |        |        Statistics:Num rows: 
1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                       |        |        Filter Operator 
[FIL_88]
+                                       |        |           
predicate:((cs_sold_date_sk is not null and cs_item_sk is not null) and 
cs_sold_time_sk is not null) (type: boolean)
+                                       |        |           Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                       |        |           TableScan [TS_15]
+                                       |        |              
alias:catalog_sales
+                                       |        |              Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                       |        |<-Map 12 [SIMPLE_EDGE]
+                                       |           Reduce Output Operator 
[RS_24]
+                                       |              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_20]
+                                       |                 
outputColumnNames:["_col0"]
+                                       |                 Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |                 Filter Operator 
[FIL_89]
+                                       |                    predicate:(((d_moy 
= 12) and d_date_sk is not null) and (d_year = 2001)) (type: boolean)
+                                       |                    Statistics:Num 
rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |                    TableScan [TS_18]
+                                       |                       alias:date_dim
+                                       |                       Statistics:Num 
rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+                                       |<-Reducer 14 [CONTAINS]
+                                       |  Reduce Output Operator [RS_48]
+                                       |     key expressions:_col1 (type: int)
+                                       |     Map-reduce partition 
columns:_col1 (type: int)
+                                       |     sort order:+
+                                       |     Statistics:Num rows: 60264 Data 
size: 67436088 Basic stats: COMPLETE Column stats: NONE
+                                       |     value expressions:_col0 (type: 
decimal(7,2)), _col2 (type: int)
+                                       |     Select Operator [SEL_40]
+                                       |        
outputColumnNames:["_col0","_col1","_col2"]
+                                       |        Statistics:Num rows: 20088 
Data size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                       |        Merge Join Operator 
[MERGEJOIN_95]
+                                       |        |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                                       |        |  keys:{"0":"_col0 (type: 
int)","1":"_col0 (type: int)"}
+                                       |        |  
outputColumnNames:["_col1","_col2","_col3"]
+                                       |        |  Statistics:Num rows: 20088 
Data size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                       |        |<-Map 13 [SIMPLE_EDGE]
+                                       |        |  Reduce Output Operator 
[RS_36]
+                                       |        |     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: decimal(7,2))
+                                       |        |     Select Operator [SEL_31]
+                                       |        |        
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                       |        |        Statistics:Num rows: 
1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                       |        |        Filter Operator 
[FIL_90]
+                                       |        |           
predicate:((ss_sold_date_sk is not null and ss_item_sk is not null) and 
ss_sold_time_sk is not null) (type: boolean)
+                                       |        |           Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                       |        |           TableScan [TS_29]
+                                       |        |              
alias:store_sales
+                                       |        |              Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                       |        |<-Map 15 [SIMPLE_EDGE]
+                                       |           Reduce Output Operator 
[RS_38]
+                                       |              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_34]
+                                       |                 
outputColumnNames:["_col0"]
+                                       |                 Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |                 Filter Operator 
[FIL_91]
+                                       |                    predicate:(((d_moy 
= 12) and d_date_sk is not null) and (d_year = 2001)) (type: boolean)
+                                       |                    Statistics:Num 
rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                       |                    TableScan [TS_32]
+                                       |                       alias:date_dim
+                                       |                       Statistics:Num 
rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+                                       |<-Reducer 7 [CONTAINS]
+                                          Reduce Output Operator [RS_48]
+                                             key expressions:_col1 (type: int)
+                                             Map-reduce partition 
columns:_col1 (type: int)
+                                             sort order:+
+                                             Statistics:Num rows: 60264 Data 
size: 67436088 Basic stats: COMPLETE Column stats: NONE
+                                             value expressions:_col0 (type: 
decimal(7,2)), _col2 (type: int)
+                                             Select Operator [SEL_14]
+                                                
outputColumnNames:["_col0","_col1","_col2"]
+                                                Statistics:Num rows: 20088 
Data size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                                Merge Join Operator 
[MERGEJOIN_93]
+                                                |  condition map:[{"":"Inner 
Join 0 to 1"}]
+                                                |  keys:{"0":"_col0 (type: 
int)","1":"_col0 (type: int)"}
+                                                |  
outputColumnNames:["_col1","_col2","_col3"]
+                                                |  Statistics:Num rows: 20088 
Data size: 22478696 Basic stats: COMPLETE Column stats: NONE
+                                                |<-Map 6 [SIMPLE_EDGE]
+                                                |  Reduce Output Operator 
[RS_10]
+                                                |     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: decimal(7,2))
+                                                |     Select Operator [SEL_5]
+                                                |        
outputColumnNames:["_col0","_col1","_col2","_col3"]
+                                                |        Statistics:Num rows: 
1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                |        Filter Operator 
[FIL_86]
+                                                |           
predicate:((ws_sold_date_sk is not null and ws_item_sk is not null) and 
ws_sold_time_sk is not null) (type: boolean)
+                                                |           Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                |           TableScan [TS_3]
+                                                |              alias:web_sales
+                                                |              Statistics:Num 
rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                                                |<-Map 9 [SIMPLE_EDGE]
+                                                   Reduce Output Operator 
[RS_12]
+                                                      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_8]
+                                                         
outputColumnNames:["_col0"]
+                                                         Statistics:Num rows: 
18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                                         Filter Operator 
[FIL_87]
+                                                            predicate:(((d_moy 
= 12) and d_date_sk is not null) and (d_year = 2001)) (type: boolean)
+                                                            Statistics:Num 
rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
+                                                            TableScan [TS_6]
+                                                               alias:date_dim
+                                                               Statistics:Num 
rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
+

Reply via email to