The Series has time unit us. Getting the total number of nanoseconds requires multiplying the underlying integer by 1000, which may overflow.
We currently use unchecked multiplication for this, while we would need to use checked multiplication and set any overflowing values to null. The fix would be to implement checked arithmetic kernels and use these here.
Checks
Reproducible example
Log output
Issue description
The Series has time unit
us
. Getting the total number of nanoseconds requires multiplying the underlying integer by 1000, which may overflow.We currently use unchecked multiplication for this, while we would need to use checked multiplication and set any overflowing values to
null
. The fix would be to implement checked arithmetic kernels and use these here.The offending code is here: https://github.com/pola-rs/polars/blob/eb7f9391cb7f2fb6984b6a72581168c5425abcfe/crates/polars-time/src/chunkedarray/duration.rs#L100-L108
Expected behavior
Output should be null rather than wrapping.
Installed versions
main