Skip to content

Coalesce single-column sort runs during spill - #23222

Closed
nathanb9 wants to merge 1 commit into
apache:mainfrom
nathanb9:sort-run-coalescing
Closed

Coalesce single-column sort runs during spill#23222
nathanb9 wants to merge 1 commit into
apache:mainfrom
nathanb9:sort-run-coalescing

Conversation

@nathanb9

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #23208.

Rationale for this change

Single-column primitive sorts can produce many small sorted runs before spilling, increasing merge fan-in and merge overhead.

What changes are included in this PR?

This enables in-memory run coalescing on the sort spill path for single primitive-column sorts, bounded by sort_in_place_threshold_bytes. Multi-column and non-primitive sorts keep the existing behavior.

Are these changes tested?

Existing focused sort tests pass:

  • test_in_mem_sort_coalesced_runs
  • test_sort_spill
  • test_sort_spill_utf8_strings

Also ran:

  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • git diff --check

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Jun 27, 2026
@nathanb9 nathanb9 closed this Jun 27, 2026
@nathanb9
nathanb9 deleted the sort-run-coalescing branch June 27, 2026 22:10
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.

perf: coalesce single-column sort runs to cut merge fan-in

1 participant