Repository navigation
fix(manifest): validate struct child lengths - #1054
Merged
Merged
Conversation
nanoarrow FULL validation only requires a struct's children to be at least as long as the parent, but ParseManifestList/ParseDataFile/ ParseManifestEntry index containers sized by the parent's row count using each child's own length. A spec-legal batch with a longer child would drive those parsers past the end of the output vector. Add AssertChildrenLength and call it everywhere a struct's children feed a parent-sized container, including the partition struct case which previously skipped the children-count check entirely.
shangxinli
reviewed
Oct 26, 2026
Use ValidateStructLength at parent-sized manifest parser boundaries. The built-in Avro reader produces canonical batches, so this is defensive validation rather than a supported malformed-input path.
wgtmac
approved these changes
Oct 28, 2026
wgtmac
left a comment
Member
There was a problem hiding this comment.
I don't think this PR fixes a real issue. The manifest reader only reads Arrow arrays from our own Avro reader, so child lengths always match. If this can ever happen (i.e. users have registered their own Avro readers), it is only a defensive case. I simplified the check to ValidateStructLength. I also removed the test because it covered an unreachable case and did not test a useful production path.
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.
Summary
ValidateStructLength, which verifies every child of a struct view has the same logical length as its parent.ICEBERG_CHECKto fail closed if a non-canonical Arrow batch reaches the parser.Why
The built-in Avro manifest reader produces canonical, equal-length struct batches. This validation is defensive hardening for unexpected reader output rather than support for a new input path.
Test plan
pre-commit run --files src/iceberg/manifest/manifest_reader.cc src/iceberg/test/manifest_reader_test.cccmake --build build --target manifest_test -j2build/src/iceberg/test/manifest_test(226 passed, 18 skipped)