This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NSE-108] Add end-to-end test suite against TPC-DS (#109)
Close #108
- Loading branch information
1 parent
2576a03
commit 2df91d6
Showing
136 changed files
with
5,926 additions
and
350 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,19 @@ | ||
WITH customer_total_return AS | ||
( SELECT | ||
sr_customer_sk AS ctr_customer_sk, | ||
sr_store_sk AS ctr_store_sk, | ||
sum(sr_return_amt) AS ctr_total_return | ||
FROM store_returns, date_dim | ||
WHERE sr_returned_date_sk = d_date_sk AND d_year = 2000 | ||
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 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,57 @@ | ||
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 ('Rush County', 'Toole County', 'Jefferson County', | ||
'Dona Ana County', 'La Porte 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 1 AND 1 + 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 1 AND 1 + 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 1 AND 1 + 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 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,68 @@ | ||
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 | ||
, d_year | ||
, 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_preferred_cust_flag | ||
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 = 2001 | ||
AND t_s_secyear.dyear = 2001 + 1 | ||
AND t_w_firstyear.dyear = 2001 | ||
AND t_w_secyear.dyear = 2001 + 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 t_s_secyear.customer_preferred_cust_flag | ||
LIMIT 100 |
This file contains 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,22 @@ | ||
SELECT | ||
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 ('Sports', 'Books', 'Home') | ||
AND ws_sold_date_sk = d_date_sk | ||
AND d_date BETWEEN cast('1999-02-22' AS DATE) | ||
AND (cast('1999-02-22' AS DATE) + INTERVAL 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 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,49 @@ | ||
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 = 'M' | ||
AND cd_education_status = 'Advanced 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 = 'College' | ||
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 = 'W' | ||
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 ('TX', 'OH', 'TX') | ||
AND ss_net_profit BETWEEN 100 AND 200 | ||
) OR | ||
(ss_addr_sk = ca_address_sk | ||
AND ca_country = 'United States' | ||
AND ca_state IN ('OR', 'NM', 'KY') | ||
AND ss_net_profit BETWEEN 150 AND 300 | ||
) OR | ||
(ss_addr_sk = ca_address_sk | ||
AND ca_country = 'United States' | ||
AND ca_state IN ('VA', 'TX', 'MS') | ||
AND ss_net_profit BETWEEN 50 AND 250 | ||
)) |
Oops, something went wrong.