-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
Milestone
Description
base::strptime() returns NA when the value passed to the format argument does not match the string to be parsed. The arrow binding currently errors in the same scenario.
strptime("2022-02-11", format = "%Y-%m-%d")
#> [1] "2022-02-11 GMT"
strptime("2022-02-11", format = "%Y %m-%d")
#> [1] NAsuppressMessages(library(lubridate))
suppressMessages(library(arrow))
suppressMessages(library(dplyr))
df <- tibble(x = "2022-02-11")
df %>%
mutate(z = strptime(x, format = "%Y-%m %d"))
#> # A tibble: 1 × 2
#> x z
#> <chr> <dttm>
#> 1 2022-02-11 NA
df %>%
record_batch() %>%
mutate(z = strptime(x, format = "%Y-%m %d")) %>%
collect()
#> Error: Invalid: Failed to parse string: '2022-02-11' as a scalar of type timestamp[ms]Reporter: Dragoș Moldovan-Grünfeld / @dragosmg
Assignee: Dragoș Moldovan-Grünfeld / @dragosmg
Watchers: Rok Mihevc / @rok
Related issues:
- [R] Implement bindings for lubridate's parse_date_time (blocks)
- [C++] Add error handling option to StrptimeOptions (is blocked by)
- [R] Improve as.Date() error message when supplying several tryFormats (is depended upon by)
PRs and other links:
Note: This issue was originally created as ARROW-15659. Please see the migration documentation for further details.