TPC-DS Q94 — Web Multi-Warehouse Orders Not Returned
TPC-DS benchmark · all TPC-DS queries
Web orders shipped from multiple warehouses that were not returned
Representative SQL
Rendered for DataFusion with default parameters.
SELECT COUNT(DISTINCT ws_order_number) AS "order count", SUM(ws_ext_ship_cost) AS "total shipping cost", SUM(ws_net_profit) AS "total net profit"FROM web_sales AS ws1, date_dim, customer_address, web_siteWHERE d_date BETWEEN '1999-5-01' AND ( CAST('1999-5-01' AS DATE) + INTERVAL '60 DAY' ) AND ws1.ws_ship_date_sk = d_date_sk AND ws1.ws_ship_addr_sk = ca_address_sk AND ca_state = 'TX' AND ws1.ws_web_site_sk = web_site_sk AND web_company_name = 'pri' AND EXISTS( SELECT * FROM web_sales AS ws2 WHERE ws1.ws_order_number = ws2.ws_order_number AND ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk ) AND NOT EXISTS( SELECT * FROM web_returns AS wr1 WHERE ws1.ws_order_number = wr1.wr_order_number )ORDER BY COUNT(DISTINCT ws_order_number)LIMIT 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['94'])Parameter substitution for this benchmark is seed-driven; pass a seed for a specific stream’s parameters:
print(bench.get_query(94, 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', '94', family="expression").source) # or family="pandas"Source
Query text: _sources/tpc-ds/query_templates/query94.tpl