jonkeane commented on a change in pull request #12402:
URL: https://github.com/apache/arrow/pull/12402#discussion_r837694040
##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -118,6 +118,51 @@ test_that("errors in strptime", {
)
})
+test_that("strptime returns NA when format doesn't match the data", {
+ df <- tibble(
+ str_date = c("2022-02-07", "2012/02-07", "1975/01-02", "1981/01-07")
Review comment:
should we have an `NA` here too?
##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -118,6 +118,51 @@ test_that("errors in strptime", {
)
})
+test_that("strptime returns NA when format doesn't match the data", {
+ df <- tibble(
+ str_date = c("2022-02-07", "2012/02-07", "1975/01-02", "1981/01-07")
+ )
+
+ expect_equal(
+ df %>%
+ arrow_table() %>%
+ mutate(
+ r_obj_parsed_date = strptime("03-27/2022", format = "%m-%d/%Y"),
+ r_obj_parsed_na = strptime("03-27/2022", format = "Y%-%m-%d")) %>%
+ collect(),
+ tibble(
+ str_date = c("2022-02-07", "2012/02-07", "1975/01-02", "1981/01-07"),
+ r_obj_parsed_date = as.POSIXct(rep("2022-03-27", 4)),
+ r_obj_parsed_na = as.POSIXct(rep(NA, 4))
+ ),
+ ignore_attr = "tzone"
+ )
Review comment:
Besides tzone, we expect dplyr and arrow execution methods to be the
same now, yeah? Could we use `compare_dplyr_binding`?
--
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]