executor: add stream window execution helpers#68113
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughAdds a StreamWindow wrapper and PartitionTopN window executor, splits PipelinedWindowExec initialization into Open/OpenSelf, introduces vecgroupchecker execution reset, builder helpers, BUILD/test updates, and executor runbook notes. ChangesPartition Top‑N + Stream Window Executor
Sequence Diagram(s)sequenceDiagram
participant Exec as PartitionTopNWindowExec
participant Child as Child Executor
participant Grouper as VecGroupChecker
participant Output as Output Chunk
Exec->>Exec: Open() / OpenSelf() (reset execution state)
loop produce output
Exec->>Child: Next(req) to fetch child chunk
Child-->>Exec: return chunk
Exec->>Grouper: SplitIntoGroups(chunk, partitionBy)
Grouper-->>Exec: group boundaries
loop per-row in current group
Exec->>Exec: increment groupRank
alt groupRank <= limitCount
Exec->>Output: Append row + write row_number into resultColIdx
else
Exec->>Exec: skip row (limit reached)
end
alt output chunk full
Exec->>Output: return chunk to caller
end
end
alt last partition spans chunk
Exec->>Exec: resume groupRank on next child chunk
else
Exec->>Exec: reset groupRank for new partition
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #68113 +/- ##
================================================
- Coverage 77.7288% 77.0336% -0.6953%
================================================
Files 1990 1973 -17
Lines 551970 552769 +799
================================================
- Hits 429040 425818 -3222
- Misses 122010 126948 +4938
+ Partials 920 3 -917
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
1 similar comment
|
/retest |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/executor/windows/partition_topn_window.go`:
- Around line 58-67: OpenSelf currently resets executor fields but leaves
e.groupChecker state intact, which can carry stale
VecGroupChecker.lastGroupKeyOfPrevChk into the next execution and break
partition detection in SplitIntoGroups causing wrong groupRank values; call
e.groupChecker.Reset() (or explicitly clear lastGroupKeyOfPrevChk on
e.groupChecker) inside PartitionTopNWindowExec.OpenSelf so the group checker is
cleared when the executor is re-opened.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 096ba8ba-8475-41f0-84b0-a935b79f8a6c
📒 Files selected for processing (1)
pkg/executor/windows/partition_topn_window.go
|
/retest |
1 similar comment
|
/retest |
d19bfff to
49484b5
Compare
|
/retest |
What problem does this PR solve?
Issue Number: ref #67989
Problem Summary:
This PR splits the executor-side stream-window building blocks out of the demo PR #67696 so they can be reviewed independently from planner enumeration and plan golden changes.
What changed and how does it work?
StreamWindowExecas a thin wrapper over the existing pipelined window executor.PipelinedWindowExec.OpenSelf()so builder paths that already opened children can initialize only the window executor state.PartitionTopNWindowExec, an executor-side helper forrow_number() <= Kstream-window pruning that emits at mostKrows per partition and materializes therow_numbercolumn.This PR intentionally does not add planner admission rules, physical stream-window enumeration, or plan goldens. Those should be reviewed in a follow-up PR.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit
New Features
Fixes / Reliability
Documentation
Tests