haohuaijin opened a new pull request, #25227: URL: https://github.com/apache/datafusion/pull/25227
### Which issue does this PR close? - closes #25221 ### Rationale for this change MIN/MAX over numeric casts of strings can return incorrect results without scanning the values. ### What changes are included in this PR? Preserve statistics for supported widening casts and integer narrowing casts with safe exact bounds. Return unknown statistics for unsupported or unsafe conversions. ### What is the testing strategy for this PR? Unit tests cover non-monotonic casts and narrowing bounds. `cast_statistics.slt` reproduces incorrect INT and BIGINT aggregates and checks the corrected results. ### Are there any user-facing changes? Correct MIN/MAX results for affected casts. Some casts no longer use statistics-based aggregate optimization. -- 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]
