Repository navigation
feat(engine): window functions on the streaming engine (#547 PR 3) - #647
Merged
Merged
Conversation
Window holds each input row's passed-on cells and its named variables' values, then computes every window with aggregate::windows, the code the executor now calls too, and returns the rows in input order. The planner routes window queries and windows over an aggregate's groups; with windows, :with does not group, as on the executor. Envelope gains a `window` shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
…nd order key, a pseudo-attribute (#547) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
) Window turns every row's ids into values in its first pull; the rows it returns later read the same ids again. Clearing the cache after each pull made each lookup twice. Peak memory is unchanged: the first pull already holds every lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
…ombined) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 5 of #473 (#547), third and last PR: plan steps 13–16 of
docs/superpowers/plans/2026-10-20-547-aggregate-window.md. #547 will be closed by hand after merge.What
aggregate::windows— the executor's per-partition window core (partition byValue'sOrd, sort by:order-byundervalue_order, then named variables, then position; SQL peers;rank/row-number) moved intoaggregate.rsover&[Vec<Value>].apply_window_functionsnow calls it, so both engines run the same code.engine/window.rs—Windowholds each input row's passed-on cells and its named variables' values, computes every window at end of input, returns rows in input order.plan.rs) —Step::Window { find, named, keep }after the:wheresteps, or afterStep::Aggregatefor mixed queries (named variables read from the aggregate's group columns, PRS-082 guarantees they are there). With windows,:withdoes not group, as on the executor.Windowkeeps its DICT lookups until it ends (see Measurements).windowshape; CLAUDE.md, CHANGELOG, BENCHMARKS, counts.No answer changes (
test-oracle), so no docs-site PR.Tests
windows_match_executor: every built-in window over each value kind, partitions by keywords/refs/booleans/floats/long strings,:desc, mixed aggregate + window,:with, repeated:findvariable,or-bound order key, pseudo-attribute; six temporal variants; across checkpoint and reopen.window_returns_every_row_in_input_order(3,000 rows over several batches, counters, whole-partition sums),window_routing.cargo test: 1,623 (1,613 passing, 10 ignored).cargo test --features test-oracle: all pass.Measurements (#394 envelope, A/B in parallel on two sockets, nodes swapped between rounds)
windowv3→ PREvery other shape unchanged (within noise; their paths are untouched). The first measurement was 17% slower at 100K (48.2 ms):
Windowturns each row's ids into values in its first pull, and the projection looked them up again because the DICT cache is dropped after each pull. Fixed in 06af6d2: a stream that ends in aWindowkeeps its DICT lookups until it ends (peak memory unchanged: the first pull already holds them);window_stream_keeps_dict_cache_until_it_endsfails without it.Binary size
+6 KiB (local rustc 1.94:
v31,240 → 1,246 KiB; CI's stable measured ~1,205 KiB forv3, gate 1,230 KiB until #551).Review
Codex (read-only) over the diff: no findings; its coverage note led to the extra shapes in 1cc8ff8.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz