nealrichardson commented on a change in pull request #11119:
URL: https://github.com/apache/arrow/pull/11119#discussion_r705649246
##########
File path: r/tests/testthat/test-dplyr-lubridate.R
##########
@@ -32,97 +32,132 @@ if (tolower(Sys.info()[["sysname"]]) == "windows") {
} else {
test_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz =
"Pacific/Marquesas")
}
-test_df <- tibble::tibble(date = test_date)
-test_date_df <- tibble::tibble(date = as.Date(as.character(test_date)))
-test_that("extract year from date32 objects", {
- expect_equivalent(
- test_date_df %>%
- mutate(x = year(date)) %>%
- collect() %>%
- select(x),
- test_df %>%
- mutate(x = year(date)) %>%
- collect() %>%
- select(x)
+test_df <- tibble::tibble(
+ datetime = test_date,
+ date = as.Date("2021-09-09")
+)
+
+test_that("extract year from timestamp", {
+ expect_dplyr_equal(
+ input %>%
+ mutate(x = year(datetime)) %>%
Review comment:
It looks like none of these tests are testing the `date32` path.
Shouldn't they all look something like this?
```suggestion
mutate(
year(datetime),
year(date)
) %>%
```
##########
File path: r/tests/testthat/test-dplyr-lubridate.R
##########
@@ -32,97 +32,132 @@ if (tolower(Sys.info()[["sysname"]]) == "windows") {
} else {
test_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz =
"Pacific/Marquesas")
}
-test_df <- tibble::tibble(date = test_date)
-test_date_df <- tibble::tibble(date = as.Date(as.character(test_date)))
-test_that("extract year from date32 objects", {
- expect_equivalent(
- test_date_df %>%
- mutate(x = year(date)) %>%
- collect() %>%
- select(x),
- test_df %>%
- mutate(x = year(date)) %>%
- collect() %>%
- select(x)
+test_df <- tibble::tibble(
+ datetime = test_date,
+ date = as.Date("2021-09-09")
Review comment:
Wouldn't hurt to confirm the missing data behavior is consistent.
```suggestion
datetime = c(test_date, NA),
date = c(as.Date("2021-09-09"), NA)
```
--
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]