Skip to content

TPC-Havoc Q14_v4

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
100.00 * SUM(promo_revenue) / SUM(total_revenue) AS promo_revenue
FROM (
SELECT
SUM(
CASE
WHEN p_type LIKE 'PROMO%'
THEN l_extendedprice * (
1 - l_discount
)
ELSE 0
END
) AS promo_revenue,
SUM(l_extendedprice * (
1 - l_discount
)) AS total_revenue
FROM lineitem, part
WHERE
l_partkey = p_partkey
AND l_shipdate >= CAST('1995-09-01' AS DATE)
AND l_shipdate < CAST('1995-09-01' AS DATE) + INTERVAL '1 MONTH'
AND p_type LIKE 'PROMO%'
UNION ALL
SELECT
0 AS promo_revenue,
SUM(l_extendedprice * (
1 - l_discount
)) AS total_revenue
FROM lineitem, part
WHERE
l_partkey = p_partkey
AND l_shipdate >= CAST('1995-09-01' AS DATE)
AND l_shipdate < CAST('1995-09-01' AS DATE) + INTERVAL '1 MONTH'
AND p_type NOT LIKE 'PROMO%'
) AS combined

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['14_v4'])

Source

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