diff --git a/ql/src/test/queries/clientpositive/perf/query24.q b/ql/src/test/queries/clientpositive/perf/query24.q new file mode 100644 index 0000000000..b9b747f4ab --- /dev/null +++ b/ql/src/test/queries/clientpositive/perf/query24.q @@ -0,0 +1,51 @@ +set hive.mapred.mode=nonstrict; + +explain with ssales as + (select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_sales_price) netpaid + from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address + where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_birth_country = upper(ca_country) + and s_zip = ca_zip + and s_market_id=7 + group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) + select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid + from ssales + where i_color = 'orchid' + group by c_last_name + ,c_first_name + ,s_store_name + having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) + ; + diff --git a/ql/src/test/results/clientpositive/perf/query24.q.out b/ql/src/test/results/clientpositive/perf/query24.q.out new file mode 100644 index 0000000000..3e43dad5f2 --- /dev/null +++ b/ql/src/test/results/clientpositive/perf/query24.q.out @@ -0,0 +1,314 @@ +Warning: Shuffle Join MERGEJOIN[154][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 8' is a cross product +PREHOOK: query: explain with ssales as + (select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_sales_price) netpaid + from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address + where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_birth_country = upper(ca_country) + and s_zip = ca_zip + and s_market_id=7 + group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) + select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid + from ssales + where i_color = 'orchid' + group by c_last_name + ,c_first_name + ,s_store_name + having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +PREHOOK: type: QUERY +POSTHOOK: query: explain with ssales as + (select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_sales_price) netpaid + from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address + where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_birth_country = upper(ca_country) + and s_zip = ca_zip + and s_market_id=7 + group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) + select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid + from ssales + where i_color = 'orchid' + group by c_last_name + ,c_first_name + ,s_store_name + having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +POSTHOOK: type: QUERY +Plan optimized by CBO. + +Vertex dependency in root stage +Reducer 15 <- Map 14 (SIMPLE_EDGE), Map 22 (SIMPLE_EDGE) +Reducer 16 <- Map 23 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE) +Reducer 17 <- Map 24 (SIMPLE_EDGE), Reducer 16 (SIMPLE_EDGE) +Reducer 18 <- Map 25 (SIMPLE_EDGE), Reducer 17 (SIMPLE_EDGE) +Reducer 19 <- Map 26 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE) +Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 9 (SIMPLE_EDGE) +Reducer 20 <- Reducer 19 (SIMPLE_EDGE) +Reducer 21 <- Reducer 20 (CUSTOM_SIMPLE_EDGE) +Reducer 3 <- Map 10 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE) +Reducer 4 <- Map 11 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE) +Reducer 5 <- Map 12 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE) +Reducer 6 <- Map 13 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE) +Reducer 7 <- Reducer 6 (SIMPLE_EDGE) +Reducer 8 <- Reducer 21 (CUSTOM_SIMPLE_EDGE), Reducer 7 (CUSTOM_SIMPLE_EDGE) + +Stage-0 + Fetch Operator + limit:-1 + Stage-1 + Reducer 8 + File Output Operator [FS_91] + Select Operator [SEL_90] (rows=77303902 width=489) + Output:["_col0","_col1","_col2","_col3"] + Filter Operator [FIL_89] (rows=77303902 width=489) + predicate:(_col3 > _col4) + Merge Join Operator [MERGEJOIN_154] (rows=231911707 width=489) + Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4"] + <-Reducer 21 [CUSTOM_SIMPLE_EDGE] + PARTITION_ONLY_SHUFFLE [RS_87] + Select Operator [SEL_85] (rows=1 width=400) + Output:["_col0"] + Group By Operator [GBY_84] (rows=1 width=400) + Output:["_col0"],aggregations:["avg(VALUE._col0)"] + <-Reducer 20 [CUSTOM_SIMPLE_EDGE] + PARTITION_ONLY_SHUFFLE [RS_83] + Group By Operator [GBY_82] (rows=1 width=400) + Output:["_col0"],aggregations:["avg(_col10)"] + Select Operator [SEL_80] (rows=463823414 width=88) + Output:["_col10"] + Group By Operator [GBY_79] (rows=463823414 width=88) + Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6, KEY._col7, KEY._col8, KEY._col9 + <-Reducer 19 [SIMPLE_EDGE] + SHUFFLE [RS_78] + PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9 + Group By Operator [GBY_77] (rows=927646829 width=88) + Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col4)"],keys:_col22, _col17, _col18, _col19, _col20, _col21, _col13, _col14, _col8, _col10 + Merge Join Operator [MERGEJOIN_153] (rows=927646829 width=88) + Conds:RS_73._col11, _col15=RS_74._col1, upper(_col2)(Inner),Output:["_col4","_col8","_col10","_col13","_col14","_col17","_col18","_col19","_col20","_col21","_col22"] + <-Map 26 [SIMPLE_EDGE] + SHUFFLE [RS_74] + PartitionCols:_col1, upper(_col2) + Select Operator [SEL_60] (rows=40000000 width=1014) + Output:["_col0","_col1","_col2"] + Filter Operator [FIL_143] (rows=40000000 width=1014) + predicate:(ca_zip is not null and ca_country is not null) + TableScan [TS_58] (rows=40000000 width=1014) + default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_state","ca_zip","ca_country"] + <-Reducer 18 [SIMPLE_EDGE] + SHUFFLE [RS_73] + PartitionCols:_col11, _col15 + Merge Join Operator [MERGEJOIN_152] (rows=843315281 width=88) + Conds:RS_70._col0=RS_71._col0(Inner),Output:["_col4","_col8","_col10","_col11","_col13","_col14","_col15","_col17","_col18","_col19","_col20","_col21"] + <-Map 25 [SIMPLE_EDGE] + SHUFFLE [RS_71] + PartitionCols:_col0 + Select Operator [SEL_57] (rows=462000 width=1436) + Output:["_col0","_col1","_col2","_col3","_col4","_col5"] + Filter Operator [FIL_142] (rows=462000 width=1436) + predicate:i_item_sk is not null + TableScan [TS_55] (rows=462000 width=1436) + default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_current_price","i_size","i_color","i_units","i_manager_id"] + <-Reducer 17 [SIMPLE_EDGE] + SHUFFLE [RS_70] + PartitionCols:_col0 + Merge Join Operator [MERGEJOIN_151] (rows=766650239 width=88) + Conds:RS_67._col1=RS_68._col0(Inner),Output:["_col0","_col4","_col8","_col10","_col11","_col13","_col14","_col15"] + <-Map 24 [SIMPLE_EDGE] + SHUFFLE [RS_68] + PartitionCols:_col0 + Select Operator [SEL_54] (rows=80000000 width=860) + Output:["_col0","_col1","_col2","_col3"] + Filter Operator [FIL_141] (rows=80000000 width=860) + predicate:(c_customer_sk is not null and c_birth_country is not null) + TableScan [TS_52] (rows=80000000 width=860) + default@customer,customer,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk","c_first_name","c_last_name","c_birth_country"] + <-Reducer 16 [SIMPLE_EDGE] + SHUFFLE [RS_67] + PartitionCols:_col1 + Merge Join Operator [MERGEJOIN_150] (rows=696954748 width=88) + Conds:RS_64._col2=RS_65._col0(Inner),Output:["_col0","_col1","_col4","_col8","_col10","_col11"] + <-Map 23 [SIMPLE_EDGE] + SHUFFLE [RS_65] + PartitionCols:_col0 + Select Operator [SEL_51] (rows=852 width=1910) + Output:["_col0","_col1","_col3","_col4"] + Filter Operator [FIL_140] (rows=852 width=1910) + predicate:((s_market_id = 7) and s_store_sk is not null and s_zip is not null) + TableScan [TS_49] (rows=1704 width=1910) + default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_name","s_market_id","s_state","s_zip"] + <-Reducer 15 [SIMPLE_EDGE] + SHUFFLE [RS_64] + PartitionCols:_col2 + Merge Join Operator [MERGEJOIN_149] (rows=633595212 width=88) + Conds:RS_61._col0, _col3=RS_62._col0, _col1(Inner),Output:["_col0","_col1","_col2","_col4"] + <-Map 14 [SIMPLE_EDGE] + SHUFFLE [RS_61] + PartitionCols:_col0, _col3 + Select Operator [SEL_45] (rows=575995635 width=88) + Output:["_col0","_col1","_col2","_col3","_col4"] + Filter Operator [FIL_138] (rows=575995635 width=88) + predicate:(ss_item_sk is not null and ss_ticket_number is not null and ss_store_sk is not null and ss_customer_sk is not null) + TableScan [TS_43] (rows=575995635 width=88) + default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_item_sk","ss_customer_sk","ss_store_sk","ss_ticket_number","ss_sales_price"] + <-Map 22 [SIMPLE_EDGE] + SHUFFLE [RS_62] + PartitionCols:_col0, _col1 + Select Operator [SEL_48] (rows=57591150 width=77) + Output:["_col0","_col1"] + Filter Operator [FIL_139] (rows=57591150 width=77) + predicate:(sr_item_sk is not null and sr_ticket_number is not null) + TableScan [TS_46] (rows=57591150 width=77) + default@store_returns,store_returns,Tbl:COMPLETE,Col:NONE,Output:["sr_item_sk","sr_ticket_number"] + <-Reducer 7 [CUSTOM_SIMPLE_EDGE] + PARTITION_ONLY_SHUFFLE [RS_86] + Select Operator [SEL_42] (rows=231911707 width=88) + Output:["_col0","_col1","_col2","_col3"] + Group By Operator [GBY_41] (rows=231911707 width=88) + Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col9)"],keys:_col1, _col2, _col7 + Select Operator [SEL_37] (rows=463823414 width=88) + Output:["_col1","_col2","_col7","_col9"] + Group By Operator [GBY_36] (rows=463823414 width=88) + Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6, KEY._col7, KEY._col8 + <-Reducer 6 [SIMPLE_EDGE] + SHUFFLE [RS_35] + PartitionCols:_col0, _col1, _col2 + Group By Operator [GBY_34] (rows=927646829 width=88) + Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"],aggregations:["sum(_col4)"],keys:_col19, _col20, _col14, _col22, _col8, _col9, _col11, _col12, _col16 + Merge Join Operator [MERGEJOIN_148] (rows=927646829 width=88) + Conds:RS_30._col17, _col21=RS_31._col1, upper(_col2)(Inner),Output:["_col4","_col8","_col9","_col11","_col12","_col14","_col16","_col19","_col20","_col22"] + <-Map 13 [SIMPLE_EDGE] + SHUFFLE [RS_31] + PartitionCols:_col1, upper(_col2) + Select Operator [SEL_17] (rows=40000000 width=1014) + Output:["_col0","_col1","_col2"] + Filter Operator [FIL_137] (rows=40000000 width=1014) + predicate:(ca_zip is not null and ca_country is not null) + TableScan [TS_15] (rows=40000000 width=1014) + default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_state","ca_zip","ca_country"] + <-Reducer 5 [SIMPLE_EDGE] + SHUFFLE [RS_30] + PartitionCols:_col17, _col21 + Merge Join Operator [MERGEJOIN_147] (rows=843315281 width=88) + Conds:RS_27._col1=RS_28._col0(Inner),Output:["_col4","_col8","_col9","_col11","_col12","_col14","_col16","_col17","_col19","_col20","_col21"] + <-Map 12 [SIMPLE_EDGE] + SHUFFLE [RS_28] + PartitionCols:_col0 + Select Operator [SEL_14] (rows=80000000 width=860) + Output:["_col0","_col1","_col2","_col3"] + Filter Operator [FIL_136] (rows=80000000 width=860) + predicate:(c_customer_sk is not null and c_birth_country is not null) + TableScan [TS_12] (rows=80000000 width=860) + default@customer,customer,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk","c_first_name","c_last_name","c_birth_country"] + <-Reducer 4 [SIMPLE_EDGE] + SHUFFLE [RS_27] + PartitionCols:_col1 + Merge Join Operator [MERGEJOIN_146] (rows=766650239 width=88) + Conds:RS_24._col2=RS_25._col0(Inner),Output:["_col1","_col4","_col8","_col9","_col11","_col12","_col14","_col16","_col17"] + <-Map 11 [SIMPLE_EDGE] + SHUFFLE [RS_25] + PartitionCols:_col0 + Select Operator [SEL_11] (rows=852 width=1910) + Output:["_col0","_col1","_col3","_col4"] + Filter Operator [FIL_135] (rows=852 width=1910) + predicate:((s_market_id = 7) and s_store_sk is not null and s_zip is not null) + TableScan [TS_9] (rows=1704 width=1910) + default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_name","s_market_id","s_state","s_zip"] + <-Reducer 3 [SIMPLE_EDGE] + SHUFFLE [RS_24] + PartitionCols:_col2 + Merge Join Operator [MERGEJOIN_145] (rows=696954748 width=88) + Conds:RS_21._col0=RS_22._col0(Inner),Output:["_col1","_col2","_col4","_col8","_col9","_col11","_col12"] + <-Map 10 [SIMPLE_EDGE] + SHUFFLE [RS_22] + PartitionCols:_col0 + Select Operator [SEL_8] (rows=231000 width=1436) + Output:["_col0","_col1","_col2","_col4","_col5"] + Filter Operator [FIL_134] (rows=231000 width=1436) + predicate:((i_color = 'orchid') and i_item_sk is not null) + TableScan [TS_6] (rows=462000 width=1436) + default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_current_price","i_size","i_color","i_units","i_manager_id"] + <-Reducer 2 [SIMPLE_EDGE] + SHUFFLE [RS_21] + PartitionCols:_col0 + Merge Join Operator [MERGEJOIN_144] (rows=633595212 width=88) + Conds:RS_18._col0, _col3=RS_19._col0, _col1(Inner),Output:["_col0","_col1","_col2","_col4"] + <-Map 1 [SIMPLE_EDGE] + SHUFFLE [RS_18] + PartitionCols:_col0, _col3 + Select Operator [SEL_2] (rows=575995635 width=88) + Output:["_col0","_col1","_col2","_col3","_col4"] + Filter Operator [FIL_132] (rows=575995635 width=88) + predicate:(ss_item_sk is not null and ss_ticket_number is not null and ss_store_sk is not null and ss_customer_sk is not null) + TableScan [TS_0] (rows=575995635 width=88) + default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_item_sk","ss_customer_sk","ss_store_sk","ss_ticket_number","ss_sales_price"] + <-Map 9 [SIMPLE_EDGE] + SHUFFLE [RS_19] + PartitionCols:_col0, _col1 + Select Operator [SEL_5] (rows=57591150 width=77) + Output:["_col0","_col1"] + Filter Operator [FIL_133] (rows=57591150 width=77) + predicate:(sr_item_sk is not null and sr_ticket_number is not null) + TableScan [TS_3] (rows=57591150 width=77) + default@store_returns,store_returns,Tbl:COMPLETE,Col:NONE,Output:["sr_item_sk","sr_ticket_number"] +