kosiew commented on issue #20164:
URL: https://github.com/apache/datafusion/issues/20164#issuecomment-4028351390

   #20814 adds these changes:
   
   Key changes include:
   
   1. **Field-aware CastExpr**
   
      * Replace the `cast_type: DataType` field with `target_field: FieldRef`.
      * Add `new_with_target_field` constructor to explicitly construct 
field-aware casts.
      * Keep the existing `new(expr, DataType)` constructor as a compatibility 
shim that creates a canonical field.
   
   2. **Return-field and nullability behavior**
   
      * `return_field` now returns the full `target_field`, preserving name, 
nullability, and metadata.
      * `nullable()` now derives its result from the resolved target field 
rather than the input expression.
      * Add compatibility logic for legacy type-only casts to preserve previous 
behavior.
   
   3. **Struct cast validation improvements**
   
      * Struct-to-struct casting now validates compatibility using field 
information before execution.
      * Planning-time validation prevents unsupported casts from reaching 
execution.
   
   4. **Shared cast property logic**
   
      * Introduce shared helper functions (`cast_expr_properties`, 
`is_order_preserving_cast_family`) for determining ordering preservation.
      * Reuse this logic in both `CastExpr` and `CastColumnExpr` to avoid 
duplicated implementations.
   
   5. **Schema rewriter improvements**
   
      * Refactor physical column resolution into `resolve_physical_column`.
      * Simplify cast insertion logic when logical and physical fields differ.
      * Pass explicit physical and logical fields to cast creation for improved 
correctness.
   
   6. **Ordering equivalence simplification**
   
      * Introduce `substitute_cast_like_ordering` helper to unify handling of 
`CastExpr` and `CastColumnExpr` in ordering equivalence analysis.


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