AlenkaF commented on a change in pull request #10334: URL: https://github.com/apache/arrow/pull/10334#discussion_r641409188
########## File path: r/tests/testthat/test-dplyr-string-functions.R ########## @@ -493,3 +493,81 @@ test_that("edge cases in string detection and replacement", { tibble(x = c("ABC")) ) }) + +test_that("strptime", { + + t_string <- tibble(x = c("2018-10-07 19:04:05", NA)) + t_stamp <- tibble(x = c(lubridate::ymd_hms("2018-10-07 19:04:05"), NA)) + t_stampPDT <- tibble(x = c(lubridate::ymd_hms("2018-10-07 19:04:05", tz = "PDT"), NA)) + + expect_equivalent( + t_string %>% + Table$create() %>% + mutate( + x = strptime(x) + ) %>% + collect(), + t_stamp, + check.tzone = FALSE + ) + + expect_equivalent( + t_string %>% + Table$create() %>% + mutate( + x = strptime(x, format = "%Y-%m-%d %H:%M:%S") + ) %>% + collect(), + t_stamp, + check.tzone = FALSE + ) + + expect_equivalent( + t_string %>% + Table$create() %>% + mutate( + x = strptime(x, format = "%Y-%m-%d %H:%M:%S", unit = TimeUnit$NANO) + ) %>% + collect(), + t_stamp, + check.tzone = FALSE + ) + + expect_equivalent( + t_string %>% + Table$create() %>% + mutate( + x = strptime(x, format = "%Y-%m-%d %H:%M:%S", unit = "s") + ) %>% + collect(), + t_stamp, + check.tzone = FALSE + ) + + expect_equivalent( + t_string %>% + Table$create() %>% + mutate( + x = strptime(x, format = "%Y-%m-%d %H:%M:%S", tz="PDT") + ) %>% + collect(), + t_stamp, + check.tzone = FALSE + ) Review comment: See reply here https://github.com/apache/arrow/pull/10334/files#r641408098 -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org