Skip to content

TPC-DS Q26 — Catalog Sales Promo Analysis

TPC-DS benchmark · all TPC-DS queries

Reports catalog sales promotion effectiveness

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
i_item_id,
AVG(cs_quantity) AS agg1,
AVG(cs_list_price) AS agg2,
AVG(cs_coupon_amt) AS agg3,
AVG(cs_sales_price) AS agg4
FROM catalog_sales, customer_demographics, date_dim, item, promotion
WHERE
cs_sold_date_sk = d_date_sk
AND cs_item_sk = i_item_sk
AND cs_bill_cdemo_sk = cd_demo_sk
AND cs_promo_sk = p_promo_sk
AND cd_gender = 'F'
AND cd_marital_status = 'W'
AND cd_education_status = 'Primary'
AND (
p_channel_email = 'N' OR p_channel_event = 'N'
)
AND d_year = 1998
GROUP BY
i_item_id
ORDER BY
i_item_id
LIMIT 100

Representative 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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['26'])

Parameter substitution for this benchmark is seed-driven; pass a seed for a specific stream’s parameters:

print(bench.get_query(26, 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', '26', family="expression").source) # or family="pandas"

Source

Query text: _sources/tpc-ds/query_templates/query26.tpl