Repository navigation
Conversation
intersect_metadata_for_union compared metadata values as raw strings, so extension metadata that differed only in whitespace or key order was dropped from the union field. Compare ARROW:extension:metadata as parsed JSON so equivalent serializations agree. Closes apache#26810.
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.
Important
Fork CI setup: For pull requests from a fork to
main, enable workflows in your fork's Actions tab before you push.See the fork CI setup guide.
Which issue does this PR close?
intersect_metadata_for_union()is too strict for extension types with JSON metadata serialization #26810.Rationale for this change
intersect_metadata_for_unionkeeps a metadata key only when every UNION branch has the same string value. Arrow stores extension-type metadata underARROW:extension:metadataas a JSON document, and different writers (or even the same writer with different formatting) can serialize the same logical metadata with different whitespace or key order. Those branches then disagree as strings, so the key is dropped and the union field loses its extension metadata even though the JSON values are equivalent.What changes are included in this PR?
ARROW:extension:metadataas parsed JSON (viaserde_json::Value) when intersecting metadata for UNION; other keys still require byte-identical strings.Ideal longer-term would be a typed equality check on the decoded extension metadata (
DFExtensionType), but there is no such API yet; JSON equality matches the repro in #26810.What is the testing strategy for this PR?
cargo test -p datafusion-expr intersect_metadata --lib(covers the existing intersection cases plusextension_metadata_json_equivalent_keptandextension_metadata_json_different_dropped).Are there any user-facing changes?
Bug fix only: UNION of columns whose
ARROW:extension:metadatadiffers only in JSON formatting now retains that metadata. No public API change.AI assistance
AI tooling helped draft the patch and tests; I reviewed the approach against #26810 and the existing string intersection logic, and ran the tests above.