Manifest: Use int for equality_ids in manifest schema per Iceberg spec (#3840) - #3842
Open
hedger9487 wants to merge 1 commit into
Open
Manifest: Use int for equality_ids in manifest schema per Iceberg spec (#3840)#3842hedger9487 wants to merge 1 commit into
hedger9487 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates manifest equality_ids to use Iceberg’s specified int type while supporting legacy manifests.
Changes:
- Corrects manifest schemas for format versions 1–3.
- Adds legacy long-to-int decoding support.
- Adds serialization and compatibility tests.
- Resolver compatibility must be scoped to
equality_ids; the current broad handling can accept out-of-range values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Summary |
|---|---|
tests/utils/test_manifest.py |
Tests current serialization and legacy manifest reading. |
pyiceberg/manifest.py |
Uses IntegerType for equality_ids. |
pyiceberg/avro/resolver.py |
Adds long-to-int compatibility, but the implementation is overly broad. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+464
to
+467
| if isinstance(primitive, LongType) and isinstance(expected_primitive, IntegerType): | ||
| pass | ||
| else: | ||
| promote(primitive, expected_primitive) |
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.
Description
Fixes #3840.
In the Iceberg specification (
format/spec.md), Java reference implementation, andiceberg-cpp,equality_ids(field 135) is defined as a list ofint(list<136: int>). However,pyicebergpreviously declared field 136 withLongType(), causing manifests written by PyIceberg to be rejected by other spec-conformant readers (e.g.iceberg-cpp).This PR:
DATA_FILE_TYPEinpyiceberg/manifest.pyfor table format versions 1, 2, and 3 to useIntegerType()for element id 136 inequality_ids.ReadSchemaResolver.primitiveinpyiceberg/avro/resolver.pyto allow promotingLongTypein file schema toIntegerTypein read schema for Avro decoding (since both are encoded as zigzag varints on the wire), ensuring backward compatibility when reading historical manifests written by earlier versions of PyIceberg.equality_idswith element typeint, and that historical manifests with element typelongcan be read seamlessly.Testing
tests/utils/test_manifest.py.