Skip to content

Return coalescer errors from sort-merge joins - #27731

Open
efegokdemir wants to merge 4 commits into
apache:mainfrom
efegokdemir:efe/datafusion-sort-merge-coalescer-27728
Open

efegokdemir wants to merge 4 commits into
apache:mainfrom
efegokdemir:efe/datafusion-sort-merge-coalescer-27728

Conversation

@efegokdemir

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

A sort-merge join can panic when its output coalescer rejects a batch, instead of returning the execution error to the query.

What changes are included in this PR?

Propagate errors from all five coalescer push sites in MaterializingSortMergeJoinStream. Add a regression test for a dictionary-key overflow in filtered join output.

What is the testing strategy for this PR?

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --profile ci -p datafusion-physical-plan --lib joins::sort_merge_join::tests --locked (498 passed)

Are there any user-facing changes?

The join returns a query error instead of panicking when output batches cannot be coalesced.

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Nov 24, 2026
@comphead

comphead commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Thanks @efegokdemir checking the PR

@comphead comphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning the error is the right call here. BatchCoalescer reports a merged dictionary that outgrows its key type as an error (arrow-select pins this in its own coalescer tests), and the other joins already propagate coalescer errors with ?. After this change no coalescer call in this stream can panic.

  • The fork run for 6f83b34e3 never started ("The job was not started because your account is locked due to a billing issue"), so CI has not tested this head yet. The merge queue will, but a fork run would show problems earlier.

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.

SortMergeJoinExec panics instead of returning an error when its output coalescer rejects a batch

3 participants