Skip to content

TPC-DS-OBT Q24

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

Representative SQL

Rendered for DataFusion with default parameters.

WITH ssales AS (
SELECT
obt.bill_customer_c_last_name,
obt.bill_customer_c_first_name,
obt.store_s_store_name,
obt.bill_addr_ca_state,
obt.store_s_state,
obt.item_i_color,
obt.item_i_current_price,
obt.item_i_manager_id,
obt.item_i_units,
obt.item_i_size,
SUM(net_paid) AS netpaid
FROM tpcds_sales_returns_obt AS obt
WHERE
(
obt.sale_id = obt.sale_id
AND obt.item_sk = obt.item_sk
AND obt.ship_customer_sk = obt.bill_customer_c_customer_sk
AND obt.item_sk = obt.item_i_item_sk
AND obt.store_sk = obt.store_s_store_sk
AND obt.bill_customer_c_current_addr_sk = obt.bill_addr_ca_address_sk
AND obt.bill_customer_c_birth_country <> UPPER(obt.bill_addr_ca_country)
AND obt.store_s_zip = obt.bill_addr_ca_zip
AND obt.store_s_market_id = 5
)
AND channel = 'store'
GROUP BY
obt.bill_customer_c_last_name,
obt.bill_customer_c_first_name,
obt.store_s_store_name,
obt.bill_addr_ca_state,
obt.store_s_state,
obt.item_i_color,
obt.item_i_current_price,
obt.item_i_manager_id,
obt.item_i_units,
obt.item_i_size
)
SELECT
bill_customer_c_last_name,
bill_customer_c_first_name,
store_s_store_name,
SUM(netpaid) AS paid
FROM ssales
WHERE
item_i_color = '1'
GROUP BY
bill_customer_c_last_name,
bill_customer_c_first_name,
store_s_store_name
HAVING
SUM(netpaid) > (
SELECT
0.05 * AVG(netpaid)
FROM ssales
)
ORDER BY
bill_customer_c_last_name,
bill_customer_c_first_name,
store_s_store_name

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

Source

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