You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b239d04
Browse filesBrowse the repository at this point in the historyBrowse files
## Which issue does this PR close?
- Closesapache#25129.
## Rationale for this change
`date_trunc` can panic in debug builds or return an incorrect timestamp
in release builds when its array fast path truncates a timestamp near
`i64::MIN`.
## What changes are included in this PR?
Use checked subtraction in the fine-granularity array path and return an
execution error when the truncated timestamp cannot be represented.
## What is the testing strategy for this PR?
Added `test_date_trunc_fine_granularity_underflow`, which passes
`i64::MIN` through the nanosecond timestamp array path and verifies that
`date_trunc` returns an execution error.
The original SQL reproduction was also verified with the locally
compiled DataFusion CLI.
## Are there any user-facing changes?
Invalid extreme timestamp truncations now return an execution error
instead of panicking or returning a wrapped timestamp.
---
Note: This PR was developed with AI assistance. All changes have been
reviewed, and I take full responsibility for this contribution.
0 commit comments