Skip to content

TPC-Havoc Q1_v7

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

WITH aggregated AS (
SELECT
l_returnflag,
l_linestatus,
LIST(l_quantity) AS quantities,
LIST(l_extendedprice) AS prices,
LIST(l_discount) AS discounts,
LIST(l_tax) AS taxes
FROM lineitem
WHERE
l_shipdate <= CAST('1998-12-01' AS DATE) - INTERVAL '90 DAY'
GROUP BY
l_returnflag,
l_linestatus
)
SELECT
l_returnflag,
l_linestatus,
LIST_SUM(quantities) AS sum_qty,
LIST_SUM(prices) AS sum_base_price,
LIST_SUM(LIST_TRANSFORM(LIST_ZIP(prices, discounts), x -> x[1] * (
1 - x[2]
))) AS sum_disc_price,
LIST_SUM(
LIST_TRANSFORM(LIST_ZIP(prices, discounts, taxes), x -> x[1] * (
1 - x[2]
) * (
1 + x[3]
))
) AS sum_charge,
LIST_AVG(quantities) AS avg_qty,
LIST_AVG(prices) AS avg_price,
LIST_AVG(discounts) AS avg_disc,
LENGTH(quantities) AS count_order
FROM aggregated
ORDER BY
l_returnflag,
l_linestatus

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['1_v7'])

Source

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