paleolimbot commented on code in PR #14948:
URL: https://github.com/apache/arrow/pull/14948#discussion_r1048558210
##########
r/tests/testthat/test-dplyr-summarize.R:
##########
@@ -298,12 +298,16 @@ test_that("n_distinct() on dataset", {
})
test_that("Functions that take ... but we only accept a single arg", {
- compare_dplyr_binding(
- .input %>%
- summarize(distinct = n_distinct()) %>%
- collect(),
- tbl,
- warning = "0 arguments"
+ # Error now generated by dplyr (https://github.com/tidyverse/dplyr/pull/6543)
+ expect_snapshot(
+ error = TRUE,
+ compare_dplyr_binding(
+ .input %>%
+ summarize(distinct = n_distinct()) %>%
+ collect(),
+ tbl,
+ warning = "0 arguments"
+ )
Review Comment:
```suggestion
expect_snapshot(
error = TRUE,
tbl %>%
summarize(distinct = n_distinct())
)
```
##########
r/tests/testthat/test-dataset.R:
##########
@@ -586,16 +586,25 @@ test_that("UnionDataset can merge schemas", {
collect() %>%
arrange(x)
expect_equal(colnames(actual), c("x", "y", "z"))
- expect_equal(
- actual,
- union_all(as_tibble(sub_df1), as_tibble(sub_df2))
+
+ union_all_common <- function(...) {
+ common <- vctrs::vec_cast_common(...)
+ rlang::inject(union_all(!!!common))
+ }
+
+ expected <- union_all_common(
+ as_tibble(sub_df1),
+ as_tibble(sub_df2)
)
+ expect_equal(actual, expected)
# without unifying schemas, takes the first schema and discards any columns
# in the second which aren't in the first
ds <- open_dataset(list(ds1, ds2), unify_schemas = FALSE)
- expected <- as_tibble(sub_df1) %>%
- union_all(sub_df2 %>% as_tibble() %>% select(x))
+ expected <- union_all_common(
+ as_tibble(sub_df1),
+ as_tibble(sub_df2) %>% select(x)
+)
Review Comment:
```suggestion
)
```
##########
r/tests/testthat/test-dplyr-summarize.R:
##########
@@ -298,12 +298,16 @@ test_that("n_distinct() on dataset", {
})
test_that("Functions that take ... but we only accept a single arg", {
- compare_dplyr_binding(
- .input %>%
- summarize(distinct = n_distinct()) %>%
- collect(),
- tbl,
- warning = "0 arguments"
+ # Error now generated by dplyr (https://github.com/tidyverse/dplyr/pull/6543)
+ expect_snapshot(
+ error = TRUE,
+ compare_dplyr_binding(
+ .input %>%
+ summarize(distinct = n_distinct()) %>%
+ collect(),
+ tbl,
+ warning = "0 arguments"
+ )
Review Comment:
(A little more direct than going through `compare_dplyr_binding()`, which
might evaluate the dplyr version and error for that first)
--
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]