You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "eitsupi (via GitHub)" <gi...@apache.org> on 2024/10/26 03:43:52 UTC
Re: [I] [R] Initializing an Arrow array from an R difftime or hms::hms rounds down to the nearest time unit [arrow]
eitsupi commented on issue #40109:
URL: https://github.com/apache/arrow/issues/40109#issuecomment-2439259789
> The default should be to convert to nanoseconds, like `arrow::as_arrow_array(type = arrow::duration("ns"))`. 2^64 ns is ~585 years, so you don't generally have to worry about overflow.
In fact, since the difftime class object is based on a double vector, isn't the period that can be represented exactly up to 2^53-1 as described here? https://github.com/apache/arrow/issues/32693#issuecomment-1846140077
I have recently rewritten the polars package and have restricted POSIXct and difftime resolution to millisecond to support more than sufficient range.
https://github.com/pola-rs/r-polars/blob/1f7cd37637a98f2c6a6f88ed27c608118ffaf939/R/as_polars_series.R#L28-L37
If we need full nanosecond resolution, I think we will need to use the `clock` package.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org