TPC-DS-OBT Q36
TPC-DS-OBT benchmark · all TPC-DS-OBT queries
Representative SQL
Rendered for DataFusion with default parameters.
SELECT CAST(SUM(obt.net_profit) AS DOUBLE PRECISION) / SUM(obt.ext_sales_price) AS gross_margin, obt.item_i_category, obt.item_i_class, GROUPING(obt.item_i_category) + GROUPING(obt.item_i_class) AS lochierarchy, RANK() OVER ( PARTITION BY GROUPING(obt.item_i_category) + GROUPING(obt.item_i_class), CASE WHEN GROUPING(obt.item_i_class) = 0 THEN obt.item_i_category END ORDER BY CAST(SUM(obt.net_profit) AS DOUBLE PRECISION) / SUM(obt.ext_sales_price) ASC ) AS rank_within_parentFROM tpcds_sales_returns_obt AS obtWHERE ( obt.sold_date_d_year = 2000 AND obt.sold_date_d_date_sk = obt.sold_date_sk AND obt.item_i_item_sk = obt.item_sk AND obt.store_s_store_sk = obt.store_sk AND obt.store_s_state IN ('TN', 'TN', 'TN', 'TN', 'TN', 'TN', 'TN', 'TN') ) AND channel = 'store'GROUP BY ROLLUP ( obt.item_i_category, obt.item_i_class )ORDER BY lochierarchy DESC, CASE WHEN lochierarchy = 0 THEN obt.item_i_category END, rank_within_parentLIMIT 100Representative DataFrame
No DataFrame implementation is registered for this query.
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 TPCDSOBT
bench = TPCDSOBT(scale_factor=1.0) # your scale factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['36'])Source
Query text: benchbox/core/tpcds_obt/queries.py