Repository navigation
fix(parquet/pqarrow): prefer stored schema extension type on read - #1051
Merged
zeroshade merged 3 commits intoAug 5, 2026
Merged
Conversation
When a Parquet file carries both a stored ARROW:schema and a logical type that a registered extension recovers on read, the inferred field can already be an extension type rather than the bare storage type. In that case applyOriginalStorageMetadata rejected the file with a spurious storage-type mismatch even though the stored schema is authoritative. Prefer the origin extension when the inferred type is an extension of the same name, so reads honor the stored schema's parameters.
zeroshade
approved these changes
Aug 5, 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.
Rationale
Since #1028, the reader reconstructs an extension type directly from a Parquet logical type (via
ArrowTypeFromParquet), so the inferred field can now be an extension type rather than the bare storage type it used to be.applyOriginalStorageMetadatastill assumed the inferred type was plain storage when reconciling against the storedARROW:schema, so when the two extension instances differed it fell into the "wrap the storage type" branch, found an extension instead of the storage type, and raised a spurious storage-type mismatch.This surfaces with GeoArrow WKB: an
authority_codeCRS (e.g. the defaultOGC:CRS84) round-trips through Parquet's opaque CRS string and comes back taggedsrid, so the inferredWKBTypediffers from the one stored inARROW:schema. Reading any such file — even though the stored schema is authoritative and correct — failed with:Fix
In
applyOriginalStorageMetadata's extension branch, when the inferred type is already an extension of the same name as the origin's, adopt the origin's (authoritative) parameters instead of requiring the inferred type to be the bare storage type.Testing
Existing
pqarrowextension/geospatial/store-schema tests pass; verified end-to-end that a GeoArrow WKB file with default-CRS (authority_code) columns and a storedARROW:schemanow reads back correctly.