Extract name mapping from table properties#2519
Open
prakharjain09 wants to merge 4 commits into
Open
Conversation
Parse the schema.name-mapping.default table property once during TableScanBuilder::build and thread the resulting Arc<NameMapping> through PlanContext -> ManifestFileContext -> ManifestEntryContext so it lands on FileScanTask instead of always being None. This unblocks readers that rely on name mapping to resolve field IDs for Parquet files lacking field IDs (or with conflicting IDs). Malformed JSON in the property surfaces as ErrorKind::DataInvalid rather than silently dropping the mapping.
Adds three tests around the new schema.name-mapping.default plumbing: - absent property leaves plan_context.name_mapping as None - well-formed JSON parses into NameMapping fields on PlanContext - malformed JSON surfaces as ErrorKind::DataInvalid from build()
f471b08 to
964d427
Compare
Without .runtime(test_runtime()), TableBuilder::build() fails with "Runtime must be provided with TableBuilder.runtime()", matching the pattern already used by TableTestFixture::new() and friends.
Merge the new use crate::ErrorKind with use crate::TableIdent into a
single use crate::{ErrorKind, TableIdent} so cargo fmt --check passes.
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?
Closes #2518
What changes are included in this PR?
Parses the
schema.name-mapping.defaulttable property once duringTableScanBuilder::buildand threads the resultingArc<NameMapping>through
PlanContext→ManifestFileContext→ManifestEntryContextso itlands on
FileScanTaskinstead of always beingNone.This unblocks readers that rely on the name mapping to resolve field IDs for Parquet files lacking
field IDs (or with conflicting IDs). Malformed JSON in the property surfaces
as
ErrorKind::DataInvalidfrombuild()rather than being silentlydropped.
Removes the corresponding TODO in
crates/iceberg/src/scan/context.rs.Are these changes tested?
Three new unit tests in
scan::tests:test_table_scan_without_name_mapping_property— absent property leavesplan_context.name_mappingasNone.test_table_scan_with_name_mapping_property— valid JSON parses into theexpected
NameMappingfields onPlanContext.test_table_scan_with_malformed_name_mapping_property— invalid JSONreturns
ErrorKind::DataInvalidfrombuild().All
scan::tests (37) pass.