Skip to content

TPC-Havoc Q12_v1

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
l_shipmode,
(
SELECT
COUNT(*)
FROM orders AS o2, lineitem AS l2
WHERE
o2.o_orderkey = l2.l_orderkey
AND l2.l_shipmode = l1.l_shipmode
AND (
o2.o_orderpriority = '1-URGENT' OR o2.o_orderpriority = '2-HIGH'
)
AND l2.l_commitdate < l2.l_receiptdate
AND l2.l_shipdate < l2.l_commitdate
AND l2.l_receiptdate >= CAST('1994-01-01' AS DATE)
AND l2.l_receiptdate < CAST('1994-01-01' AS DATE) + INTERVAL '1 YEAR'
) AS high_line_count,
(
SELECT
COUNT(*)
FROM orders AS o3, lineitem AS l3
WHERE
o3.o_orderkey = l3.l_orderkey
AND l3.l_shipmode = l1.l_shipmode
AND (
o3.o_orderpriority <> '1-URGENT' AND o3.o_orderpriority <> '2-HIGH'
)
AND l3.l_commitdate < l3.l_receiptdate
AND l3.l_shipdate < l3.l_commitdate
AND l3.l_receiptdate >= CAST('1994-01-01' AS DATE)
AND l3.l_receiptdate < CAST('1994-01-01' AS DATE) + INTERVAL '1 YEAR'
) AS low_line_count
FROM (
SELECT DISTINCT
l_shipmode
FROM orders, lineitem
WHERE
o_orderkey = l_orderkey
AND l_shipmode IN ('MAIL', 'SHIP')
AND l_commitdate < l_receiptdate
AND l_shipdate < l_commitdate
AND l_receiptdate >= CAST('1994-01-01' AS DATE)
AND l_receiptdate < CAST('1994-01-01' AS DATE) + INTERVAL '1 YEAR'
) AS l1
GROUP BY
l_shipmode
ORDER BY
l_shipmode

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

Source

Query text: benchbox/core/tpchavoc/variant_sets/q12.py