Downcasting temporal units silently overflows #21493
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
Log output
Issue description
When casting from
pl.Datetime("us")
topl.Datetime("ns")
(or from "ms" to "us" or "ns"), polars will not respect its own documentation about invalid values, where ifstrict=True
the above should error andstrict=False
the above should return[null]
. Instead it appears to overflow for values out of bounds for the more precisetime_unit
.The same can be seen for
pl.Duration
.Expected behavior
Polars should error, return null or wrap depending on the option passed to
.cast
for , rather than always wrapping, for temporal types.Installed versions
The text was updated successfully, but these errors were encountered: