Skip to content

Explicitly declare spill codec dependency in physical-plan - #21917

Merged
kosiew merged 8 commits into
apache:mainfrom
kosiew:codecissue-21914
May 5, 2026
Merged

Explicitly declare spill codec dependency in physical-plan#21917
kosiew merged 8 commits into
apache:mainfrom
kosiew:codecissue-21914

Conversation

@kosiew

@kosiewkosiew commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?


Rationale for this change

The spill subsystem implicitly relied on workspace-level Cargo feature unification for codec support (e.g., arrow-ipc/zstd). This created a fragile setup where changes in unrelated dependencies or feature flags could silently break spill compression.

This PR establishes an explicit, crate-local contract for codec availability, improving correctness, maintainability, and visibility of dependencies.


What changes are included in this PR?

  • Add an explicit arrow-ipc dependency with lz4 and zstd features in datafusion-physical-plan to ensure required codecs are always available.

  • Document the codec contract directly in IPCStreamWriter::new, clarifying expectations and failure modes.

  • Update compression handling:

    • Convert SpillCompression into Option<CompressionType> before passing to try_with_compression.
  • Rename parameter compression_typespill_compression for clarity.

  • Add arrow-ipc as a dependency in the workspace lockfile.

  • Minor cleanup:

    • Adjust cargo-machete ignored field to array format.
    • Improve comments around serde_json usage.

Are these changes tested?

No new tests are included in this PR.

The changes rely on existing spill-related tests. No modifications to tests were made in this diff.


Are there any user-facing changes?

No direct user-facing changes.

This PR improves internal reliability and makes spill compression behavior more robust against dependency or feature configuration changes.


LLM-generated code disclosure

This PR includes LLM-generated code and comments. All LLM-generated content has been manually reviewed and tested.

…ec contract
- Cleaned up alphabetical ordering in Cargo.toml.
- Added comments to clarify feature-only dependencies related to IPCStreamWriter in spill/mod.rs.
- Documented codec contract requirement in IPCStreamWriter::new for better understanding of feature dependencies.
@github-actionsgithub-actionsBot added the physical-plan Changes to the physical-plan crate label Apr 29, 2026
- Changed `ignored = "serde_json"` to `ignored = ["serde_json"]` to comply with TOML array requirements.
- Fixed additional TOML parse errors.
- Added `arrow-ipc` to the `cargo-machete` ignore list with a comment on its necessity for spill compression codec support.
@github-actionsgithub-actionsBot added the sqllogictest SQL Logic Tests (.slt) label Apr 29, 2026
kosiew added a commit to kosiew/datafusion that referenced this pull request Apr 29, 2026
- Clarified spill codec comments in Cargo.toml:50 and Cargo.toml:99 to explain that arrow-ipc is consumed only via the arrow::ipc re-export, addressing potential unused flags from cargo-machete.
- Revised writer doc comment in mod.rs:295 to specify "build-visible during Cargo feature resolution" instead of "compiler-visible."
- Replaced bare commit hash reference with PR apache#21917 for clarity.
- Added brief notes to the opportunistic serde_json cargo-machete cleanup in Cargo.toml:85 and Cargo.toml:97 to indicate they are unrelated to the spill contract.
kosiew added a commit to kosiew/datafusion that referenced this pull request Apr 29, 2026
- Clarified spill codec comments in Cargo.toml:50 and Cargo.toml:99 to explain that arrow-ipc is consumed only via the arrow::ipc re-export, addressing potential unused flags from cargo-machete.
- Revised writer doc comment in mod.rs:295 to specify "build-visible during Cargo feature resolution" instead of "compiler-visible."
- Replaced bare commit hash reference with PR apache#21917 for clarity.
- Added brief notes to the opportunistic serde_json cargo-machete cleanup in Cargo.toml:85 and Cargo.toml:97 to indicate they are unrelated to the spill contract.
@github-actionsgithub-actionsBot added the development-process Related to development process of DataFusion label Apr 29, 2026
@kosiewkosiew changed the title Explicitly declare spill codec dependency on arrow-ipc (lz4, zstd) and document contractExplicitly declare spill codec dependency and move semver PR comment to follow-up workflowApr 29, 2026
@kosiew
kosiew marked this pull request as ready for review April 29, 2026 13:06
@alamb

Copy link
Copy Markdown
Contributor

Can we please split the breaking_change refactor from the codec depedendcy work? They seem separtae and having two PRs would be easier to review

@kosiew
kosiew marked this pull request as draft April 30, 2026 04:54
@github-actionsgithub-actionsBot removed the development-process Related to development process of DataFusion label Apr 30, 2026
@kosiew

Copy link
Copy Markdown
ContributorAuthor

split the breaking_change refactor into #21951

@rluvaton

Copy link
Copy Markdown
Member

merged with main since the breaking change detector is now fixed

@kosiew
kosiew marked this pull request as ready for review April 30, 2026 10:26
@kosiew
kosiew requested a review from alambApril 30, 2026 10:26
@rluvaton

Copy link
Copy Markdown
Member

can you update the title as well?

@kosiewkosiew changed the title Explicitly declare spill codec dependency and move semver PR comment to follow-up workflowExplicitly declare spill codec dependencyApr 30, 2026
@kosiew

Copy link
Copy Markdown
ContributorAuthor

@rluvaton
Thanks for catching this.
Updated the PR title.

@alambalamb 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.

Thanks @kosiew -- this is looking very close

@@ -0,0 +1,29 @@
{

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.

this change seems unrelated 🤔

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'll remove this.

Comment threaddatafusion/physical-plan/src/spill/mod.rs
Comment threaddatafusion/physical-plan/Cargo.toml Outdated

# `arrow-ipc` is used only through the `arrow::ipc` re-export, so cargo-machete
# reports it as unused even though this crate relies on its codec features.
[package.metadata.cargo-machete]

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.

See above for a suggestion on how to simplify his

@alambalamb changed the title Explicitly declare spill codec dependencyExplicitly declare spill codec dependency in physical-planMay 3, 2026
kosiew added 5 commits May 4, 2026 16:28
- Clarified spill codec comments in Cargo.toml:50 and Cargo.toml:99 to explain that arrow-ipc is consumed only via the arrow::ipc re-export, addressing potential unused flags from cargo-machete.
- Revised writer doc comment in mod.rs:295 to specify "build-visible during Cargo feature resolution" instead of "compiler-visible."
- Replaced bare commit hash reference with PR apache#21917 for clarity.
- Added brief notes to the opportunistic serde_json cargo-machete cleanup in Cargo.toml:85 and Cargo.toml:97 to indicate they are unrelated to the spill contract.
@kosiew
kosiewforce-pushed the codecissue-21914 branch from daa42cd to bc3535fCompareMay 4, 2026 08:29
@kosiew
kosiew requested a review from alambMay 4, 2026 09:51

@alambalamb 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.

Thanks for bearing with me on this one @kosiew -- looks great to me

@kosiew

Copy link
Copy Markdown
ContributorAuthor

@alamb
Thanks for the review and feedback

@kosiew
kosiew added this pull request to the merge queueMay 5, 2026
Merged via the queue into apache:main with commit c134a84May 5, 2026
41 checks passed
@kosiew
kosiew deleted the codecissue-21914 branch May 5, 2026 02:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-planChanges to the physical-plan cratesqllogictestSQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make spill codec availability an explicit contract of the spill stack

3 participants

@kosiew@alamb@rluvaton