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

   ## Which issue does this PR close?
   
   Follow-up to #25227 and [its 
discussion](https://github.com/apache/datafusion/pull/25227#discussion_r3999343833).
   
   ## Rationale for this change
   
   Some lossless casts unnecessarily discard column statistics or fail to 
preserve strict ordering information.
   
   For example, UInt32 → Int64 currently requires both bounds to be exact to 
propagate statistics, even though every UInt32 value fits in Int64. Recognizing 
this conversion as globally safe preserves available statistics even when one 
bound is absent or bounds are inexact.
   
   ## What changes are included in this PR?
   
   - Recognize unsigned-to-signed widening casts: UInt8 → Int16 / Int32 / 
Int64, UInt16 → Int32 / Int64, and UInt32 → Int64.
   - Recognize Utf8 → Utf8View and Binary → LargeBinary / BinaryView.
   - Rename `check_bigger_cast` / `is_bigger_cast` to `check_lossless_cast` / 
`is_lossless_cast`, updating callers and examples.
   
   ## What is the testing strategy for this PR?
   
   - Test values, nulls, integer extrema, and strict ordering properties.
   - Test empty values, Unicode, long strings, and non-UTF8 binary values.
   - Test statistics propagation with exact, inexact, and missing bounds.
   - Verify unsafe reverse conversions remain excluded.
   
   Validation: 66 relevant unit tests passed; one existing test is ignored. 
Formatting, all-target/all-feature Clippy, and the standard `rust_lint.sh` 
suite passed.
   
   ## Are there any user-facing changes?
   
   More lossless casts retain statistics and strict ordering information, 
enabling existing optimizer rules.
   
   Public Rust API change: callers must replace `check_bigger_cast` and 
`is_bigger_cast` with `check_lossless_cast` and `is_lossless_cast`.
   


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