[v25.3.x] iceberg: don't reject new fields with required descendants#30591
Merged
nvartolomei merged 1 commit intoMay 22, 2026
Conversation
validate_schema_transform incorrectly rejected adding a new optional column whose nested type contains structurally-required descendants (e.g. an optional map, whose keys are always required). The walk visited every annotated field and triggered new_required_field on the nested required key/element. Stop descending into a subtree once an is_new ancestor is encountered: the substructure is part of the new type's definition, not a separate top-level addition. The same reasoning applies to required list elements and required struct subfields, though in practice only the map-key case arises today. The datalake record translator coerces all incoming schema fields to optional (see record_translator.cc), leaving map keys as the only structurally-required descendants. The list and struct cases are covered by regression tests for completeness. (cherry picked from commit 07afd25)
db363dd to
72c1433
Compare
Collaborator
Author
CI test resultstest results on build#84887
|
nvartolomei
approved these changes
May 22, 2026
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.
Backport of PR #30585
Conflict details
validate_schema_transformon v25.3.x still used thefor_each_field-with-lambda traversal; the PR replaces it with a stack-based walk that stops descending once anis_newancestor is reached. Took the incoming side verbatim (helperschunked_vectorandreverse_field_collecting_visitorare already available via the existingcompatibility_utils.hinclude), preserving the intended bug fix.