TPC-DS-OBT Q44
TPC-DS-OBT benchmark · all TPC-DS-OBT queries
Representative SQL
Rendered for DataFusion with default parameters.
SELECT asceding.rnk, ( SELECT MAX(best_obt.item_i_product_name) FROM tpcds_sales_returns_obt AS best_obt WHERE best_obt.item_sk = asceding.item_sk ) AS best_performing, ( SELECT MAX(worst_obt.item_i_product_name) FROM tpcds_sales_returns_obt AS worst_obt WHERE worst_obt.item_sk = descending.item_sk ) AS worst_performingFROM ( SELECT * FROM ( SELECT item_sk, RANK() OVER (ORDER BY rank_col ASC) AS rnk FROM ( SELECT obt.item_sk AS item_sk, AVG(obt.net_profit) AS rank_col FROM tpcds_sales_returns_obt AS obt WHERE obt.store_sk = 2 AND channel = 'store' GROUP BY obt.item_sk HAVING AVG(obt.net_profit) > 0.9 * ( SELECT AVG(obt.net_profit) AS rank_col FROM tpcds_sales_returns_obt AS obt WHERE ( obt.store_sk = 2 AND ship_hdemo_sk IS NULL ) AND channel = 'store' GROUP BY obt.store_sk ) ) AS V1 ) AS V11 WHERE rnk < 11) AS ascedingCROSS JOIN ( SELECT * FROM ( SELECT item_sk, RANK() OVER (ORDER BY rank_col DESC) AS rnk FROM ( SELECT obt.item_sk AS item_sk, AVG(obt.net_profit) AS rank_col FROM tpcds_sales_returns_obt AS obt WHERE obt.store_sk = 2 AND channel = 'store' GROUP BY obt.item_sk HAVING AVG(obt.net_profit) > 0.9 * ( SELECT AVG(obt.net_profit) AS rank_col FROM tpcds_sales_returns_obt AS obt WHERE ( obt.store_sk = 2 AND ship_hdemo_sk IS NULL ) AND channel = 'store' GROUP BY obt.store_sk ) ) AS V2 ) AS V21 WHERE rnk < 11) AS descendingWHERE ( asceding.rnk = descending.rnk )ORDER BY asceding.rnkLIMIT 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['44'])Source
Query text: benchbox/core/tpcds_obt/queries.py