TPC-DS Q37 — Item Inventory Analysis
TPC-DS benchmark · all TPC-DS queries
Reports items in inventory within price and date constraints
Representative SQL
Rendered for DataFusion with default parameters.
SELECT i_item_id, i_item_desc, i_current_priceFROM item, inventory, date_dim, catalog_salesWHERE i_current_price BETWEEN 22 AND 22 + 30 AND inv_item_sk = i_item_sk AND d_date_sk = inv_date_sk AND d_date BETWEEN CAST('2001-06-02' AS DATE) AND ( CAST('2001-06-02' AS DATE) + INTERVAL '60 DAY' ) AND i_manufact_id IN (678, 964, 918, 849) AND inv_quantity_on_hand BETWEEN 100 AND 500 AND cs_item_sk = i_item_skGROUP BY i_item_id, i_item_desc, i_current_priceORDER BY i_item_idLIMIT 100Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def impl(ctx: DataFrameContext) -> Any: return helper(ctx, query_id, *helper_args)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 TPCDS
bench = TPCDS(scale_factor=1.0) # your scale factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['37'])Parameter substitution for this benchmark is seed-driven; pass a seed for a specific stream’s parameters:
print(bench.get_query(37, scale_factor=1.0, seed=42, dialect="datafusion"))For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('tpcds', '37', family="expression").source) # or family="pandas"Source
Query text: _sources/tpc-ds/query_templates/query37.tpl