Skip to content

TPC-Havoc Q8_v3

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
o_year,
SUM(CASE WHEN nation = 'BRAZIL' THEN volume ELSE 0 END) / SUM(volume) AS mkt_share
FROM (
SELECT
EXTRACT(YEAR FROM o.o_orderdate) AS o_year,
l.l_extendedprice * (
1 - l.l_discount
) AS volume,
n2.n_name AS nation
FROM part AS p
INNER JOIN lineitem AS l
ON p.p_partkey = l.l_partkey
INNER JOIN supplier AS s
ON l.l_suppkey = s.s_suppkey
INNER JOIN orders AS o
ON l.l_orderkey = o.o_orderkey
INNER JOIN customer AS c
ON o.o_custkey = c.c_custkey
INNER JOIN nation AS n1
ON c.c_nationkey = n1.n_nationkey
INNER JOIN region AS r
ON n1.n_regionkey = r.r_regionkey
INNER JOIN nation AS n2
ON s.s_nationkey = n2.n_nationkey
WHERE
r.r_name = 'AMERICA'
AND o.o_orderdate BETWEEN CAST('1995-01-01' AS DATE) AND CAST('1996-12-31' AS DATE)
AND p.p_type = 'ECONOMY ANODIZED STEEL'
) AS all_nations
GROUP BY
o_year
ORDER BY
o_year

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['8_v3'])

Source

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