Skip to content

Write Primitives merge_deduplication_window_function

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
o_orderkey,
o_custkey,
o_orderstatus,
o_totalprice,
o_orderdate,
o_orderpriority,
o_clerk,
o_shippriority,
o_comment,
ROW_NUMBER() OVER (PARTITION BY o_orderkey ORDER BY o_orderdate DESC, o_totalprice DESC) AS rn
FROM orders
WHERE
o_orderkey BETWEEN 1 AND 500
) AS source
ON target.o_orderkey = source.o_orderkey
WHEN MATCHED AND source.rn = 1 THEN UPDATE SET
o_totalprice = source.o_totalprice,
o_comment = 'dedup_update'
WHEN NOT MATCHED AND source.rn = 1 THEN INSERT VALUES (
source.o_orderkey,
source.o_custkey,
source.o_orderstatus,
source.o_totalprice,
source.o_orderdate,
source.o_orderpriority,
source.o_clerk,
source.o_shippriority,
'dedup_insert'
)

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_deduplication_window_function'])

Source

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