Repository navigation
feat(parquet): apply name mapping to files without field IDs - #1044
Open
fairytale0828 wants to merge 1 commit into
Open
fairytale0828 wants to merge 1 commit into
fairytale0828 wants to merge 1 commit into
Conversation
fairytale0828
force-pushed
the
feat/parquet-name-mapping
branch
from
October 20, 2026 02:15
814bbf4 to
c794884
Compare
shangxinli
reviewed
Oct 20, 2026
|
|
||
| if (!HasFieldIds(metadata->schema()->schema_root())) { | ||
| if (name_mapping == nullptr) { | ||
| return InvalidSchema( |
Contributor
There was a problem hiding this comment.
Java does not error here - ReadConf.java:85-88 falls back to addFallbackIds and assigns positional ids, so this file still reads there. Not a regression, but is closing that gap out of scope?
This branch has not been deployed
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
Parquet files without field IDs (for example, files added by table migration) currently fail with
NotImplementedinBuildProjection. This PR resolves the TODO by applying the name mapping fromReaderOptions::name_mapping, which the Avro reader already supports.ApplyNameMappingwalks theSchemaManifestand addsPARQUET:field_idmetadata to each field found in the mapping. The existing projection then runs unchanged.element, and map entries usekeyandvalue, regardless of the physical names in the file. Bothlistandlarge_listare handled.InvalidSchema, consistent with Avro.Known limitations, not changed in this PR:
NameMappingbuilds its lookup indexes lazily on first use, so concurrent readers sharing one mapping can race on that first lookup. This already affects Avro and can be fixed separately..cannot be told apart from nested paths, becauseNameMapping::Findjoins path segments with..Test Plan
ParquetNameMappingTestinparquet_schema_test.cc: assigning IDs by column name, matching an alias, nested struct/list/map fields with non-standard physical names (item,key_value), and unmapped fields or fields mapped without an ID.ParquetReaderTestinparquet_test.cc:ReadWithoutFieldIdsOrNameMapping: returnsInvalidSchema.ReadWithNameMapping: alias, column reordering, type promotion, and a missing optional column.ReadWithFieldIdsAndNameMapping: file field IDs win over a conflicting mapping.ReadNestedFieldsWithNameMapping: end-to-end read of struct,list<struct>, andmap<string, struct>, including null and empty values, with bothlistandlarge_list.pre-commit runpasses on the changed files.ctest -R parquet_test: 140 passed, 1 skipped.