AddFiles: regenerate name mapping, read footers once, error helper - #39836
Open
claudevdm wants to merge 6 commits into
Open
AddFiles: regenerate name mapping, read footers once, error helper#39836claudevdm wants to merge 6 commits into
claudevdm wants to merge 6 commits into
Conversation
ahmedabu98
approved these changes
Aug 22, 2026
ahmedabu98
left a comment
Contributor
There was a problem hiding this comment.
Few nits but LGTM! Thanks for writing this. Remember to trigger Iceberg ITs
Feel free to merge after addressing comments and tests pass
Contributor
|
Assigning reviewers: R: @chamikaramj for label java. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
claudevdm
force-pushed
the
iceberg-prepass-schema-v2
branch
from
August 22, 2026 21:51
f553abb to
ea1d3e2
Compare
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.
AddFiles: heal stale or malformed name mappings at commit time
Files registered by AddFiles carry no Iceberg field ids, so readers resolve every column through the
schema.name-mapping.defaulttable property. A column missing from that mapping reads as null in every registered file. Before this change the commit stage only created the mapping when the property was absent. A mapping that was present but broken was trusted as is, and a malformed one threw inside the commit stage and blocked every manifest commit for the table.Changes
Before each manifest commit,
CommitManifestFilesDoFnnow parses the stored mapping, checks that it covers the current schema, and regenerates it when it does not. Regeneration preserves custom names from the old mapping where it safely can. Logic lives in the newNameMappingUtilsclass.Cases handled
Absent mapping. Generated from the schema, same as before.
Malformed mapping. Unparseable JSON, a name used by two fields at the same level, or a duplicate field id. Treated as absent and regenerated with a warning. Previously this threw on every commit, permanently.
Stale mapping. The schema gained a column but the mapping was never updated, typically a hand written mapping from the original file import.
The custom alias
identsurvives.Stale nested mapping. The coverage check walks into structs, lists and maps using the same
element,keyandvaluepath segments Iceberg uses. A mapping that resolveseventsandevents.element.abut is missingevents.element.bis detected and regenerated. A top level only check would have passed it.Null id entry.
{"names": ["user_id"]}with no field id means the column maps to nothing and reads as null. Counted as not covered.Wrong id entry.
user_idmapped to id 3 while the schema says 7. Readers would bind the column to the wrong field. Counted as not covered.Healthy mapping with custom names. Left byte for byte untouched. No property commit happens.
Pre-rename file names. A column renamed from
old_nametonew_namekeeps the old name as an alias, so files written before the rename still resolve:[{"field-id": 1, "names": ["new_name", "old_name"]}]Name collisions during regeneration. Schema names always win. If the old mapping carried
amtas an alias ofamountbut the schema now has a realamtcolumn, the alias is dropped with a warning naming the field path. If two carried aliases collide with each other at one level, the first in schema column order wins.Dropped columns. Old entries whose id is no longer in the schema, including null id tombstones, are not carried over. Their file columns stay unmapped, which readers treat the same way.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.