Skip to content

TPC-DS-OBT Q35

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_addr_ca_state AS ca_state,
bill_cur_cdemo_cd_gender AS cd_gender,
bill_cur_cdemo_cd_marital_status AS cd_marital_status,
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 = 1999
AND sold_date_d_qoy < 4
AND NOT bill_cur_addr_ca_address_sk IS NULL
AND NOT bill_cur_cdemo_cd_demo_sk IS NULL
)
SELECT
ca_state,
cd_gender,
cd_marital_status,
cd_dep_count,
COUNT(*) AS cnt1,
AVG(cd_dep_count) AS aggone1,
MAX(cd_dep_count) AS aggtwo1,
SUM(cd_dep_count) AS aggthree1,
cd_dep_employed_count,
COUNT(*) AS cnt2,
AVG(cd_dep_employed_count) AS aggone2,
MAX(cd_dep_employed_count) AS aggtwo2,
SUM(cd_dep_employed_count) AS aggthree2,
cd_dep_college_count,
COUNT(*) AS cnt3,
AVG(cd_dep_college_count) AS aggone3,
MAX(cd_dep_college_count) AS aggtwo3,
SUM(cd_dep_college_count) AS aggthree3
FROM c
WHERE
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 = 1999
AND w.sold_date_d_qoy < 4
)
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 = 1999
AND k.sold_date_d_qoy < 4
)
GROUP BY
ca_state,
cd_gender,
cd_marital_status,
cd_dep_count,
cd_dep_employed_count,
cd_dep_college_count
ORDER BY
ca_state,
cd_gender,
cd_marital_status,
cd_dep_count,
cd_dep_employed_count,
cd_dep_college_count
LIMIT 100

Representative 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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['35'])

Source

Query text: benchbox/core/tpcds_obt/queries.py