Skip to content

Date64::to_naive_date panics on larger values #7728

Closed

Description

@adriangb

In DataFusion we found that this panics, despite the value being well within the range of an i64:

Literal::new(ScalarValue::Date64(Some(-790179464505600000)))

Internally it calls Date64::to_naive_date(Some(-790179464505600000)) which ends up hitting this panic:

https://github.com/chronotope/chrono/blob/bab97905ccfa5aa7ceae1ee131b41b7113ea4f6a/src/naive/date/mod.rs#L1876-L1877

I believe we should call NaiveDate::checked_add_signed and propagate the opt everywhere.

DataFusion will have to decide what it does with that.

Activity

  1. liamzwbao commented on Jul 17, 2025

    @liamzwbao
    Contributor

    Hi @adriangb, just want to check if this is still needed. I found that we already support to_naive_date_opt in #7737 so I guess we can close this issue.

  2. Jefffrey commented on Jul 2, 2026

    @Jefffrey
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions