Repository navigation
[den-55] fix: keep metadata of struct children that are NULL in every input - #227
Merged
Merged
Conversation
Struct coercion merges each child's metadata from its typed contributors and ignores untyped NULL children. When a child is NULL in every input, nothing contributes, so the merged child lost all of its metadata. That happens for a single struct argument as well as for several arguments that are all NULL at the same position, for example `make_array(struct(1, NULL))` or `coalesce(NULL, s, s)` where `s` has a NULL-typed child. Merge the NULL inputs' metadata in that case, with earlier inputs taking precedence and the extension name and metadata taken together from the first input that declares one. Children with at least one typed contributor keep ignoring NULL-child metadata, as before.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## den-55 #227 +/- ##
=======================================
Coverage 81.28% 81.28%
=======================================
Files 1111 1111
Lines 390505 390523 +18
Branches 390505 390523 +18
=======================================
+ Hits 317423 317454 +31
+ Misses 54463 54450 -13
Partials 18619 18619 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Follow-up to #221. Struct coercion now drops all metadata from a struct child that is untyped NULL in every input. This happens for a single struct argument, and for several arguments that are all NULL at the same position.
Callers that rely on child-field metadata lose it for these shapes, even though the child type is unchanged.
Root cause
merge_struct_fieldsbuilds each child's metadata from its typed contributors and skips NULL-typed children. When every contributor is NULL, nothing is merged, and.with_metadatareplaces the child's metadata with an empty map.Change
coalesce(null_child, i32_ext)case checks.Testing
try_type_union_resolution_with_struct: a child that is NULL in every input keeps (and merges) its metadata, and typed-child metadata still wins over NULL children in either order.test_coalesce_struct_field_metadatacase,coalesce(NULL, null_child, null_child), covering both the native and the simplified path. It fails without the fix.cargo test -p datafusion-expr-common,-p datafusion-functions-nested --lib make_array,-p datafusion --test core_integration sql::select, sqllogictestscoalesce/struct/array, fmt, and clippy (-p datafusion-expr-common --all-features,-p datafusion --all-targets) pass.