Skip to content

TPC-DS-OBT Q6

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

Representative SQL

Rendered for DataFusion with default parameters.

WITH cat_avg AS (
SELECT
item_i_category AS cat,
AVG(item_i_current_price) AS avg_price
FROM (
SELECT DISTINCT
item_i_item_sk,
item_i_category,
item_i_current_price
FROM tpcds_sales_returns_obt
WHERE
NOT item_i_item_sk IS NULL
) AS items
GROUP BY
item_i_category
)
SELECT
obt.bill_cur_addr_ca_state AS state,
COUNT(*) AS cnt
FROM tpcds_sales_returns_obt AS obt
JOIN cat_avg
ON obt.item_i_category = cat_avg.cat
WHERE
obt.channel = 'store'
AND NOT obt.bill_cur_addr_ca_address_sk IS NULL
AND obt.sold_date_d_month_seq = (
SELECT DISTINCT
sold_date_d_month_seq
FROM tpcds_sales_returns_obt
WHERE
sold_date_d_year = 2000 AND sold_date_d_moy = 2
)
AND obt.item_i_current_price > 1.2 * cat_avg.avg_price
GROUP BY
obt.bill_cur_addr_ca_state
HAVING
COUNT(*) >= 10
ORDER BY
cnt,
state
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['6'])

Source

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