feat(spec): read partition and sort fields with multi-argument transforms (source-ids)#2802
Open
moomindani wants to merge 2 commits into
Open
feat(spec): read partition and sort fields with multi-argument transforms (source-ids)#2802moomindani wants to merge 2 commits into
moomindani wants to merge 2 commits into
Conversation
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.
Which issue does this PR close?
What changes are included in this PR?
The v3 spec serializes partition fields and sort fields whose transform takes multiple arguments with a
source-idslist instead of the singlesource-id. Deserializing such metadata failed withmissing field source-id, so a v3 table containing any multi-argument transform could not be read at all.This adds read tolerance, mirroring PyIceberg (apache/iceberg-python#3630):
PartitionFieldandSortFieldacceptsource-ids: a single-element list is normalized ontosource-id; a multi-element list is kept in the newsource_idsfield and the transform maps toTransform::Unknown— multi-argument transforms cannot be evaluated, and the spec requires v3 readers to read such tables ignoring them.source_idholds the first id so existing consumers keep working.source-id, multi-argument transforms write onlysource-ids, so the field round-trips.PartitionSpec::is_compatible_withalso comparessource_ids, so two multi-arg fields sharing the first id no longer compare as identical.SortField'sDisplayrenders all ids for multi-argument fields.PartitionSpec::partition_typeworks unchanged:Transform::Unknownproducesstringper the spec.Note: this adds a public
source_idsfield toPartitionFieldandSortField(will be flagged by cargo-public-api). Known limitation shared with #2790:Transform::Unknowndoes not retain the original transform name, so round-tripping writes"unknown"; name preservation stays tracked in #2789.Are these changes tested?
Yes — new unit tests in
spec/partition.rsandspec/sort.rs: multi-arg deserialization and round-trip, single-element normalization, emptysource-idsrejection, missing-transform rejection, andpartition_typeover a multi-arg field.cargo test -p iceberg --lib(1399 tests),cargo clippy -p iceberg --lib --tests, andcargo check --workspace --testspass locally.This pull request and its description were written by Claude Fable 5.