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,
bill_addr_ca_country,
bill_addr_ca_state,
bill_addr_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 AS obt
WHERE
(
sold_date_sk = sold_date_d_date_sk
AND item_sk = item_i_item_sk
AND bill_cdemo_sk = bill_cdemo_cd_demo_sk
AND bill_customer_sk = bill_customer_c_customer_sk
AND bill_cdemo_cd_gender = '0'
AND bill_cdemo_cd_education_status = '0'
AND bill_customer_c_current_cdemo_sk = bill_cdemo_cd_demo_sk
AND bill_customer_c_current_addr_sk = bill_addr_ca_address_sk
AND bill_customer_c_birth_month IN (2, 4, 1, 5, 8, 3)
AND sold_date_d_year = 1998
AND bill_addr_ca_state IN ('3', '3', '3', '3', '3', '3', '3')
)
AND channel = 'catalog'
GROUP BY
ROLLUP (
item_i_item_id,
bill_addr_ca_country,
bill_addr_ca_state,
bill_addr_ca_county
)
ORDER BY
bill_addr_ca_country,
bill_addr_ca_state,
bill_addr_ca_county,
item_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