paleolimbot commented on code in PR #13440:
URL: https://github.com/apache/arrow/pull/13440#discussion_r914302572
##########
r/tests/testthat/test-dplyr-funcs-datetime.R:
##########
@@ -719,6 +734,22 @@ test_that("extract yday from date", {
)
})
+test_that("extract qday from date", {
+ compare_dplyr_binding(
+ .input %>%
+ mutate(x = qday(date)) %>%
+ collect(),
+ test_df
Review Comment:
Same as above for this (use a tibble where `date` is a sequence spanning a
year to make sure that boundary days are handled).
##########
r/tests/testthat/test-dplyr-funcs-datetime.R:
##########
@@ -533,6 +533,21 @@ test_that("extract yday from timestamp", {
)
})
+test_that("extract qday from timestamp", {
+ compare_dplyr_binding(
+ .input %>%
+ mutate(x = qday(datetime)) %>%
+ collect(),
+ test_df
Review Comment:
Rather than `test_df`, it might make sense for this binding to use a
sequence of dates (or datetimes) that spans a year (or maybe that spans a year
and a leap year if that matters here). Maybe something like
``` r
tibble::tibble(date = seq(as.Date("2000-01-01"), as.Date("2000-12-31"), by =
"day"))
#> # A tibble: 366 × 1
#> date
#> <date>
#> 1 2000-01-01
#> 2 2000-01-02
#> 3 2000-01-03
#> 4 2000-01-04
#> 5 2000-01-05
#> 6 2000-01-06
#> 7 2000-01-07
#> 8 2000-01-08
#> 9 2000-01-09
#> 10 2000-01-10
#> # … with 356 more rows
tibble::tibble(datetime = seq(as.POSIXct("2000-01-01 00:00:00"),
as.POSIXct("2000-12-31 23:00:00"), by = "day"))
#> # A tibble: 366 × 1
#> datetime
#> <dttm>
#> 1 2000-01-01 00:00:00
#> 2 2000-01-02 00:00:00
#> 3 2000-01-03 00:00:00
#> 4 2000-01-04 00:00:00
#> 5 2000-01-05 00:00:00
#> 6 2000-01-06 00:00:00
#> 7 2000-01-07 00:00:00
#> 8 2000-01-08 00:00:00
#> 9 2000-01-09 00:00:00
#> 10 2000-01-10 00:00:00
#> # … with 356 more rows
```
--
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]