paleolimbot commented on PR #14093:
URL: https://github.com/apache/arrow/pull/14093#issuecomment-1371037816
There's still one failing test related to the "roll" behaviour. Basically,
lubridate doesn't support the way that Arrow can handle this case (the clock
package can support both).
``` r
library(arrow, warn.conflicts = FALSE)
#> Some features are not enabled in this build of Arrow. Run `arrow_info()`
for more information.
library(dplyr, warn.conflicts = FALSE)
nonexistent <- lubridate::as_datetime(c(
"2015-03-29 02:30:00",
"2015-03-29 03:30:00"
), tz = "UTC")
# arrow (can only do a roll-forward)
arrow_table(timestamp = nonexistent) |>
mutate(rolled = lubridate::force_tz(timestamp, "Europe/Brussels", roll_dst
= "post")) |>
collect()
#> # A tibble: 2 × 2
#> timestamp rolled
#> <dttm> <dttm>
#> 1 2015-03-29 02:30:00 2015-03-29 03:00:00
#> 2 2015-03-29 03:30:00 2015-03-29 03:30:00
# lubridate (can only do a shift-forward)
tibble::tibble(timestamp = nonexistent) |>
mutate(rolled = lubridate::force_tz(timestamp, "Europe/Brussels", roll_dst
= "post")) |>
collect()
#> # A tibble: 2 × 2
#> timestamp rolled
#> <dttm> <dttm>
#> 1 2015-03-29 02:30:00 2015-03-29 03:30:00
#> 2 2015-03-29 03:30:00 2015-03-29 03:30:00
# clock (can do both)
tibble::tibble(timestamp = nonexistent) |>
mutate(
rolled =
as.POSIXct(clock::as_zoned_time(clock::as_naive_time(timestamp),
"Europe/Brussels", nonexistent = "roll-forward")),
shifted =
as.POSIXct(clock::as_zoned_time(clock::as_naive_time(timestamp),
"Europe/Brussels", nonexistent = "shift-forward"))
) |>
collect()
#> # A tibble: 2 × 3
#> timestamp rolled shifted
#> <dttm> <dttm> <dttm>
#> 1 2015-03-29 02:30:00 2015-03-29 03:00:00 2015-03-29 03:30:00
#> 2 2015-03-29 03:30:00 2015-03-29 03:30:00 2015-03-29 03:30:00
```
I'm not sure what the best way to handle that is!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]