-
Notifications
You must be signed in to change notification settings - Fork 286
chore: Add TPC-* queries to repo #3562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| -- CometBench-DS query 1 derived from TPC-DS query 1 under the terms of the TPC Fair Use Policy. | ||
| -- TPC-DS queries are Copyright 2021 Transaction Processing Performance Council. | ||
| -- This query was generated at scale factor 1. | ||
| with customer_total_return as | ||
| (select sr_customer_sk as ctr_customer_sk | ||
| ,sr_store_sk as ctr_store_sk | ||
| ,sum(SR_RETURN_AMT_INC_TAX) as ctr_total_return | ||
| from store_returns | ||
| ,date_dim | ||
| where sr_returned_date_sk = d_date_sk | ||
| and d_year =1999 | ||
| group by sr_customer_sk | ||
| ,sr_store_sk) | ||
| select c_customer_id | ||
| from customer_total_return ctr1 | ||
| ,store | ||
| ,customer | ||
| where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 | ||
| from customer_total_return ctr2 | ||
| where ctr1.ctr_store_sk = ctr2.ctr_store_sk) | ||
| and s_store_sk = ctr1.ctr_store_sk | ||
| and s_state = 'TN' | ||
| and ctr1.ctr_customer_sk = c_customer_sk | ||
| order by c_customer_id | ||
| LIMIT 100; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| -- CometBench-DS query 10 derived from TPC-DS query 10 under the terms of the TPC Fair Use Policy. | ||
| -- TPC-DS queries are Copyright 2021 Transaction Processing Performance Council. | ||
| -- This query was generated at scale factor 1. | ||
| select | ||
| cd_gender, | ||
| cd_marital_status, | ||
| cd_education_status, | ||
| count(*) cnt1, | ||
| cd_purchase_estimate, | ||
| count(*) cnt2, | ||
| cd_credit_rating, | ||
| count(*) cnt3, | ||
| cd_dep_count, | ||
| count(*) cnt4, | ||
| cd_dep_employed_count, | ||
| count(*) cnt5, | ||
| cd_dep_college_count, | ||
| count(*) cnt6 | ||
| from | ||
| customer c,customer_address ca,customer_demographics | ||
| where | ||
| c.c_current_addr_sk = ca.ca_address_sk and | ||
| ca_county in ('Clinton County','Platte County','Franklin County','Louisa County','Harmon County') 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 = 2002 and | ||
| d_moy between 3 and 3+3) and | ||
| (exists (select * | ||
| from web_sales,date_dim | ||
| where c.c_customer_sk = ws_bill_customer_sk and | ||
| ws_sold_date_sk = d_date_sk and | ||
| d_year = 2002 and | ||
| d_moy between 3 ANd 3+3) or | ||
| exists (select * | ||
| from catalog_sales,date_dim | ||
| where c.c_customer_sk = cs_ship_customer_sk and | ||
| cs_sold_date_sk = d_date_sk and | ||
| d_year = 2002 and | ||
| d_moy between 3 and 3+3)) | ||
| group by cd_gender, | ||
| cd_marital_status, | ||
| cd_education_status, | ||
| cd_purchase_estimate, | ||
| cd_credit_rating, | ||
| cd_dep_count, | ||
| cd_dep_employed_count, | ||
| cd_dep_college_count | ||
| order by cd_gender, | ||
| cd_marital_status, | ||
| cd_education_status, | ||
| cd_purchase_estimate, | ||
| cd_credit_rating, | ||
| cd_dep_count, | ||
| cd_dep_employed_count, | ||
| cd_dep_college_count | ||
| LIMIT 100; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| -- CometBench-DS query 11 derived from TPC-DS query 11 under the terms of the TPC Fair Use Policy. | ||
| -- TPC-DS queries are Copyright 2021 Transaction Processing Performance Council. | ||
| -- This query was generated at scale factor 1. | ||
| with year_total as ( | ||
| select c_customer_id customer_id | ||
| ,c_first_name customer_first_name | ||
| ,c_last_name customer_last_name | ||
| ,c_preferred_cust_flag customer_preferred_cust_flag | ||
| ,c_birth_country customer_birth_country | ||
| ,c_login customer_login | ||
| ,c_email_address customer_email_address | ||
| ,d_year dyear | ||
| ,sum(ss_ext_list_price-ss_ext_discount_amt) 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 | ||
| group by c_customer_id | ||
| ,c_first_name | ||
| ,c_last_name | ||
| ,c_preferred_cust_flag | ||
| ,c_birth_country | ||
| ,c_login | ||
| ,c_email_address | ||
| ,d_year | ||
| union all | ||
| select c_customer_id customer_id | ||
| ,c_first_name customer_first_name | ||
| ,c_last_name customer_last_name | ||
| ,c_preferred_cust_flag customer_preferred_cust_flag | ||
| ,c_birth_country customer_birth_country | ||
| ,c_login customer_login | ||
| ,c_email_address customer_email_address | ||
| ,d_year dyear | ||
| ,sum(ws_ext_list_price-ws_ext_discount_amt) 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 | ||
| group by c_customer_id | ||
| ,c_first_name | ||
| ,c_last_name | ||
| ,c_preferred_cust_flag | ||
| ,c_birth_country | ||
| ,c_login | ||
| ,c_email_address | ||
| ,d_year | ||
| ) | ||
| select | ||
| t_s_secyear.customer_id | ||
| ,t_s_secyear.customer_first_name | ||
| ,t_s_secyear.customer_last_name | ||
| ,t_s_secyear.customer_email_address | ||
| 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.dyear = 1999 | ||
| and t_s_secyear.dyear = 1999+1 | ||
| and t_w_firstyear.dyear = 1999 | ||
| and t_w_secyear.dyear = 1999+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 0.0 end | ||
| > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0 end | ||
| order by t_s_secyear.customer_id | ||
| ,t_s_secyear.customer_first_name | ||
| ,t_s_secyear.customer_last_name | ||
| ,t_s_secyear.customer_email_address | ||
| LIMIT 100; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| -- CometBench-DS query 12 derived from TPC-DS query 12 under the terms of the TPC Fair Use Policy. | ||
| -- TPC-DS queries are Copyright 2021 Transaction Processing Performance Council. | ||
| -- This query was generated at scale factor 1. | ||
| select i_item_id | ||
| ,i_item_desc | ||
| ,i_category | ||
| ,i_class | ||
| ,i_current_price | ||
| ,sum(ws_ext_sales_price) as itemrevenue | ||
| ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over | ||
| (partition by i_class) as revenueratio | ||
| from | ||
| web_sales | ||
| ,item | ||
| ,date_dim | ||
| where | ||
| ws_item_sk = i_item_sk | ||
| and i_category in ('Jewelry', 'Books', 'Women') | ||
| and ws_sold_date_sk = d_date_sk | ||
| and d_date between cast('2002-03-22' as date) | ||
| and (cast('2002-03-22' as date) + 30 days) | ||
| group by | ||
| i_item_id | ||
| ,i_item_desc | ||
| ,i_category | ||
| ,i_class | ||
| ,i_current_price | ||
| order by | ||
| i_category | ||
| ,i_class | ||
| ,i_item_id | ||
| ,i_item_desc | ||
| ,revenueratio | ||
| LIMIT 100; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| -- CometBench-DS query 13 derived from TPC-DS query 13 under the terms of the TPC Fair Use Policy. | ||
| -- TPC-DS queries are Copyright 2021 Transaction Processing Performance Council. | ||
| -- This query was generated at scale factor 1. | ||
| select avg(ss_quantity) | ||
| ,avg(ss_ext_sales_price) | ||
| ,avg(ss_ext_wholesale_cost) | ||
| ,sum(ss_ext_wholesale_cost) | ||
| from store_sales | ||
| ,store | ||
| ,customer_demographics | ||
| ,household_demographics | ||
| ,customer_address | ||
| ,date_dim | ||
| where s_store_sk = ss_store_sk | ||
| and ss_sold_date_sk = d_date_sk and d_year = 2001 | ||
| and((ss_hdemo_sk=hd_demo_sk | ||
| and cd_demo_sk = ss_cdemo_sk | ||
| and cd_marital_status = 'U' | ||
| and cd_education_status = '4 yr Degree' | ||
| and ss_sales_price between 100.00 and 150.00 | ||
| and hd_dep_count = 3 | ||
| )or | ||
| (ss_hdemo_sk=hd_demo_sk | ||
| and cd_demo_sk = ss_cdemo_sk | ||
| and cd_marital_status = 'S' | ||
| and cd_education_status = 'Unknown' | ||
| and ss_sales_price between 50.00 and 100.00 | ||
| and hd_dep_count = 1 | ||
| ) or | ||
| (ss_hdemo_sk=hd_demo_sk | ||
| and cd_demo_sk = ss_cdemo_sk | ||
| and cd_marital_status = 'D' | ||
| and cd_education_status = '2 yr Degree' | ||
| and ss_sales_price between 150.00 and 200.00 | ||
| and hd_dep_count = 1 | ||
| )) | ||
| and((ss_addr_sk = ca_address_sk | ||
| and ca_country = 'United States' | ||
| and ca_state in ('CO', 'MI', 'MN') | ||
| and ss_net_profit between 100 and 200 | ||
| ) or | ||
| (ss_addr_sk = ca_address_sk | ||
| and ca_country = 'United States' | ||
| and ca_state in ('NC', 'NY', 'TX') | ||
| and ss_net_profit between 150 and 300 | ||
| ) or | ||
| (ss_addr_sk = ca_address_sk | ||
| and ca_country = 'United States' | ||
| and ca_state in ('CA', 'NE', 'TN') | ||
| and ss_net_profit between 50 and 250 | ||
| )) | ||
| ; | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard is it to parameterize this in the future? I wonder what values change, considering we usually run SF100 or 1000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could try regenerating at different scale factors and do a diff