Skip to content

Commit

Permalink
Issue duckdb#12600: Streaming Positive LAG
Browse files Browse the repository at this point in the history
Use buffering to support streaming computation of constant positive LAGs
and negative LEADs that are at most one vector away.
This doesn't fix the "look ahead" problem, but the benchmark shows
it is about 5x faster than the non-streaming version.
  • Loading branch information
Richard Wesley committed Jun 19, 2024
1 parent 2b65e61 commit 0cf635c
Show file tree
Hide file tree
Showing 6 changed files with 424 additions and 132 deletions.
27 changes: 27 additions & 0 deletions benchmark/micro/window/streaming_lag.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# name: benchmark/micro/window/streaming_lag.benchmark
# description: Verify performance of streaming LAG
# group: [window]

load
SELECT SETSEED(0.8675309);
CREATE OR REPLACE TABLE df AS
SELECT
RANDOM() AS a,
RANDOM() AS b,
RANDOM() AS c,
FROM range(10_000_000);

run
SELECT sum(a_1 + a_2 + b_1 + b_2)
FROM (
SELECT
LAG(a, 1) OVER () AS a_1,
LAG(a, 2) OVER () AS a_2,
LAG(b, 1) OVER () AS b_1,
LAG(b, 2) OVER () AS b_2
FROM df
) t
;

result I
20000902.549240764
Loading

0 comments on commit 0cf635c

Please sign in to comment.