Skip to content

TPC-DS-OBT Q18

TPC-DS-OBT benchmark · all TPC-DS-OBT queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
item_i_item_id AS i_item_id,
bill_cur_addr_ca_country AS ca_country,
bill_cur_addr_ca_state AS ca_state,
bill_cur_addr_ca_county AS ca_county,
AVG(CAST(quantity AS DECIMAL(12, 2))) AS agg1,
AVG(CAST(list_price AS DECIMAL(12, 2))) AS agg2,
AVG(CAST(coupon_amt AS DECIMAL(12, 2))) AS agg3,
AVG(CAST(sales_price AS DECIMAL(12, 2))) AS agg4,
AVG(CAST(net_profit AS DECIMAL(12, 2))) AS agg5,
AVG(CAST(bill_customer_c_birth_year AS DECIMAL(12, 2))) AS agg6,
AVG(CAST(bill_cdemo_cd_dep_count AS DECIMAL(12, 2))) AS agg7
FROM tpcds_sales_returns_obt
WHERE
channel = 'catalog'
AND sold_date_d_year = 2001
AND NOT item_i_item_sk IS NULL
AND bill_cdemo_cd_gender = 'M'
AND bill_cdemo_cd_education_status = 'College'
AND NOT bill_cur_cdemo_cd_demo_sk IS NULL
AND NOT bill_cur_addr_ca_address_sk IS NULL
AND bill_customer_c_birth_month IN (9, 5, 12, 4, 1, 10)
AND bill_cur_addr_ca_state IN ('ND', 'WI', 'AL', 'NC', 'OK', 'MS', 'TN')
GROUP BY
ROLLUP (
item_i_item_id,
bill_cur_addr_ca_country,
bill_cur_addr_ca_state,
bill_cur_addr_ca_county
)
ORDER BY
ca_country,
ca_state,
ca_county,
i_item_id
LIMIT 100

Representative 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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['18'])

Source

Query text: benchbox/core/tpcds_obt/queries.py