Skip to content

TPC-Havoc Q3_v5

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

WITH qualified_customers AS (
SELECT
c_custkey
FROM customer
WHERE
c_mktsegment = 'BUILDING'
), qualified_orders AS (
SELECT
o_orderkey,
o_orderdate,
o_shippriority,
o_custkey
FROM orders
WHERE
o_orderdate < CAST('1995-03-15' AS DATE)
), qualified_lineitems AS (
SELECT
l_orderkey,
l_extendedprice,
l_discount
FROM lineitem
WHERE
l_shipdate > CAST('1995-03-15' AS DATE)
)
SELECT
ql.l_orderkey,
SUM(ql.l_extendedprice * (
1 - ql.l_discount
)) AS revenue,
qo.o_orderdate,
qo.o_shippriority
FROM qualified_customers AS qc
JOIN qualified_orders AS qo
ON qc.c_custkey = qo.o_custkey
JOIN qualified_lineitems AS ql
ON qo.o_orderkey = ql.l_orderkey
GROUP BY
ql.l_orderkey,
qo.o_orderdate,
qo.o_shippriority
ORDER BY
revenue DESC,
qo.o_orderdate

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['3_v5'])

Source

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