fix: Batch size limit in re-spill compounds by EmilyMatt · Pull Request #23286 · apache/datafusion · GitHub
Skip to content

fix: Batch size limit in re-spill compounds#23286

Open
EmilyMatt wants to merge 3 commits into
apache:mainfrom
EmilyMatt:sort-respill-perf
Open

fix: Batch size limit in re-spill compounds#23286
EmilyMatt wants to merge 3 commits into
apache:mainfrom
EmilyMatt:sort-respill-perf

Conversation

@EmilyMatt

@EmilyMatt EmilyMatt commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This fixes an issue in my previous design for the re-spill in sort - whenever we half a stream, we half self.batch_size, even if its not the same stream being halved, so for each re-spill we get a smaller and smaller output batch, which really hurts performance in the merge.
We can avoid it by just keeping the batch_size_limit in the spilled file struct. then we just use the lowest limit whenever we merge N streams, making it dynamic and much more robust.

Has tests.

Breaks API, by adding a new public field to SortedSpillFile

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants