Skip to content

TPC-DS-OBT Q73

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

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
c_last_name,
c_first_name,
c_salutation,
c_preferred_cust_flag,
ss_ticket_number,
cnt
FROM (
SELECT
sale_id AS ss_ticket_number,
bill_customer_c_customer_sk AS cust_sk,
bill_customer_c_last_name AS c_last_name,
bill_customer_c_first_name AS c_first_name,
bill_customer_c_salutation AS c_salutation,
bill_customer_c_preferred_cust_flag AS c_preferred_cust_flag,
COUNT(*) AS cnt
FROM tpcds_sales_returns_obt
WHERE
channel = 'store'
AND NOT sold_date_d_date_sk IS NULL
AND NOT store_s_store_sk IS NULL
AND NOT bill_hdemo_hd_demo_sk IS NULL
AND sold_date_d_dom BETWEEN 1 AND 2
AND (
bill_hdemo_hd_buy_potential = '>10000' OR bill_hdemo_hd_buy_potential = 'Unknown'
)
AND bill_hdemo_hd_vehicle_count > 0
AND CASE
WHEN bill_hdemo_hd_vehicle_count > 0
THEN CAST(bill_hdemo_hd_dep_count AS DOUBLE PRECISION) / bill_hdemo_hd_vehicle_count
ELSE NULL
END > 1
AND sold_date_d_year IN (1998, 1998 + 1, 1998 + 2)
AND store_s_county IN (
'Williamson County',
'Williamson County',
'Williamson County',
'Williamson County'
)
GROUP BY
sale_id,
bill_customer_sk,
bill_customer_c_customer_sk,
bill_customer_c_last_name,
bill_customer_c_first_name,
bill_customer_c_salutation,
bill_customer_c_preferred_cust_flag
) AS dj
WHERE
NOT cust_sk IS NULL AND cnt BETWEEN 1 AND 5
ORDER BY
cnt DESC,
c_last_name ASC

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

Source

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