TPC-DS Q52 — Date/Brand Extended Sales
TPC-DS benchmark · all TPC-DS queries
Reports extended sales by brand for a specific month and year
Representative SQL
Rendered for DataFusion with default parameters.
SELECT dt.d_year, item.i_brand_id AS brand_id, item.i_brand AS brand, SUM(ss_ext_sales_price) AS ext_priceFROM date_dim AS dt, store_sales, itemWHERE dt.d_date_sk = store_sales.ss_sold_date_sk AND store_sales.ss_item_sk = item.i_item_sk AND item.i_manager_id = 1 AND dt.d_moy = 12 AND dt.d_year = 1998GROUP BY dt.d_year, item.i_brand, item.i_brand_idORDER BY dt.d_year, ext_price DESC, brand_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['52'])Parameter substitution for this benchmark is seed-driven; pass a seed for a specific stream’s parameters:
print(bench.get_query(52, 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', '52', family="expression").source) # or family="pandas"Source
Query text: _sources/tpc-ds/query_templates/query52.tpl