-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-17637: [R] as.Date fails going from timestamp[us] to timestamp[s] #14935
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Benchmark runs are scheduled for baseline = 4751c89 and contender = 702dbf3. 702dbf3 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
['Python', 'R'] benchmarks have high level of regressions. |
…able to handle time in sub seconds (#13890) This change allows strings containing sub-seconds and double types to be used as input to `lubridate::as_datetime()`. ```r 1.5 |> arrow::arrow_table(x = _) |> dplyr::mutate( y = lubridate::as_datetime(x) ) |> dplyr::collect() |> dplyr::mutate( z = lubridate::as_datetime(x), is_equal = (y == z) ) #> x y z is_equal #> 1 1.5 1970-01-01 00:00:01 1970-01-01 00:00:01 TRUE ``` And, because the timestamp type generated by `as_datetime` is expected to be used in combination with other functions, fix the bug of ~~`as.Date` and~~ `lubridate::as_date` that could cause an error if a sub-seconds timestamp was entered. Edit: as.Date fixed by #14935 As a breaking change, the return type of `as_datetime()` will be nanoseconds, but I hope this will not have a major impact, since originally `as_datetime() |> as.integer()` or `as_datetime() |> as.numeric()` could not be used because it would try to cast to int32 or double, resulting in an error. (We have to cast timestamp to int64) arrow 9.0.0 ```r 1 |> arrow::arrow_table(x = _) |> dplyr::mutate( x = lubridate::as_datetime(x), y = cast(x, arrow::int64()) ) |> dplyr::collect() #> x y #> 1 1970-01-01 00:00:01 1 ``` This PR ``` r 1 |> arrow::arrow_table(x = _) |> dplyr::mutate( x = lubridate::as_datetime(x), y = cast(x, arrow::int64()) ) |> dplyr::collect() #> x y #> 1 1970-01-01 00:00:01 1000000000 ``` Lead-authored-by: SHIMA Tatsuya <ts1s1andn@gmail.com> Co-authored-by: Nic Crane <thisisnic@gmail.com> Signed-off-by: Nic Crane <thisisnic@gmail.com>
Before this PR:
Created on 2022-12-13 with reprex v2.0.2
After this PR:
Created on 2022-12-13 with reprex v2.0.2