dragosmg commented on code in PR #13174:
URL: https://github.com/apache/arrow/pull/13174#discussion_r876005299
##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -618,4 +618,40 @@ register_bindings_datetime_parsers <- function() {
for (ymd_order in ymd_parser_vec) {
register_binding(ymd_order, ymd_parser_map_factory(ymd_order))
}
+
+ register_binding("fast_strptime", function(x,
+ format,
+ tz = "UTC",
+ lt = FALSE,
+ cutoff_2000 = 68L) {
+ # `lt` controls the output `lt = TRUE` returns a POSIXlt (which doesn't
play
+ # well with mutate, for example)
+ if (lt) {
+ arrow_not_supported("`lt = TRUE` argument")
+ }
Review Comment:
Testing for `lt = TRUE` is difficult as it doesn't work in dplyr either.
``` r
library(lubridate, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)
dates_table <- tibble(
string_with_short_year = c("68-05-17", "69-05-17", "55-05-17")
)
dates_table %>%
mutate(
date = fast_strptime(
string_with_short_year,
format = "%y-%m-%d",
lt = TRUE
)
)
#> Error in `vec_slice()`:
#> ! Column `isdst` (size 1) must match the data frame (size 3).
#> ℹ In file 'slice.c' at line 191.
#> ℹ This is an internal error in the rlang package, please report it to the
#> package authors.
```
<sup>Created on 2022-05-18 by the [reprex
package](https://reprex.tidyverse.org) (v2.0.1)</sup>
--
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]