dragosmg commented on a change in pull request #12429:
URL: https://github.com/apache/arrow/pull/12429#discussion_r811156508
##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -711,3 +711,40 @@ test_that("am/pm mirror lubridate", {
)
})
+
+test_that("semester works with temporal types and integers", {
+ test_df <- tibble(
+ month_as_int = c(1:12, NA),
+ month_as_char_pad = sprintf("%02i", month_as_int),
+ dates = as.Date(paste0("2021-", month_as_char_pad, "-15"))
+ )
+
+ # semester extraction from dates
+ compare_dplyr_binding(
+ .input %>%
+ mutate(sem_wo_year = semester(dates),
+ sem_w_year = semester(dates, with_year = TRUE)) %>%
+ collect(),
+ test_df
+ )
+ # semester extraction from months as integers
+ compare_dplyr_binding(
+ .input %>%
+ mutate(sem_month_as_int = semester(month_as_int)) %>%
+ collect(),
+ test_df
+ )
+
+ expect_error(
+ call_binding("semester", Expression$scalar(1:13))
+ )
Review comment:
Nope. Not yet, I would like to get an error, but it at the moment it's
just a placeholder since the function doesn't yet error / work correctly.
--
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]