Skip to content

TPC-DS-OBT Q65

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

Representative SQL

Rendered for DataFusion with default parameters.

WITH sc AS (
SELECT
store_sk,
item_sk,
store_s_store_name,
item_i_item_desc,
item_i_current_price,
item_i_wholesale_cost,
item_i_brand,
store_s_store_sk,
item_i_item_sk,
SUM(sales_price) AS revenue
FROM tpcds_sales_returns_obt
WHERE
channel = 'store' AND sold_date_d_month_seq BETWEEN 1212 AND 1212 + 11
GROUP BY
store_sk,
item_sk,
store_s_store_name,
item_i_item_desc,
item_i_current_price,
item_i_wholesale_cost,
item_i_brand,
store_s_store_sk,
item_i_item_sk
), sb AS (
SELECT
store_sk,
AVG(revenue) AS ave
FROM sc
GROUP BY
store_sk
)
SELECT
sc.store_s_store_name AS s_store_name,
sc.item_i_item_desc AS i_item_desc,
sc.revenue,
sc.item_i_current_price AS i_current_price,
sc.item_i_wholesale_cost AS i_wholesale_cost,
sc.item_i_brand AS i_brand
FROM sb
JOIN sc
ON sb.store_sk = sc.store_sk
WHERE
sc.revenue <= 0.1 * sb.ave
AND NOT sc.store_s_store_sk IS NULL
AND NOT sc.item_i_item_sk IS NULL
ORDER BY
s_store_name,
i_item_desc
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['65'])

Source

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