Skip to content

TPC-DS-OBT Q16

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

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
COUNT(DISTINCT obt.sale_id) AS "order count",
SUM(obt.ext_ship_cost) AS "total shipping cost",
SUM(obt.net_profit) AS "total net profit"
FROM tpcds_sales_returns_obt AS obt
WHERE
(
obt.ship_date_d_date BETWEEN '1999-2-01' AND (
CAST('1999-2-01' AS DATE) + INTERVAL '60 DAY'
)
AND obt.ship_date_sk = obt.ship_date_d_date_sk
AND obt.ship_addr_sk = obt.ship_addr_ca_address_sk
AND obt.ship_addr_ca_state = 'IL'
AND obt.call_center_sk = obt.call_center_cc_call_center_sk
AND obt.call_center_cc_county IN (
'Williamson County',
'Williamson County',
'Williamson County',
'Williamson County',
'Williamson County'
)
AND EXISTS(
SELECT
*
FROM tpcds_sales_returns_obt AS other_obt
WHERE
(
other_obt.sale_id = obt.sale_id AND other_obt.warehouse_sk <> obt.warehouse_sk
)
AND other_obt.channel = 'catalog'
)
AND NOT EXISTS(
SELECT
*
FROM tpcds_sales_returns_obt AS ret_obt
WHERE
ret_obt.sale_id = obt.sale_id
AND ret_obt.has_return = 'Y'
AND ret_obt.channel = 'catalog'
)
)
AND channel = 'catalog'
ORDER BY
COUNT(DISTINCT obt.sale_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['16'])

Source

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