Repository navigation
Conversation
The Avro specification makes null the default codec. PyIceberg fell back to the Iceberg table property default (gzip), which is not an Avro codec name, so it raised 'Unsupported codec: gzip' on manifests written without the entry (iceberg-rust writes them so).
AP24110011695
approved these changes
Nov 6, 2026
AP24110011695
left a comment
There was a problem hiding this comment.
Verified locally (Windows, Python 3.12):
test_missing_codec_is_nulland the existing codec tests pass on this branch.- On the pre-change code the same call raises
ValueError: Unsupported codec: gzip— the fail-first claim reproduces exactly. - Checked all three
WRITE_AVRO_COMPRESSION_DEFAULTfallback sites: the reader (AvroFileHeader.compression_codec) is the only one reading file metadata, where the Avro spec'snulldefault is the correct semantic; the two writer sites (_write_header,AvroOutputFile.compression_codec) read write-task configuration, where the Iceberg property default is intentional — leaving them unchanged is right. - Blast radius is one line: files that have
avro.codectake the same path as before.
Spec-based, minimal, tested, and unblocks iceberg-rust-written manifests (references apache/iceberg-rust#3640). Nice catch.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4295
Rationale for this change
AvroFileHeader.compression_codec()read a missingavro.codecentry asTableProperties.WRITE_AVRO_COMPRESSION_DEFAULT("gzip"), an Iceberg property value rather than an Avro codec name, and raisedUnsupported codec: gzip. The Avro specification makesnullthe default, so a file without the entry is uncompressed. iceberg-rust writes manifests that way (apache/iceberg-rust#3640), so PyIceberg could not scan a table with a snapshot committed from iceberg-rust.The writer side (
AvroOutputFile._write_header) is unchanged: it still writes the entry, mapping the Iceberg name to the Avro one.Are these changes tested?
test_missing_codec_is_nullintests/avro/test_file.py(it fails on main with the error above).tests/avro/test_file.pyandtests/avro/test_reader.pypass (41); ruff is clean. End to end: a table on a REST catalog whose second snapshot was committed from iceberg-rust (manifest without the entry). PyIceberg 0.12 as released raisesUnsupported codec: gziponscan(); with this one-line change applied to the installed 0.12 it reads all 3,000 rows.Are there any user-facing changes?
Avro files without
avro.codecare now read instead of refused.AI disclosure: drafted with Claude Code (Claude Opus 5.5) at my direction; I ran the tests and ruff.