You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "xiedeyantu (via GitHub)" <gi...@apache.org> on 2026/05/16 16:34:22 UTC
[PR] fix date_trunc overflows converting extreme non-ns timestamps to nanoseconds [datafusion]
xiedeyantu opened a new pull request, #22262:
URL: https://github.com/apache/datafusion/pull/22262
## Which issue does this PR close?
- Closes #22209
## Rationale for this change
`date_trunc` can panic during planning and constant folding when it receives extreme non-nanosecond timestamps. The overflow happens while converting values to nanoseconds, so a valid SQL query can crash the planner instead of returning a proper error. This change makes that path fail gracefully with a planning error.
## What changes are included in this PR?
- Adds overflow checks to the timestamp scale conversion used by `date_trunc`.
- Converts the panic into a normal out-of-range planning error.
- Adds regression coverage for extreme `Timestamp(Second)`, `Timestamp(Millisecond)`, and `Timestamp(Microsecond)` inputs.
- Adds a SQL-level regression test for the `arrow_cast(...)` plus `date_trunc(...)` repro.
## Are these changes tested?
- Yes. I added regression tests and verified the repro now returns an error instead of panicking.
## Are there any user-facing changes?
- Yes. Out-of-range timestamp inputs now produce a planning error rather than aborting the query with a panic.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix date_trunc overflows converting extreme non-ns timestamps to nanoseconds [datafusion]
Posted by "xudong963 (via GitHub)" <gi...@apache.org>.
xudong963 merged PR #22262:
URL: https://github.com/apache/datafusion/pull/22262
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org