Repository navigation
fix: do not panic when displaying a Date64 scalar of i64::MIN - #26139
Merged
neilconway merged 1 commit intoOct 8, 2026
Merged
Conversation
`Duration::try_milliseconds` returns `None` for `i64::MIN`, and the Date64 arm of `impl Display for ScalarValue` unwrapped it. Chain it with `checked_add_signed` so a value `Duration` cannot hold formats as an empty string, like an out-of-range date already does. Closes apache#24892 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
geographybuff
marked this pull request as ready for review
October 8, 2026 13:56
neilconway
approved these changes
Oct 8, 2026
neilconway
left a comment
Contributor
There was a problem hiding this comment.
Thanks @geographybuff !
neilconway
enabled auto-merge
October 8, 2026 15:09
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26139 +/- ##
==========================================
- Coverage 82.74% 82.74% -0.01%
==========================================
Files 1147 1147
Lines 449767 449770 +3
Branches 449767 449770 +3
==========================================
- Hits 372160 372152 -8
- Misses 54938 54946 +8
- Partials 22669 22672 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Date64scalar ofi64::MINpanics #24892.Rationale for this change
impl fmt::Display for ScalarValueunwrapschrono::Duration::try_milliseconds(v)in theDate64arm. That returnsNonefori64::MIN, whichDurationcannot represent, so printing such a literal panics, for exampleEXPLAIN SELECT arrow_cast(-9223372036854775808, 'Date64').#24893 proposed the same change and was closed as part of a batch of PRs, not on its merits. This PR redoes it on current
main.What changes are included in this PR?
try_millisecondsandchecked_add_signedare chained withand_then, so a valueDurationcannot hold falls into the existingNone => ""branch. That's how the neighbouring out-of-range case already formats (added for apache/arrow-rs#7728). One file, +7/-1.What is the testing strategy for this PR?
test_display_date64_large_valuesnow also checksi64::MINandi64::MAX:unwrap(scalar/mod.rs:5651).cargo test -p datafusion-common --libpasses 623 tests, andrustfmt --checkis clean.cargo clippy -p datafusion-common --all-targets -- -D warningsfails locally on an unused import inconfig.rs:4157. That happens on unmodifiedmaintoo, probably because I ran without theparquetfeature, so it's unrelated.Not verified: the issue's second reproduction, a
RANGEwindow frame over aDate64column containingi64::MIN. I only ran the unit test. If that path panics somewhere other than thisDisplayimpl, this PR doesn't fix it.Are there any user-facing changes?
No panic: a
Date64ofi64::MINdisplays as an empty string, like other out-of-range dates.AI disclosure: prepared with Claude Code (Claude Opus 5.5), which wrote the change and the test and ran the commands above.