edubraqd opened a new pull request, #24893: URL: https://github.com/apache/datafusion/pull/24893
## Which issue does this PR close? - Closes #24892. ## Rationale for this change `ScalarValue::Date64` formatting unwraps `chrono::Duration::try_milliseconds`, which is `None` for `i64::MIN`. Printing such a literal, for example `EXPLAIN SELECT arrow_cast(-9223372036854775808, 'Date64')`, panics instead of producing a plan. ## What changes are included in this PR? Chain `try_milliseconds` and `checked_add_signed` with `and_then`, so a value that `chrono::Duration` cannot hold is treated the same as a date that is out of range: it formats as an empty string, which is what the existing out-of-range handling (added for apache/arrow-rs#7728) already does. ## Are these changes tested? Yes. `test_display_date64_large_values` now also covers `i64::MIN` (which used to panic) and `i64::MAX`. ## Are there any user-facing changes? No panic when a `Date64` literal of `i64::MIN` is displayed. -- 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]
