TPC-DS Q19 — Store Sales Item/Customer Analysis
TPC-DS benchmark · all TPC-DS queries
Reports sales by item brand for customers, filtered by manager and zip codes
Representative SQL
Rendered for DataFusion with default parameters.
SELECT i_brand_id AS brand_id, i_brand AS brand, i_manufact_id, i_manufact, SUM(ss_ext_sales_price) AS ext_priceFROM date_dim, store_sales, item, customer, customer_address, storeWHERE d_date_sk = ss_sold_date_sk AND ss_item_sk = i_item_sk AND i_manager_id = 7 AND d_moy = 11 AND d_year = 1999 AND ss_customer_sk = c_customer_sk AND c_current_addr_sk = ca_address_sk AND SUBSTRING(ca_zip FROM 1 FOR 5) <> SUBSTRING(s_zip FROM 1 FOR 5) AND ss_store_sk = s_store_skGROUP BY i_brand, i_brand_id, i_manufact_id, i_manufactORDER BY ext_price DESC, i_brand, i_brand_id, i_manufact_id, i_manufactLIMIT 100Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def impl(ctx: DataFrameContext) -> Any: return engine(ctx, spec)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['19'])Parameter substitution for this benchmark is seed-driven; pass a seed for a specific stream’s parameters:
print(bench.get_query(19, 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', '19', family="expression").source) # or family="pandas"Source
Query text: _sources/tpc-ds/query_templates/query19.tpl