TPC-DS-OBT Q70
TPC-DS-OBT benchmark · all TPC-DS-OBT queries
Representative SQL
Rendered for DataFusion with default parameters.
SELECT SUM(net_profit) AS total_sum, store_s_state, store_s_county, GROUPING(store_s_state) + GROUPING(store_s_county) AS lochierarchy, RANK() OVER ( PARTITION BY GROUPING(store_s_state) + GROUPING(store_s_county), CASE WHEN GROUPING(store_s_county) = 0 THEN store_s_state END ORDER BY SUM(net_profit) DESC ) AS rank_within_parentFROM tpcds_sales_returns_obt AS obtWHERE ( sold_date_d_month_seq BETWEEN 1176 AND 1176 + 11 AND sold_date_d_date_sk = sold_date_sk AND store_s_store_sk = store_sk AND store_s_state IN ( SELECT s_state FROM ( SELECT obt.store_s_state AS s_state, RANK() OVER (PARTITION BY obt.store_s_state ORDER BY SUM(obt.net_profit) DESC) AS ranking FROM tpcds_sales_returns_obt AS obt WHERE ( obt.sold_date_d_month_seq BETWEEN 1176 AND 1176 + 11 AND obt.sold_date_d_date_sk = obt.sold_date_sk AND obt.store_s_store_sk = obt.store_sk ) AND channel = 'store' GROUP BY obt.store_s_state ) AS tmp1 WHERE ranking <= 5 ) ) AND channel = 'store'GROUP BY ROLLUP ( store_s_state, store_s_county )ORDER BY lochierarchy DESC, CASE WHEN lochierarchy = 0 THEN store_s_state 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['70'])Source
Query text: benchbox/core/tpcds_obt/queries.py