Skip to content

fix(spec): write manifests and manifest lists with the deflate codec - #3643

Merged
kevinjqliu merged 2 commits into
apache:mainfrom
jatorre:avro-manifest-deflate
Nov 10, 2026
Merged

kevinjqliu merged 2 commits into
apache:mainfrom
jatorre:avro-manifest-deflate

Conversation

@jatorre

@jatorre jatorre commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

What changes are included in this PR?

ManifestWriter, ManifestListWriter, and write_data_files_to_avro use a shared internal Avro writer factory with Codec::Deflate instead of Writer::new (no avro.codec entry, uncompressed). PyIceberg 0.12 reads a missing entry as gzip and refuses the file (apache/iceberg-python#4295), so tables with an iceberg-rust snapshot could not be scanned from PyIceberg. Deflate is also what other writers produce for manifests, and the files get smaller.

Are these changes tested?

Existing manifest, manifest-list, and data-file round-trip tests also check the parsed header's avro.codec is deflate. cargo test -p iceberg --lib spec::manifest passes (73); cargo clippy -p iceberg --lib --tests -- -D warnings and cargo fmt --all -- --check pass. End to end, PyIceberg 0.12 scanned a v3 table whose second snapshot came from iceberg-rust with this change (and failed without it).

AI Disclosure

Drafted with Claude Code (Claude Opus 5.5) at my direction; I ran the tests, clippy, rustfmt, ruff, and the end-to-end check described above. Follow-up factory and regression-test changes were made with GitHub Copilot (GPT-6.1 Sol). Point for reviewers: the codec is fixed rather than read from a table property; support for write.manifest.compression-codec remains out of scope.

jatorre and others added 2 commits November 6, 2026 18:32
They were written without an avro.codec entry (uncompressed). Readers that assume a default for a
missing entry refuse them: PyIceberg 0.12 reads it as "gzip" and raises 'Unsupported codec: gzip',
so a table with one snapshot from iceberg-rust cannot be scanned from PyIceberg. Deflate is what
other writers use for manifests, and it makes them smaller.
Use a shared internal factory for Avro container writers and verify codec metadata in existing round-trip tests.

Co-authored-by: Copilot App <[email protected]>

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

hey @jatorre great find and thank you for the fix.

i noticed that we are repeating the codec in multiple places and thought we can centralize in a helper.

I pushed up a commit (504c761) to refactor.

Please let me know what you think!

apache_avro::Writer::with_codec(
schema,
writer,
apache_avro::Codec::Deflate(Default::default()),

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.

@kevinjqliu kevinjqliu added the bug Something isn't working label Nov 9, 2026
@kevinjqliu
kevinjqliu requested review from CTTY and blackmwk November 9, 2026 23:53
@kevinjqliu

Copy link
Copy Markdown
Contributor

@CTTY @blackmwk this is an important behavior change. We are now writing Avro files with the deflate compression by default instead of uncompressed 😄

@CTTY CTTY left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

This looks related to #1851 that's threading codec from table props to avro writer. I don't think we should block the fix due to a missing feature tho

@CTTY
CTTY added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@kevinjqliu
kevinjqliu added this pull request to the merge queue Nov 10, 2026
@kevinjqliu

Copy link
Copy Markdown
Contributor

adding it back to the merge queue

Merged via the queue into apache:main with commit 14d4b5f Nov 10, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manifests are written without an avro.codec entry; PyIceberg 0.12 cannot read them

3 participants