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

   ## Which issue does this PR close?
   
   Closes #26528.
   
   ## Rationale for this change
   
   `TRY_CAST` fails during planning for struct casts that `CAST` already 
supports, including missing nullable fields, reordered fields, and nested 
`list<struct>` values. This change makes `TRY_CAST` accept the same supported 
struct conversions as `CAST`.
   
   ## What changes are included in this PR?
   
   - Share the struct cast planning check between `CAST` and `TRY_CAST` to keep 
their behavior consistent.
   - Remove duplicated checks in `cast_with_options` and 
`cast_with_target_field`.
   - Keep runtime behavior unchanged. Both expressions already use 
`ColumnarValue::cast_to`, which casts struct fields by name. Only planning-time 
validation changes.
   
   ## What is the testing strategy for this PR?
   
   Added regression cases in `struct.slt` covering:
   
   - Missing nullable fields
   - Field reordering with type changes
   - Extra source fields
   - Invalid values becoming `NULL`
   - Nested `list<struct>` casts
   - Struct-level `NULL` values
   - Structs with no overlapping fields still producing an error
   
   Five of the new cases fail on `main` and pass with this fix.
   
   Tests run:
   - [Insert exact test commands and results]
   
   ## Are there any user-facing changes?
   
   Yes. `TRY_CAST` now supports additional struct conversions that `CAST` 
already accepts. Values that cannot be converted are returned as `NULL` where 
supported by `TRY_CAST`, rather than rejecting the entire query during planning.
   
   There are no breaking public API changes. The shared helper is `pub(crate)`.


-- 
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