Skip to content

Write Primitives merge_etl_aggregation_pattern

Write Primitives benchmark · all Write Primitives queries

Representative SQL

Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).

MERGE INTO merge_ops_target AS target
USING (
SELECT
l_orderkey,
SUM(l_extendedprice * (
1 - l_discount
)) AS computed_revenue,
MAX(l_shipdate) AS latest_ship_date,
COUNT(*) AS line_count
FROM lineitem
WHERE
l_orderkey BETWEEN 1 AND 1000
GROUP BY
l_orderkey
) AS source
ON target.o_orderkey = source.l_orderkey
WHEN MATCHED THEN UPDATE SET
o_totalprice = target.o_totalprice + source.computed_revenue,
o_comment = 'etl_agg_lines_' || CAST(source.line_count AS VARCHAR)
WHEN NOT MATCHED THEN INSERT VALUES (
source.l_orderkey,
1,
'O',
source.computed_revenue,
CAST('1998-01-01' AS DATE),
'1-URGENT',
'Clerk#000000001',
0,
'etl_new'
)

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 WritePrimitives
bench = WritePrimitives(scale_factor=0.01) # your scale factor
print(bench.get_queries()['merge_etl_aggregation_pattern'])

Source

Query text: benchbox/core/write_primitives/operations.py