Skip to content

fix: respect batch size in bounded window aggregation - #26970

Closed
xiaobai0529 wants to merge 1 commit into
apache:mainfrom
xiaobai0529:fix/bounded-window-batch-size
Closed

xiaobai0529 wants to merge 1 commit into
apache:mainfrom
xiaobai0529:fix/bounded-window-batch-size

Conversation

@xiaobai0529

Copy link
Copy Markdown

Which issue does this PR close?

Closes #26959

Rationale for this change

Window queries that need lookahead can emit batches larger than the configured batch size when buffered rows become ready together. For example, with batch size 2, a ROWS ... 6 FOLLOWING query can emit batches of 1, 2, and 7 rows.

What changes are included in this PR?

Split computed output into zero-copy slices bounded by the configured batch size. Drain pending slices before reading more input, including after the input ends, preserving row order and window state.

What is the testing strategy for this PR?

  • Added tests for lookahead at end of input, output values and batch sizes, and draining pending output before reading more input, including output metrics. The lookahead regression failed on the unmodified baseline with batch sizes [1, 2, 7].
  • Ran the bounded window tests (13 passed), cargo fmt --all, and cargo clippy --all-targets --all-features -- -D warnings.
  • Ran the extended workspace test command required by AGENTS.md successfully. The isolated Linux test checkout used the pinned test-data submodules and LF line endings for the TPC-H q15 SQL file.
  • Ran the bounded-window linear dense count benchmark with 100 partitions using Criterion quick sampling: baseline 57.7–59.1 ms; modified 59.7–60.0 ms. This is one quick-sampled scenario, not a general performance claim.

Are there any user-facing changes?

Output from BoundedWindowAggExec respects the configured batch size. Query rows and their order are preserved; batch boundaries may change.

AI assistance

Codex (GPT-6) assisted with implementation, testing, and this description. The contributor reviewed the change and confirmed understanding of the design.

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Oct 31, 2026
@2010YOUY01

Copy link
Copy Markdown
Member

Superseded by #26974

Thank you for the contribution, and sorry we haven't reviewed your work. One challenge we're facing is that we can't easily tell from a PR alone whether it's largely AI-generated or carefully engineered.

We still welcome new contributors! I suggest to start by reviewing PRs or helping with smaller maintenance tasks in actively developed areas to build trust with existing maintainers, then coordinate with them before working on features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BoundedWindowAggExec can emit batches larger than batch_size

2 participants