Skip to content

TPC-DS-OBT Q87

TPC-DS-OBT benchmark · all TPC-DS-OBT queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
COUNT(*)
FROM (
(
SELECT DISTINCT
obt.bill_customer_c_last_name,
obt.bill_customer_c_first_name,
obt.sold_date_d_date
FROM tpcds_sales_returns_obt AS obt
WHERE
(
obt.sold_date_sk = sold_date_d_date_sk
AND obt.ship_customer_sk = bill_customer_c_customer_sk
AND obt.sold_date_d_month_seq BETWEEN 1176 AND 1176 + 11
)
AND channel = 'store'
)
EXCEPT
(
SELECT DISTINCT
obt.bill_customer_c_last_name,
obt.bill_customer_c_first_name,
obt.sold_date_d_date
FROM tpcds_sales_returns_obt AS obt
WHERE
(
obt.sold_date_sk = sold_date_d_date_sk
AND obt.bill_customer_sk = bill_customer_c_customer_sk
AND obt.sold_date_d_month_seq BETWEEN 1176 AND 1176 + 11
)
AND channel = 'catalog'
)
EXCEPT
(
SELECT DISTINCT
obt.bill_customer_c_last_name,
obt.bill_customer_c_first_name,
obt.sold_date_d_date
FROM tpcds_sales_returns_obt AS obt
WHERE
(
obt.sold_date_sk = sold_date_d_date_sk
AND obt.bill_customer_sk = bill_customer_c_customer_sk
AND obt.sold_date_d_month_seq BETWEEN 1176 AND 1176 + 11
)
AND channel = 'web'
)
) AS cool_cust

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['87'])

Source

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