Xuanwo opened a new pull request, #27536:
URL: https://github.com/apache/datafusion/pull/27536

   ## Which issue does this PR close?
   
   Related to #21982. This is the lower layer of the constructor metadata work 
in #27502; it fixes shared Struct coercion independently of constructor field 
propagation.
   
   ## Rationale for this change
   
   Struct arguments can be assigned different child nullability or metadata 
even when a function needs one common type. For example, COALESCE with a 
non-nullable child in one argument and a nullable child in another can fail 
with `Cannot cast nullable struct field 'v' to non-nullable field`.
   
   ## What changes are included in this PR?
   
   Use one Struct reconciliation path behind the existing coercion entry 
points. It preserves existing field-order choices, merges child nullability and 
metadata by field name, ignores untyped NULL contributors, and recurses into 
directly nested Structs. Changed child types lose their extension annotations 
while retaining ordinary metadata; conflicting surviving extension names 
produce a planning error.
   
   Route the existing array coercion adapter through that result so it cannot 
swallow a metadata error and retry storage-only inference. Keep its 
function-specific error for ordinary unification failures and its public 
signature. A small workspace-internal helper shares the two-key 
extension-erasure rule.
   
   ## What is the testing strategy for this PR?
   
   Public coercion tests cover metadata, promotion, NULL arguments, field 
ordering, nested ordering, and ambiguous comma-containing names. The array 
adapter regression checks conflict propagation and its ordinary error contract. 
A SQL regression verifies schema, values, and NULL validity through COALESCE's 
normal simplification and a volatile expression that retains native execution.
   
   Formatting, focused metadata/coercion/nested-function/SELECT tests, and 
affected-crate all-target/all-feature clippy passed on this lower layer alone. 
Its extended workspace suite is still running. The combined stack has already 
passed the complete extended suite; see #27502 for those results.
   
   ## Are there any user-facing changes?
   
   Struct arguments resolve to one compatible type, including child nullability 
and metadata. COALESCE accepts the nullable-child case above. Conflicting 
surviving child extension names fail during planning instead of being silently 
discarded by the array coercion fallback.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to