TPC-DS-OBT Q23
TPC-DS-OBT benchmark · all TPC-DS-OBT queries
Representative SQL
Rendered for DataFusion with default parameters.
WITH frequent_ss_items AS ( SELECT SUBSTRING(obt.item_i_item_desc FROM 1 FOR 30) AS itemdesc, obt.item_i_item_sk AS item_sk, obt.sold_date_d_date AS solddate, COUNT(*) AS cnt FROM tpcds_sales_returns_obt AS obt WHERE ( obt.sold_date_sk = obt.sold_date_d_date_sk AND obt.item_sk = obt.item_i_item_sk AND obt.sold_date_d_year IN (1998, 1998 + 1, 1998 + 2, 1998 + 3) ) AND channel = 'store' GROUP BY SUBSTRING(obt.item_i_item_desc FROM 1 FOR 30), obt.item_i_item_sk, obt.sold_date_d_date HAVING COUNT(*) > 4), max_store_sales AS ( SELECT MAX(csales) AS tpcds_cmax FROM ( SELECT obt.bill_customer_c_customer_sk, SUM(obt.quantity * obt.sales_price) AS csales FROM tpcds_sales_returns_obt AS obt WHERE ( obt.ship_customer_sk = obt.bill_customer_c_customer_sk AND obt.sold_date_sk = obt.sold_date_d_date_sk AND obt.sold_date_d_year IN (1998, 1998 + 1, 1998 + 2, 1998 + 3) ) AND channel = 'store' GROUP BY obt.bill_customer_c_customer_sk )), best_ss_customer AS ( SELECT obt.bill_customer_c_customer_sk, SUM(obt.quantity * obt.sales_price) AS ssales FROM tpcds_sales_returns_obt AS obt WHERE obt.ship_customer_sk = obt.bill_customer_c_customer_sk AND channel = 'store' GROUP BY obt.bill_customer_c_customer_sk HAVING SUM(obt.quantity * obt.sales_price) > ( CAST(95 AS DOUBLE PRECISION) / 100.0 ) * ( SELECT * FROM max_store_sales ))SELECT SUM(sales)FROM ( SELECT obt.quantity * obt.list_price AS sales FROM tpcds_sales_returns_obt AS obt WHERE ( obt.sold_date_d_year = 1998 AND obt.sold_date_d_moy = 1 AND obt.sold_date_sk = obt.sold_date_d_date_sk AND obt.item_sk IN ( SELECT item_sk FROM frequent_ss_items ) AND obt.bill_customer_sk IN ( SELECT bill_customer_c_customer_sk FROM best_ss_customer ) ) AND channel = 'catalog' UNION ALL SELECT obt.quantity * obt.list_price AS sales FROM tpcds_sales_returns_obt AS obt WHERE ( obt.sold_date_d_year = 1998 AND obt.sold_date_d_moy = 1 AND obt.sold_date_sk = obt.sold_date_d_date_sk AND obt.item_sk IN ( SELECT item_sk FROM frequent_ss_items ) AND obt.bill_customer_sk IN ( SELECT bill_customer_c_customer_sk FROM best_ss_customer ) ) AND channel = 'web')LIMIT 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['23'])Source
Query text: benchbox/core/tpcds_obt/queries.py