xiedeyantu opened a new pull request, #22315: URL: https://github.com/apache/datafusion/pull/22315
## Which issue does this PR close? - Closes #22211. ## Rationale for this change `date_bin` could panic during planning or constant evaluation when scaling a non-nanosecond source timestamp to nanoseconds overflowed. This change makes that path return a regular error instead of panicking. ## What changes are included in this PR? - Added checked overflow handling for source timestamp scaling in `date_bin`. - Return an error for out-of-range source timestamp conversion instead of panicking. - Preserved existing `NULL` behavior for unrelated out-of-range `date_bin` cases. - Added Rust unit test and sqllogictest coverage for the overflow case. ## Are these changes tested? Yes. Verified with: - `cargo test -p datafusion-functions test_date_bin --lib` - `cargo test -p datafusion-sqllogictest --test sqllogictests date_bin_errors` ## Are there any user-facing changes? Yes. Queries that previously could panic now return a normal error: `Execution error: DATE_BIN source timestamp ... cannot be represented in nanoseconds` -- 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]
