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,
ARRAY_AGG(l_quantity ORDER BY l_orderkey, l_linenumber) AS quantities,
ARRAY_AGG(l_extendedprice ORDER BY l_orderkey, l_linenumber) AS prices,
ARRAY_AGG(l_discount ORDER BY l_orderkey, l_linenumber) AS discounts,
ARRAY_AGG(l_tax ORDER BY l_orderkey, l_linenumber) AS taxes,
SUM(l_quantity) AS _fold0,
SUM(l_extendedprice) AS _fold1,
SUM(l_extendedprice * (
1 - l_discount
)) AS _fold2,
SUM(l_extendedprice * (
1 - l_discount
) * (
1 + l_tax
)) AS _fold3,
AVG(CAST(l_quantity AS DOUBLE PRECISION)) AS _fold4,
AVG(CAST(l_extendedprice AS DOUBLE PRECISION)) AS _fold5,
AVG(CAST(l_discount AS DOUBLE PRECISION)) AS _fold6
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,
_fold0 AS sum_qty,
_fold1 AS sum_base_price,
_fold2 AS sum_disc_price,
_fold3 AS sum_charge,
_fold4 AS avg_qty,
_fold5 AS avg_price,
_fold6 AS avg_disc,
ARRAY_LENGTH(quantities, 1) 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