Skip to content

TPC-Havoc Q8_v9

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT DISTINCT
o_year,
SUM(CASE WHEN nation = 'BRAZIL' THEN volume ELSE 0 END) OVER (PARTITION BY o_year) / SUM(volume) OVER (PARTITION BY o_year) AS mkt_share
FROM (
SELECT
EXTRACT(YEAR FROM o_orderdate) AS o_year,
l_extendedprice * (
1 - l_discount
) AS volume,
n2.n_name AS nation
FROM part, supplier, lineitem, orders, customer, nation AS n1, nation AS n2, region
WHERE
p_partkey = l_partkey
AND s_suppkey = l_suppkey
AND l_orderkey = o_orderkey
AND o_custkey = c_custkey
AND c_nationkey = n1.n_nationkey
AND n1.n_regionkey = r_regionkey
AND r_name = 'AMERICA'
AND s_nationkey = n2.n_nationkey
AND o_orderdate BETWEEN CAST('1995-01-01' AS DATE) AND CAST('1996-12-31' AS DATE)
AND p_type = 'ECONOMY ANODIZED STEEL'
) AS all_nations
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_v9'])

Source

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