TPC-DS-OBT Q10
TPC-DS-OBT benchmark · all TPC-DS-OBT queries
Representative SQL
Rendered for DataFusion with default parameters.
WITH c AS ( SELECT DISTINCT bill_customer_c_customer_sk AS c_customer_sk, bill_cur_cdemo_cd_gender AS cd_gender, bill_cur_cdemo_cd_marital_status AS cd_marital_status, bill_cur_cdemo_cd_education_status AS cd_education_status, bill_cur_cdemo_cd_purchase_estimate AS cd_purchase_estimate, bill_cur_cdemo_cd_credit_rating AS cd_credit_rating, bill_cur_cdemo_cd_dep_count AS cd_dep_count, bill_cur_cdemo_cd_dep_employed_count AS cd_dep_employed_count, bill_cur_cdemo_cd_dep_college_count AS cd_dep_college_count FROM tpcds_sales_returns_obt WHERE channel = 'store' AND NOT bill_customer_c_customer_sk IS NULL AND sold_date_d_year = 2002 AND sold_date_d_moy BETWEEN 4 AND 4 + 3 AND bill_cur_addr_ca_county IN ( 'Walker County', 'Richland County', 'Gaines County', 'Douglas County', 'Dona Ana County' ) AND NOT bill_cur_cdemo_cd_demo_sk IS NULL)SELECT cd_gender, cd_marital_status, cd_education_status, COUNT(*) AS cnt1, cd_purchase_estimate, COUNT(*) AS cnt2, cd_credit_rating, COUNT(*) AS cnt3, cd_dep_count, COUNT(*) AS cnt4, cd_dep_employed_count, COUNT(*) AS cnt5, cd_dep_college_count, COUNT(*) AS cnt6FROM cWHERE EXISTS( SELECT 1 FROM tpcds_sales_returns_obt AS w WHERE w.channel = 'web' AND w.bill_customer_sk = c.c_customer_sk AND w.sold_date_d_year = 2002 AND w.sold_date_d_moy BETWEEN 4 AND 4 + 3 ) OR EXISTS( SELECT 1 FROM tpcds_sales_returns_obt AS k WHERE k.channel = 'catalog' AND k.ship_customer_sk = c.c_customer_sk AND k.sold_date_d_year = 2002 AND k.sold_date_d_moy BETWEEN 4 AND 4 + 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_countORDER 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_countLIMIT 100Representative DataFrame
No DataFrame implementation is registered for this query.
Get the exact query for your run
The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:
from benchbox import TPCDSOBT
bench = TPCDSOBT(scale_factor=1.0) # your scale factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['10'])Source
Query text: benchbox/core/tpcds_obt/queries.py