Skip to content

TPC-DS-OBT Q29

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

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
s.item_i_item_id AS i_item_id,
s.item_i_item_desc AS i_item_desc,
s.store_s_store_id AS s_store_id,
s.store_s_store_name AS s_store_name,
SUM(s.quantity) AS store_sales_quantity,
SUM(s.return_quantity) AS store_returns_quantity,
SUM(c.quantity) AS catalog_sales_quantity
FROM tpcds_sales_returns_obt AS s
JOIN tpcds_sales_returns_obt AS c
ON c.bill_customer_sk = s.returning_customer_c_customer_sk AND c.item_sk = s.item_sk
WHERE
s.channel = 'store'
AND s.has_return = 'Y'
AND c.channel = 'catalog'
AND s.sold_date_d_moy = 4
AND s.sold_date_d_year = 1999
AND NOT s.item_i_item_sk IS NULL
AND NOT s.store_s_store_sk IS NULL
AND s.bill_customer_sk = s.returning_customer_c_customer_sk
AND s.return_date_d_moy BETWEEN 4 AND 4 + 3
AND s.return_date_d_year = 1999
AND c.sold_date_d_year IN (1999, 1999 + 1, 1999 + 2)
GROUP BY
s.item_i_item_id,
s.item_i_item_desc,
s.store_s_store_id,
s.store_s_store_name
ORDER BY
s.item_i_item_id,
s.item_i_item_desc,
s.store_s_store_id,
s.store_s_store_name
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['29'])

Source

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