http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q46.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q46.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q46.test new file mode 100644 index 0000000..412cbee --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q46.test @@ -0,0 +1,41 @@ +==== +---- QUERY: TPCDS-Q46 + +select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and (household_demographics.hd_dep_count = 4 or + household_demographics.hd_vehicle_count= 3) + and date_dim.d_dow in (6,0) + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_city in ('Four Corners','Riverview','Bethlehem','Brownsville','Liberty') + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +====
http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q47.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q47.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q47.test new file mode 100644 index 0000000..62d413b --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q47.test @@ -0,0 +1,57 @@ +==== +---- QUERY: TPCDS-Q47 + +with v1 as( + select i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, + s_store_name, s_company_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + s_store_name, s_company_name + order by d_year, d_moy) rn + from item, store_sales, date_dim, store + where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + ( + d_year = 2001 or + ( d_year = 2001-1 and d_moy =12) or + ( d_year = 2001+1 and d_moy =1) + ) + group by i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy), + v2 as( + select v1.i_category + ,v1.d_year, v1.d_moy + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1.s_store_name = v1_lag.s_store_name and + v1.s_store_name = v1_lead.s_store_name and + v1.s_company_name = v1_lag.s_company_name and + v1.s_company_name = v1_lead.s_company_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2001 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, 3 + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q48.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q48.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q48.test new file mode 100644 index 0000000..2b8eaf3 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q48.test @@ -0,0 +1,27 @@ +==== +---- QUERY: TPCDS-Q48 + +select sum (ss_quantity) +from store_sales, store, (select * from customer_demographics where cd_marital_status = 'S' and cd_education_status = '4 yr Degree') as v1, (select * from customer_address where ca_country = 'United States' and ca_state in ('AK', 'IA', 'NE', 'NY', 'VA', 'AR', 'AZ', 'MI', 'NC')) as v2, date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 1998 + and ss_sold_date_sk between 2450815 and 2451179 + and (v1.cd_demo_sk = ss_cdemo_sk and + ( + (ss_sales_price between 100.00 and 150.00) or + (ss_sales_price between 50.00 and 100.00) or + (ss_sales_price between 150.00 and 200.00) + ) + ) + and (ss_addr_sk = v2.ca_address_sk and + ( + (ca_state in ('AK', 'IA', 'NE') and ss_net_profit between 0 and 2000) + or (ca_state in ('NY', 'VA', 'AR') and ss_net_profit between 150 and 3000) + or (ca_state in ('AZ', 'MI', 'NC') and ss_net_profit between 50 and 25000) + ) + ) +; +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q49.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q49.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q49.test new file mode 100644 index 0000000..b34b6eb --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q49.test @@ -0,0 +1,133 @@ +==== +---- QUERY: TPCDS-Q49 + +select + 'web' as channel + ,web.item + ,web.return_ratio + ,web.return_rank + ,web.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select ws.ws_item_sk as item + ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(wr.wr_return_amt,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + web_sales ws left outer join web_returns wr + on (ws.ws_order_number = wr.wr_order_number and + ws.ws_item_sk = wr.wr_item_sk) + ,date_dim + where + wr.wr_return_amt > 10000 + and ws.ws_net_profit > 1 + and ws.ws_net_paid > 0 + and ws.ws_quantity > 0 + and ws_sold_date_sk = d_date_sk + and d_year = 2002 + and d_moy = 12 + group by ws.ws_item_sk + ) in_web + ) web + where + ( + web.return_rank <= 10 + or + web.currency_rank <= 10 + ) + union + select + 'catalog' as channel + ,catalog.item + ,catalog.return_ratio + ,catalog.return_rank + ,catalog.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select + cs.cs_item_sk as item + ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(cr.cr_return_amount,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + catalog_sales cs left outer join catalog_returns cr + on (cs.cs_order_number = cr.cr_order_number and + cs.cs_item_sk = cr.cr_item_sk) + ,date_dim + where + cr.cr_return_amount > 10000 + and cs.cs_net_profit > 1 + and cs.cs_net_paid > 0 + and cs.cs_quantity > 0 + and cs_sold_date_sk = d_date_sk + and d_year = 2002 + and d_moy = 12 + group by cs.cs_item_sk + ) in_cat + ) catalog + where + ( + catalog.return_rank <= 10 + or + catalog.currency_rank <=10 + ) + union + select + 'store' as channel + ,store.item + ,store.return_ratio + ,store.return_rank + ,store.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select sts.ss_item_sk as item + ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(sr.sr_return_amt,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + store_sales sts left outer join store_returns sr + on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk) + ,date_dim + where + sr.sr_return_amt > 10000 + and sts.ss_net_profit > 1 + and sts.ss_net_paid > 0 + and sts.ss_quantity > 0 + and ss_sold_date_sk = d_date_sk + and d_year = 2002 + and d_moy = 12 + group by sts.ss_item_sk + ) in_store + ) store + where ( + store.return_rank <= 10 + or + store.currency_rank <= 10 + ) + order by 1,4,5 + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q5.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q5.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q5.test new file mode 100644 index 0000000..41574d1 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q5.test @@ -0,0 +1,140 @@ +==== +---- QUERY: TPCDS-Q5 + + with ssr as + (select s_store_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as sreturns, + sum(net_loss) as profit_loss + from + ( select ss_store_sk as store_sk, + ss_sold_date_sk as date_sk, + ss_ext_sales_price as sales_price, + ss_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from store_sales + union all + select sr_store_sk as store_sk, + sr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + sr_return_amt as return_amt, + sr_net_loss as net_loss + from store_returns + ) salesreturns, + date_dim, + store + where date_sk = d_date_sk + and d_date between cast('2001-08-11' as timestamp) + and (cast('2001-08-11' as timestamp) + interval 14 days) + and store_sk = s_store_sk + group by s_store_id) + , + csr as + (select cp_catalog_page_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as sreturns, + sum(net_loss) as profit_loss + from + ( select cs_catalog_page_sk as page_sk, + cs_sold_date_sk as date_sk, + cs_ext_sales_price as sales_price, + cs_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from catalog_sales + union all + select cr_catalog_page_sk as page_sk, + cr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + cr_return_amount as return_amt, + cr_net_loss as net_loss + from catalog_returns + ) salesreturns, + date_dim, + catalog_page + where date_sk = d_date_sk + and d_date between cast('2001-08-11' as timestamp) + and (cast('2001-08-11' as timestamp) + interval 14 days) + and page_sk = cp_catalog_page_sk + group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as sreturns, + sum(net_loss) as profit_loss + from + ( select ws_web_site_sk as wsr_web_site_sk, + ws_sold_date_sk as date_sk, + ws_ext_sales_price as sales_price, + ws_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from web_sales + union all + select ws_web_site_sk as wsr_web_site_sk, + wr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + wr_return_amt as return_amt, + wr_net_loss as net_loss + from web_returns left outer join web_sales on + ( wr_item_sk = ws_item_sk + and wr_order_number = ws_order_number) + ) salesreturns, + date_dim, + web_site + where date_sk = d_date_sk + and d_date between cast('2001-08-11' as timestamp) + and (cast('2001-08-11' as timestamp) + interval 14 days) + and wsr_web_site_sk = web_site_sk + group by web_site_id) + , + results as + (select channel + , id + , sum(sales) as sales + , sum(sreturns) as sreturns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store' , s_store_id) as id + , sales + , sreturns + , (profit - profit_loss) as profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page' , cp_catalog_page_id) as id + , sales + , sreturns + , (profit - profit_loss) as profit + from csr + union all + select 'web channel' as channel + , concat('web_site' , web_site_id) as id + , sales + , sreturns + , (profit - profit_loss) as profit + from wsr + ) x + group by channel, id) +select channel, id, sales, sreturns, profit from ( + select channel, id, sales, sreturns, profit from results + union + select channel, null as id, sum(sales), sum(sreturns), sum(profit) from results group by channel + union + select null as channel, null as id, sum(sales), sum(sreturns), sum(profit) from results) foo +order by channel, id +; + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q50.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q50.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q50.test new file mode 100644 index 0000000..1e975ed --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q50.test @@ -0,0 +1,65 @@ +==== +---- QUERY: TPCDS-Q50 + +select + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 30) and + (sr_returned_date_sk - ss_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 60) and + (sr_returned_date_sk - ss_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 90) and + (sr_returned_date_sk - ss_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + store_sales + ,store_returns + ,store + ,date_dim d1 + ,date_dim d2 +where + d2.d_year = 2002 +and d2.d_moy = 9 +and ss_ticket_number = sr_ticket_number +and ss_item_sk = sr_item_sk +and ss_sold_date_sk = d1.d_date_sk +and sr_returned_date_sk = d2.d_date_sk +and ss_customer_sk = sr_customer_sk +and ss_store_sk = s_store_sk +group by + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +order by s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q51.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q51.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q51.test new file mode 100644 index 0000000..891e646 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q51.test @@ -0,0 +1,51 @@ +==== +---- QUERY: TPCDS-Q51 + +WITH web_v1 as ( +select + ws_item_sk item_sk, d_date, sum(ws_sales_price), + sum(sum(ws_sales_price)) + over (partition by ws_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from web_sales + ,date_dim +where ws_sold_date_sk=d_date_sk + and d_month_seq between 1193 and 1193+11 + and ws_item_sk is not NULL +group by ws_item_sk, d_date), +store_v1 as ( +select + ss_item_sk item_sk, d_date, sum(ss_sales_price), + sum(sum(ss_sales_price)) + over (partition by ss_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from store_sales + ,date_dim +where ss_sold_date_sk=d_date_sk + and d_month_seq between 1193 and 1193+11 + and ss_item_sk is not NULL +group by ss_item_sk, d_date) + select * +from (select item_sk + ,d_date + ,web_sales + ,store_sales + ,max(web_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) web_cumulative + ,max(store_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) store_cumulative + from (select case when web.item_sk is not null then web.item_sk else store.item_sk end item_sk + ,case when web.d_date is not null then web.d_date else store.d_date end d_date + ,web.cume_sales web_sales + ,store.cume_sales store_sales + from web_v1 web full outer join store_v1 store on (web.item_sk = store.item_sk + and web.d_date = store.d_date) + )x )y +where web_cumulative > store_cumulative +order by item_sk + ,d_date +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q52.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q52.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q52.test new file mode 100644 index 0000000..de76643 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q52.test @@ -0,0 +1,28 @@ +==== +---- QUERY: TPCDS-Q52 + +select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) ext_price + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=12 + and dt.d_year=2000 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,ext_price desc + ,brand_id +limit 100 ; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q53.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q53.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q53.test new file mode 100644 index 0000000..9c18790 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q53.test @@ -0,0 +1,34 @@ +==== +---- QUERY: TPCDS-Q53 + +select * from +(select i_manufact_id, +sum(ss_sales_price) sum_sales, +avg(sum(ss_sales_price)) over (partition by i_manufact_id) avg_quarterly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and +ss_sold_date_sk = d_date_sk and +ss_store_sk = s_store_sk and +d_month_seq in (1176,1176+1,1176+2,1176+3,1176+4,1176+5,1176+6,1176+7,1176+8,1176+9,1176+10,1176+11) and +((i_category in ('Books','Children','Electronics') and +i_class in ('personal','portable','reference','self-help') and +i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) +or(i_category in ('Women','Music','Men') and +i_class in ('accessories','classical','fragrances','pants') and +i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manufact_id, d_qoy ) tmp1 +where case when avg_quarterly_sales > 0 + then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales + else null end > 0.1 +order by avg_quarterly_sales, + sum_sales, + i_manufact_id +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q54.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q54.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q54.test new file mode 100644 index 0000000..aee75f5 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q54.test @@ -0,0 +1,62 @@ +==== +---- QUERY: TPCDS-Q54 + +with my_customers as ( + select distinct c_customer_sk + , c_current_addr_sk + from + ( select cs_sold_date_sk sold_date_sk, + cs_bill_customer_sk customer_sk, + cs_item_sk item_sk + from catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from web_sales + ) cs_or_ws_sales, + item, + date_dim, + customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Sports' + and i_class = 'baseball' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 3 + and d_year = 2001 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + store_sales, + customer_address, + store, + date_dim + where c_current_addr_sk = ca_address_sk + and ca_county = s_county + and ca_state = s_state + and ss_sold_date_sk = d_date_sk + and c_customer_sk = ss_customer_sk + and d_month_seq between (select distinct d_month_seq+1 + from date_dim where d_year = 2001 and d_moy = 3 limit 1) + and (select distinct d_month_seq+3 + from date_dim where d_year = 2001 and d_moy = 3 limit 1) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50) as int) as segment + from my_revenue + ) + select segment, count(*) as num_customers, segment*50 as segment_base + from segments + group by segment + order by segment, num_customers + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q55.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q55.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q55.test new file mode 100644 index 0000000..f8f630f --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q55.test @@ -0,0 +1,20 @@ +==== +---- QUERY: TPCDS-Q55 + +select i_brand_id brand_id, i_brand brand, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=8 + and d_moy=12 + and d_year=2001 + group by i_brand, i_brand_id + order by ext_price desc, i_brand_id +limit 100 ; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q56.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q56.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q56.test new file mode 100644 index 0000000..c0bf6c9 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q56.test @@ -0,0 +1,74 @@ +==== +---- QUERY: TPCDS-Q56 + +with ss as ( + select i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where i_item_id in (select + i_item_id +from item +where i_color in ('blanched','slate','saddle')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -8 + group by i_item_id), + cs as ( + select i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('blanched','slate','saddle')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -8 + group by i_item_id), + ws as ( + select i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('blanched','slate','saddle')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 3 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -8 + group by i_item_id) + select i_item_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by total_sales + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q57.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q57.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q57.test new file mode 100644 index 0000000..2792f2b --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q57.test @@ -0,0 +1,54 @@ +==== +---- QUERY: TPCDS-Q57 + +with v1 as( + select i_category, i_brand, + cc_name, + d_year, d_moy, + sum(cs_sales_price) sum_sales, + avg(sum(cs_sales_price)) over + (partition by i_category, i_brand, + cc_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + cc_name + order by d_year, d_moy) rn + from item, catalog_sales, date_dim, call_center + where cs_item_sk = i_item_sk and + cs_sold_date_sk = d_date_sk and + cc_call_center_sk= cs_call_center_sk and + ( + d_year = 2001 or + ( d_year = 2001-1 and d_moy =12) or + ( d_year = 2001+1 and d_moy =1) + ) + group by i_category, i_brand, + cc_name , d_year, d_moy), + v2 as( + select v1.i_category, v1.i_brand, v1.cc_name + ,v1.d_year, v1.d_moy + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1. cc_name = v1_lag. cc_name and + v1. cc_name = v1_lead. cc_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2001 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, 3 + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q58.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q58.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q58.test new file mode 100644 index 0000000..7f81392 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q58.test @@ -0,0 +1,71 @@ +==== +---- QUERY: TPCDS-Q58 + +with ss_items as + (select i_item_id item_id + ,sum(ss_ext_sales_price) ss_item_rev + from store_sales + ,item + ,date_dim + where ss_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq in (select d_week_seq + from date_dim + where d_date = '2000-05-18')) + and ss_sold_date_sk = d_date_sk + group by i_item_id), + cs_items as + (select i_item_id item_id + ,sum(cs_ext_sales_price) cs_item_rev + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq in (select d_week_seq + from date_dim + where d_date = '2000-05-18')) + and cs_sold_date_sk = d_date_sk + group by i_item_id), + ws_items as + (select i_item_id item_id + ,sum(ws_ext_sales_price) ws_item_rev + from web_sales + ,item + ,date_dim + where ws_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq in (select d_week_seq + from date_dim + where d_date = '2000-05-18')) + and ws_sold_date_sk = d_date_sk + group by i_item_id) + select ss_items.item_id + ,ss_item_rev + ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev + ,cs_item_rev + ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev + ,ws_item_rev + ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev + ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average + from ss_items,cs_items,ws_items + where ss_items.item_id=cs_items.item_id + and ss_items.item_id=ws_items.item_id + and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + order by item_id + ,ss_item_rev + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q59.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q59.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q59.test new file mode 100644 index 0000000..6a9b431 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q59.test @@ -0,0 +1,50 @@ +==== +---- QUERY: TPCDS-Q59 + +with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + group by d_week_seq,ss_store_sk + ) + select s_store_name1,s_store_id1,d_week_seq1 + ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 + ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 + ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 + from + (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 + ,s_store_id s_store_id1,sun_sales sun_sales1 + ,mon_sales mon_sales1,tue_sales tue_sales1 + ,wed_sales wed_sales1,thu_sales thu_sales1 + ,fri_sales fri_sales1,sat_sales sat_sales1 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1185 and 1185 + 11) y, + (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 + ,s_store_id s_store_id2,sun_sales sun_sales2 + ,mon_sales mon_sales2,tue_sales tue_sales2 + ,wed_sales wed_sales2,thu_sales thu_sales2 + ,fri_sales fri_sales2,sat_sales sat_sales2 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1185+ 12 and 1185 + 23) x + where s_store_id1=s_store_id2 + and d_week_seq1=d_week_seq2-52 + order by s_store_name1,s_store_id1,d_week_seq1 +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q6.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q6.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q6.test new file mode 100644 index 0000000..46d3da5 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q6.test @@ -0,0 +1,32 @@ +==== +---- QUERY: TPCDS-Q6 + +select a.ca_state state, count(*) cnt + from customer_address a + ,customer c + ,store_sales s + ,date_dim d + ,item i + where a.ca_address_sk = c.c_current_addr_sk + and c.c_customer_sk = s.ss_customer_sk + and s.ss_sold_date_sk = d.d_date_sk + and s.ss_item_sk = i.i_item_sk + and d.d_month_seq in + (select distinct (d_month_seq) + from date_dim + where d_year = 2002 + and d_moy = 1 ) + and i.i_current_price > 1.2 * + (select avg(j.i_current_price) + from item j + where j.i_category = i.i_category) + group by a.ca_state + having count(*) >= 10 + order by cnt + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q60.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q60.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q60.test new file mode 100644 index 0000000..633ad42 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q60.test @@ -0,0 +1,84 @@ +==== +---- QUERY: TPCDS-Q60 + +with ss as ( + select + i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Music')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 10 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + cs as ( + select + i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Music')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 10 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + ws as ( + select + i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Music')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 10 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id) + select + i_item_id +,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by i_item_id + ,total_sales + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q61.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q61.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q61.test new file mode 100644 index 0000000..8d60c13 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q61.test @@ -0,0 +1,50 @@ +==== +---- QUERY: TPCDS-Q61 + +select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 +from + (select sum(ss_ext_sales_price) promotions + from store_sales + ,store + ,promotion + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_promo_sk = p_promo_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Electronics' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -7 + and d_year = 2001 + and d_moy = 12) promotional_sales, + (select sum(ss_ext_sales_price) total + from store_sales + ,store + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Electronics' + and s_gmt_offset = -7 + and d_year = 2001 + and d_moy = 12) all_sales +order by promotions, total +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q62.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q62.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q62.test new file mode 100644 index 0000000..5920bc9 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q62.test @@ -0,0 +1,41 @@ +==== +---- QUERY: TPCDS-Q62 + +select + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and + (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and + (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and + (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + web_sales + ,warehouse + ,ship_mode + ,web_site + ,date_dim +where + d_month_seq between 1176 and 1176 + 11 +and ws_ship_date_sk = d_date_sk +and ws_warehouse_sk = w_warehouse_sk +and ws_ship_mode_sk = sm_ship_mode_sk +and ws_web_site_sk = web_site_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q63.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q63.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q63.test new file mode 100644 index 0000000..a038b8e --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q63.test @@ -0,0 +1,35 @@ +==== +---- QUERY: TPCDS-Q63 + +select * +from (select i_manager_id + ,sum(ss_sales_price) sum_sales + ,avg(sum(ss_sales_price)) over (partition by i_manager_id) avg_monthly_sales + from item + ,store_sales + ,date_dim + ,store + where ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and d_month_seq in (1176,1176+1,1176+2,1176+3,1176+4,1176+5,1176+6,1176+7,1176+8,1176+9,1176+10,1176+11) + and (( i_category in ('Books','Children','Electronics') + and i_class in ('personal','portable','reference','self-help') + and i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) + or( i_category in ('Women','Music','Men') + and i_class in ('accessories','classical','fragrances','pants') + and i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manager_id, d_moy) tmp1 +where case when avg_monthly_sales > 0 then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 +order by i_manager_id + ,avg_monthly_sales + ,sum_sales +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q64.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q64.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q64.test new file mode 100644 index 0000000..705803f --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q64.test @@ -0,0 +1,125 @@ +==== +---- QUERY: TPCDS-Q64 + +with cs_ui as + (select cs_item_sk + ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund + from catalog_sales + ,catalog_returns + where cs_item_sk = cr_item_sk + and cs_order_number = cr_order_number + group by cs_item_sk + having sum(cs_ext_list_price)>2*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)), +cross_sales as + (select i_product_name product_name + ,i_item_sk item_sk + ,s_store_name store_name + ,s_zip store_zip + ,ad1.ca_street_number b_street_number + ,ad1.ca_street_name b_street_name + ,ad1.ca_city b_city + ,ad1.ca_zip b_zip + ,ad2.ca_street_number c_street_number + ,ad2.ca_street_name c_street_name + ,ad2.ca_city c_city + ,ad2.ca_zip c_zip + ,d1.d_year as syear + ,d2.d_year as fsyear + ,d3.d_year s2year + ,count(*) cnt + ,sum(ss_wholesale_cost) s1 + ,sum(ss_list_price) s2 + ,sum(ss_coupon_amt) s3 + FROM store_sales + ,store_returns + ,cs_ui + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,customer + ,customer_demographics cd1 + ,customer_demographics cd2 + ,promotion + ,household_demographics hd1 + ,household_demographics hd2 + ,customer_address ad1 + ,customer_address ad2 + ,income_band ib1 + ,income_band ib2 + ,item + WHERE ss_store_sk = s_store_sk AND + ss_sold_date_sk = d1.d_date_sk AND + ss_customer_sk = c_customer_sk AND + ss_cdemo_sk= cd1.cd_demo_sk AND + ss_hdemo_sk = hd1.hd_demo_sk AND + ss_addr_sk = ad1.ca_address_sk and + ss_item_sk = i_item_sk and + ss_item_sk = sr_item_sk and + ss_ticket_number = sr_ticket_number and + ss_item_sk = cs_ui.cs_item_sk and + c_current_cdemo_sk = cd2.cd_demo_sk AND + c_current_hdemo_sk = hd2.hd_demo_sk AND + c_current_addr_sk = ad2.ca_address_sk and + c_first_sales_date_sk = d2.d_date_sk and + c_first_shipto_date_sk = d3.d_date_sk and + ss_promo_sk = p_promo_sk and + hd1.hd_income_band_sk = ib1.ib_income_band_sk and + hd2.hd_income_band_sk = ib2.ib_income_band_sk and + cd1.cd_marital_status <> cd2.cd_marital_status and + i_color in ('coral','sienna','orange','salmon','ghost','red') and + i_current_price between 79 and 79 + 10 and + i_current_price between 79 + 1 and 79 + 15 +group by i_product_name + ,i_item_sk + ,s_store_name + ,s_zip + ,ad1.ca_street_number + ,ad1.ca_street_name + ,ad1.ca_city + ,ad1.ca_zip + ,ad2.ca_street_number + ,ad2.ca_street_name + ,ad2.ca_city + ,ad2.ca_zip + ,d1.d_year + ,d2.d_year + ,d3.d_year +) +select cs1.product_name + ,cs1.store_name + ,cs1.store_zip + ,cs1.b_street_number + ,cs1.b_street_name + ,cs1.b_city + ,cs1.b_zip + ,cs1.c_street_number + ,cs1.c_street_name + ,cs1.c_city + ,cs1.c_zip + ,cs1.syear + ,cs1.cnt + ,cs1.s1 as s11 + ,cs1.s2 as s21 + ,cs1.s3 as s31 + ,cs2.s1 as s12 + ,cs2.s2 as s22 + ,cs2.s3 as s32 + ,cs2.syear + ,cs2.cnt +from cross_sales cs1,cross_sales cs2 +where cs1.item_sk=cs2.item_sk and + cs1.syear = 2000 and + cs2.syear = 2000 + 1 and + cs2.cnt <= cs1.cnt and + cs1.store_name = cs2.store_name and + cs1.store_zip = cs2.store_zip +order by cs1.product_name + ,cs1.store_name + ,cs2.cnt; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q65.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q65.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q65.test new file mode 100644 index 0000000..c43e042 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q65.test @@ -0,0 +1,35 @@ +==== +---- QUERY: TPCDS-Q65 + +select + s_store_name, + i_item_desc, + sc.revenue, + i_current_price, + i_wholesale_cost, + i_brand + from store, item, + (select ss_store_sk, avg(revenue) as ave + from + (select ss_store_sk, ss_item_sk, + sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1176 and 1176+11 + group by ss_store_sk, ss_item_sk) sa + group by ss_store_sk) sb, + (select ss_store_sk, ss_item_sk, sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1176 and 1176+11 + group by ss_store_sk, ss_item_sk) sc + where sb.ss_store_sk = sc.ss_store_sk and + sc.revenue <= 0.1 * sb.ave and + s_store_sk = sc.ss_store_sk and + i_item_sk = sc.ss_item_sk + order by s_store_name, i_item_desc +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q66.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q66.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q66.test new file mode 100644 index 0000000..0ee8a3b --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q66.test @@ -0,0 +1,226 @@ +==== +---- QUERY: TPCDS-Q66 + +select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + ,sum(jan_sales) as jan_sales + ,sum(feb_sales) as feb_sales + ,sum(mar_sales) as mar_sales + ,sum(apr_sales) as apr_sales + ,sum(may_sales) as may_sales + ,sum(jun_sales) as jun_sales + ,sum(jul_sales) as jul_sales + ,sum(aug_sales) as aug_sales + ,sum(sep_sales) as sep_sales + ,sum(oct_sales) as oct_sales + ,sum(nov_sales) as nov_sales + ,sum(dec_sales) as dec_sales + ,sum(jan_sales/w_warehouse_sq_ft) as jan_sales_per_sq_foot + ,sum(feb_sales/w_warehouse_sq_ft) as feb_sales_per_sq_foot + ,sum(mar_sales/w_warehouse_sq_ft) as mar_sales_per_sq_foot + ,sum(apr_sales/w_warehouse_sq_ft) as apr_sales_per_sq_foot + ,sum(may_sales/w_warehouse_sq_ft) as may_sales_per_sq_foot + ,sum(jun_sales/w_warehouse_sq_ft) as jun_sales_per_sq_foot + ,sum(jul_sales/w_warehouse_sq_ft) as jul_sales_per_sq_foot + ,sum(aug_sales/w_warehouse_sq_ft) as aug_sales_per_sq_foot + ,sum(sep_sales/w_warehouse_sq_ft) as sep_sales_per_sq_foot + ,sum(oct_sales/w_warehouse_sq_ft) as oct_sales_per_sq_foot + ,sum(nov_sales/w_warehouse_sq_ft) as nov_sales_per_sq_foot + ,sum(dec_sales/w_warehouse_sq_ft) as dec_sales_per_sq_foot + ,sum(jan_net) as jan_net + ,sum(feb_net) as feb_net + ,sum(mar_net) as mar_net + ,sum(apr_net) as apr_net + ,sum(may_net) as may_net + ,sum(jun_net) as jun_net + ,sum(jul_net) as jul_net + ,sum(aug_net) as aug_net + ,sum(sep_net) as sep_net + ,sum(oct_net) as oct_net + ,sum(nov_net) as nov_net + ,sum(dec_net) as dec_net + from ( + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat('GREAT EASTERN', ',', 'BARIAN') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then ws_ext_sales_price* ws_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then ws_ext_sales_price* ws_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then ws_ext_sales_price* ws_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then ws_ext_sales_price* ws_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then ws_ext_sales_price* ws_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then ws_ext_sales_price* ws_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then ws_ext_sales_price* ws_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then ws_ext_sales_price* ws_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then ws_ext_sales_price* ws_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then ws_ext_sales_price* ws_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then ws_ext_sales_price* ws_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then ws_ext_sales_price* ws_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as dec_net + from + web_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + ws_warehouse_sk = w_warehouse_sk + and ws_sold_date_sk = d_date_sk + and ws_sold_time_sk = t_time_sk + and ws_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 1808 and 1808+28800 + and sm_carrier in ('GREAT EASTERN','BARIAN') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + union all + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat('GREAT EASTERN', ',', 'BARIAN') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then cs_ext_sales_price* cs_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then cs_ext_sales_price* cs_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then cs_ext_sales_price* cs_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then cs_ext_sales_price* cs_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then cs_ext_sales_price* cs_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then cs_ext_sales_price* cs_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then cs_ext_sales_price* cs_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then cs_ext_sales_price* cs_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then cs_ext_sales_price* cs_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then cs_ext_sales_price* cs_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then cs_ext_sales_price* cs_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then cs_ext_sales_price* cs_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as dec_net + from + catalog_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and cs_sold_time_sk = t_time_sk + and cs_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 1808 AND 1808+28800 + and sm_carrier in ('GREAT EASTERN','BARIAN') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + ) x + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + order by w_warehouse_name + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q68.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q68.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q68.test new file mode 100644 index 0000000..ed3115c --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q68.test @@ -0,0 +1,48 @@ +==== +---- QUERY: TPCDS-Q68 + +select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,extended_price + ,extended_tax + ,list_price + from (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_ext_sales_price) extended_price + ,sum(ss_ext_list_price) list_price + ,sum(ss_ext_tax) extended_tax + from store_sales + ,date_dim + ,store + ,household_demographics + ,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_dep_count = 4 or + household_demographics.hd_vehicle_count= 3) + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_city in ('Four Corners','Riverview') + group by ss_ticket_number + ,ss_customer_sk + ,ss_addr_sk,ca_city) dn + ,customer + ,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,ss_ticket_number + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q69.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q69.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q69.test new file mode 100644 index 0000000..10a9868 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q69.test @@ -0,0 +1,53 @@ +==== +---- QUERY: TPCDS-Q69 + +select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_state in ('PA','NE','SD') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 1999 and + d_moy between 3 and 3+2) and + (not exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 1999 and + d_moy between 3 and 3+2) and + not exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 1999 and + d_moy between 3 and 3+2)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q7.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q7.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q7.test new file mode 100644 index 0000000..3f82b5a --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q7.test @@ -0,0 +1,27 @@ +==== +---- QUERY: TPCDS-Q7 + +select i_item_id, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, item, promotion + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_cdemo_sk = cd_demo_sk and + ss_promo_sk = p_promo_sk and + cd_gender = 'F' and + cd_marital_status = 'W' and + cd_education_status = 'Primary' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2000 + group by i_item_id + order by i_item_id + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q70.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q70.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q70.test new file mode 100644 index 0000000..7d19f13 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q70.test @@ -0,0 +1,50 @@ +==== +---- QUERY: TPCDS-Q70 + + with results as +( select + sum(ss_net_profit) as total_sum ,s_state ,s_county, 0 as gstate, 0 as g_county + from + store_sales + ,date_dim d1 + ,store + where + -- d1.d_year = [YEAR] + d1.d_month_seq between 1209 and 1209+11 + and d1.d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + and s_state in + ( select s_state + from (select s_state as s_state, + 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 1209 and 1209+11 + -- d_year =[YEAR] + and d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + group by s_state + ) tmp1 + where ranking <= 5) + group by s_state,s_county) , + + results_rollup as +( select total_sum ,s_state ,s_county, 0 as g_state, 0 as g_county, 0 as lochierarchy from results + union + select sum(total_sum) as total_sum,s_state, NULL as s_county, 0 as g_state, 1 as g_county, 1 as lochierarchy from results group by s_state + union + select sum(total_sum) as total_sum ,NULL as s_state ,NULL as s_county, 1 as g_state, 1 as g_county, 2 as lochierarchy from results) + + select total_sum ,s_state ,s_county, lochierarchy + ,rank() over ( + partition by lochierarchy, + case when g_county = 0 then s_state end + order by total_sum desc) as rank_within_parent + from results_rollup + order by + lochierarchy desc + ,case when lochierarchy = 0 then s_state end + ,rank_within_parent ; +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q71.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q71.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q71.test new file mode 100644 index 0000000..e06f676 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q71.test @@ -0,0 +1,46 @@ +==== +---- QUERY: TPCDS-Q71 + +select i_brand_id brand_id, i_brand brand,t_hour,t_minute, + sum(ext_price) ext_price + from item, (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 d_date_sk = ws_sold_date_sk + and d_moy=12 + and d_year=2002 + 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 d_date_sk = cs_sold_date_sk + and d_moy=12 + and d_year=2002 + 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 d_date_sk = ss_sold_date_sk + and d_moy=12 + and d_year=2002 + ) as tmp,time_dim + where + sold_item_sk = i_item_sk + and i_manager_id=1 + and time_sk = t_time_sk + and (t_meal_time = 'breakfast' or t_meal_time = 'dinner') + group by i_brand, i_brand_id,t_hour,t_minute + order by ext_price desc, i_brand_id + ; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q72.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q72.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q72.test new file mode 100644 index 0000000..8a5d8ac --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q72.test @@ -0,0 +1,35 @@ +==== +---- QUERY: TPCDS-Q72 + +select i_item_desc + ,w_warehouse_name + ,d1.d_week_seq + ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo + ,sum(case when p_promo_sk is not null then 1 else 0 end) promo + ,count(*) total_cnt +from catalog_sales +join inventory on (cs_item_sk = inv_item_sk) +join warehouse on (w_warehouse_sk=inv_warehouse_sk) +join item on (i_item_sk = cs_item_sk) +join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) +join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) +join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) +join date_dim d2 on (inv_date_sk = d2.d_date_sk) +join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) +left outer join promotion on (cs_promo_sk=p_promo_sk) +left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) +where d1.d_week_seq = d2.d_week_seq + and inv_quantity_on_hand < cs_quantity + and cast(d3.d_date as timestamp) > cast(d1.d_date as timestamp) + interval 5 days + and hd_buy_potential = '>10000' + and d1.d_year = 2001 + and cd_marital_status = 'D' +group by i_item_desc,w_warehouse_name,d1.d_week_seq +order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q73.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q73.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q73.test new file mode 100644 index 0000000..c9b4473 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q73.test @@ -0,0 +1,34 @@ +==== +---- QUERY: TPCDS-Q73 + +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 2 + and (household_demographics.hd_buy_potential = '>10000' or + household_demographics.hd_buy_potential = '0-500') + 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 + and date_dim.d_year in (1999,1999+1,1999+2) + and store.s_county in ('Daviess County','Perry County','Adams County','Raleigh County') + group by ss_ticket_number,ss_customer_sk) dj,customer + where ss_customer_sk = c_customer_sk + and cnt between 1 and 5 + order by cnt desc, c_last_name asc; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q74.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q74.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q74.test new file mode 100644 index 0000000..704f8e1 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q74.test @@ -0,0 +1,67 @@ +==== +---- QUERY: TPCDS-Q74 + +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ss_net_paid) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2000,2000+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ws_net_paid) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + and d_year in (2000,2000+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + ) + select + t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.year = 2000 + and t_s_secyear.year = 2000+1 + and t_w_firstyear.year = 2000 + and t_w_secyear.year = 2000+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + order by 3,2,1 +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q75.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q75.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q75.test new file mode 100644 index 0000000..2223698 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q75.test @@ -0,0 +1,76 @@ +==== +---- QUERY: TPCDS-Q75 + +WITH all_sales AS ( + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,SUM(sales_cnt) AS sales_cnt + ,SUM(sales_amt) AS sales_amt + FROM (SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt + ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0) AS sales_amt + FROM catalog_sales JOIN item ON i_item_sk=cs_item_sk + JOIN date_dim ON d_date_sk=cs_sold_date_sk + LEFT JOIN catalog_returns ON (cs_order_number=cr_order_number + AND cs_item_sk=cr_item_sk) + WHERE i_category='Electronics' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt + ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0) AS sales_amt + FROM store_sales JOIN item ON i_item_sk=ss_item_sk + JOIN date_dim ON d_date_sk=ss_sold_date_sk + LEFT JOIN store_returns ON (ss_ticket_number=sr_ticket_number + AND ss_item_sk=sr_item_sk) + WHERE i_category='Electronics' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt + ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0) AS sales_amt + FROM web_sales JOIN item ON i_item_sk=ws_item_sk + JOIN date_dim ON d_date_sk=ws_sold_date_sk + LEFT JOIN web_returns ON (ws_order_number=wr_order_number + AND ws_item_sk=wr_item_sk) + WHERE i_category='Electronics') sales_detail + GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id) + SELECT prev_yr.d_year AS prev_year + ,curr_yr.d_year AS year + ,curr_yr.i_brand_id + ,curr_yr.i_class_id + ,curr_yr.i_category_id + ,curr_yr.i_manufact_id + ,prev_yr.sales_cnt AS prev_yr_cnt + ,curr_yr.sales_cnt AS curr_yr_cnt + ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff + ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff + FROM all_sales curr_yr, all_sales prev_yr + WHERE curr_yr.i_brand_id=prev_yr.i_brand_id + AND curr_yr.i_class_id=prev_yr.i_class_id + AND curr_yr.i_category_id=prev_yr.i_category_id + AND curr_yr.i_manufact_id=prev_yr.i_manufact_id + AND curr_yr.d_year=2002 + AND prev_yr.d_year=2002-1 + AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9 + ORDER BY sales_cnt_diff + limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q76.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q76.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q76.test new file mode 100644 index 0000000..dc1b2da --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q76.test @@ -0,0 +1,30 @@ +==== +---- QUERY: TPCDS-Q76 + +select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( + SELECT 'store' as channel, 'ss_cdemo_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price + FROM store_sales, item, date_dim + WHERE ss_cdemo_sk IS NULL + AND ss_sold_date_sk=d_date_sk + AND ss_item_sk=i_item_sk + UNION ALL + SELECT 'web' as channel, 'ws_web_page_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price + FROM web_sales, item, date_dim + WHERE ws_web_page_sk IS NULL + AND ws_sold_date_sk=d_date_sk + AND ws_item_sk=i_item_sk + UNION ALL + SELECT 'catalog' as channel, 'cs_ship_customer_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price + FROM catalog_sales, item, date_dim + WHERE cs_ship_customer_sk IS NULL + AND cs_sold_date_sk=d_date_sk + AND cs_item_sk=i_item_sk) foo +GROUP BY channel, col_name, d_year, d_qoy, i_category +ORDER BY channel, col_name, d_year, d_qoy, i_category +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q77.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q77.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q77.test new file mode 100644 index 0000000..5b07ec9 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q77.test @@ -0,0 +1,121 @@ +==== +---- QUERY: TPCDS-Q77 + + with ss as + (select s_store_sk, + sum(ss_ext_sales_price) as sales, + sum(ss_net_profit) as profit + from store_sales, + date_dim, + store + where ss_sold_date_sk = d_date_sk + and d_date between cast('2000-08-02' as timestamp) + and (cast('2000-08-02' as timestamp) + interval 30 days) + and ss_store_sk = s_store_sk + group by s_store_sk) + , + sr as + (select s_store_sk, + sum(sr_return_amt) as sreturns, + sum(sr_net_loss) as profit_loss + from store_returns, + date_dim, + store + where sr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-02' as timestamp) + and (cast('2000-08-02' as timestamp) + interval 30 days) + and sr_store_sk = s_store_sk + group by s_store_sk), + cs as + (select cs_call_center_sk, + sum(cs_ext_sales_price) as sales, + sum(cs_net_profit) as profit + from catalog_sales, + date_dim + where cs_sold_date_sk = d_date_sk + and d_date between cast('2000-08-02' as timestamp) + and (cast('2000-08-02' as timestamp) + interval 30 days) + group by cs_call_center_sk + ), + cr as + (select + sum(cr_return_amount) as sreturns, + sum(cr_net_loss) as profit_loss + from catalog_returns, + date_dim + where cr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-02' as timestamp) + and (cast('2000-08-02' as timestamp) + interval 30 days) + ), + ws as + ( select wp_web_page_sk, + sum(ws_ext_sales_price) as sales, + sum(ws_net_profit) as profit + from web_sales, + date_dim, + web_page + where ws_sold_date_sk = d_date_sk + and d_date between cast('2000-08-02' as timestamp) + and (cast('2000-08-02' as timestamp) + interval 30 days) + and ws_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + wr as + (select wp_web_page_sk, + sum(wr_return_amt) as sreturns, + sum(wr_net_loss) as profit_loss + from web_returns, + date_dim, + web_page + where wr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-02' as timestamp) + and (cast('2000-08-02' as timestamp) + interval 30 days) + and wr_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + results as + (select channel + , id + , sum(sales) as sales + , sum(sreturns) as sreturns + , sum(profit) as profit + from + (select 'store channel' as channel + , ss.s_store_sk as id + , sales + , coalesce(sreturns, 0) as sreturns + , (profit - coalesce(profit_loss,0)) as profit + from ss left join sr + on ss.s_store_sk = sr.s_store_sk + union all + select 'catalog channel' as channel + , cs_call_center_sk as id + , sales + , sreturns + , (profit - profit_loss) as profit + from cs + , cr + union all + select 'web channel' as channel + , ws.wp_web_page_sk as id + , sales + , coalesce(sreturns, 0) sreturns + , (profit - coalesce(profit_loss,0)) as profit + from ws left join wr + on ws.wp_web_page_sk = wr.wp_web_page_sk + ) x + group by channel, id ) + + select * + from ( + select channel, id, sales, sreturns, profit from results + union + select channel, NULL AS id, sum(sales) as sales, sum(sreturns) as sreturns, sum(profit) as profit from results group by channel + union + select NULL AS channel, NULL AS id, sum(sales) as sales, sum(sreturns) as sreturns, sum(profit) as profit from results +) foo +order by channel, id + limit 100; + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q78.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q78.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q78.test new file mode 100644 index 0000000..bd287f8 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q78.test @@ -0,0 +1,64 @@ +==== +---- QUERY: TPCDS-Q78 + +with ws as + (select d_year AS ws_sold_year, ws_item_sk, + ws_bill_customer_sk ws_customer_sk, + sum(ws_quantity) ws_qty, + sum(ws_wholesale_cost) ws_wc, + sum(ws_sales_price) ws_sp + from web_sales + left join web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk + join date_dim on ws_sold_date_sk = d_date_sk + where wr_order_number is null + group by d_year, ws_item_sk, ws_bill_customer_sk + ), +cs as + (select d_year AS cs_sold_year, cs_item_sk, + cs_bill_customer_sk cs_customer_sk, + sum(cs_quantity) cs_qty, + sum(cs_wholesale_cost) cs_wc, + sum(cs_sales_price) cs_sp + from catalog_sales + left join catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk + join date_dim on cs_sold_date_sk = d_date_sk + where cr_order_number is null + group by d_year, cs_item_sk, cs_bill_customer_sk + ), +ss as + (select d_year AS ss_sold_year, ss_item_sk, + ss_customer_sk, + sum(ss_quantity) ss_qty, + sum(ss_wholesale_cost) ss_wc, + sum(ss_sales_price) ss_sp + from store_sales + left join store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk + join date_dim on ss_sold_date_sk = d_date_sk + where sr_ticket_number is null + group by d_year, ss_item_sk, ss_customer_sk + ) + select +ss_sold_year, ss_item_sk, ss_customer_sk, +round(ss_qty/(coalesce(ws_qty+cs_qty,1)),2) ratio, +ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price, +coalesce(ws_qty,0)+coalesce(cs_qty,0) other_chan_qty, +coalesce(ws_wc,0)+coalesce(cs_wc,0) other_chan_wholesale_cost, +coalesce(ws_sp,0)+coalesce(cs_sp,0) other_chan_sales_price +from ss +left join ws on (ws_sold_year=ss_sold_year and ws_item_sk=ss_item_sk and ws_customer_sk=ss_customer_sk) +left join cs on (cs_sold_year=ss_sold_year and cs_item_sk=cs_item_sk and cs_customer_sk=ss_customer_sk) +where coalesce(ws_qty,0)>0 and coalesce(cs_qty, 0)>0 and ss_sold_year=2002 +order by + ss_sold_year, ss_item_sk, ss_customer_sk, + ss_qty desc, ss_wc desc, ss_sp desc, + other_chan_qty, + other_chan_wholesale_cost, + other_chan_sales_price, + round(ss_qty/(coalesce(ws_qty+cs_qty,1)),2) +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +==== http://git-wip-us.apache.org/repos/asf/impala/blob/43222e35/testdata/workloads/tpcds-unmodified/queries/tpcds-q79.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/tpcds-unmodified/queries/tpcds-q79.test b/testdata/workloads/tpcds-unmodified/queries/tpcds-q79.test new file mode 100644 index 0000000..00fafd1 --- /dev/null +++ b/testdata/workloads/tpcds-unmodified/queries/tpcds-q79.test @@ -0,0 +1,29 @@ +==== +---- QUERY: TPCDS-Q79 + +select + c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,store.s_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + 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 (household_demographics.hd_dep_count = 3 or household_demographics.hd_vehicle_count > 0) + and date_dim.d_dow = 1 + and date_dim.d_year in (1999,1999+1,1999+2) + and store.s_number_employees between 200 and 295 + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer + where ss_customer_sk = c_customer_sk + order by c_last_name,c_first_name,substr(s_city,1,30), profit +limit 100; + + +---- RESULTS +---- TYPES +INT, INT, STRING, DECIMAL +====
