Skip to content

Commit

Permalink
ARROW-17690: [R] Implement dplyr::across() inside distinct() (#14154)
Browse files Browse the repository at this point in the history
The feature was actually done by ARROW-17689; this PR just adds the test and updates the docs.

cc @eitsupi 

Authored-by: Neal Richardson <[email protected]>
Signed-off-by: Neal Richardson <[email protected]>
  • Loading branch information
nealrichardson authored Sep 20, 2022
1 parent 4f31bfc commit 2577ac1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion r/R/dplyr-funcs-doc.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
#'
#' ## dplyr
#'
#' * [`across()`][dplyr::across()]: supported inside `mutate()`, `summarize()`, `group_by()`, and `arrange()`;
#' * [`across()`][dplyr::across()]: not yet supported inside `filter()`;
#' purrr-style lambda functions
#' and use of `where()` selection helper not yet supported
#' * [`between()`][dplyr::between()]
Expand Down
4 changes: 2 additions & 2 deletions r/data-raw/docgen.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ docs <- arrow:::.cache$docs

# across() is handled by manipulating the quosures, not by nse_funcs
docs[["dplyr::across"]] <- c(
# TODO(ARROW-17387, ARROW-17389, ARROW-17390): other verbs
"supported inside `mutate()`, `summarize()`, `group_by()`, and `arrange()`;",
# TODO(ARROW-17387): do filter
"not yet supported inside `filter()`;",
# TODO(ARROW-17366): do ~
"purrr-style lambda functions",
# TODO(ARROW-17384): implement where
Expand Down
2 changes: 1 addition & 1 deletion r/man/acero.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions r/tests/testthat/test-dplyr-distinct.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ test_that("distinct() can contain expressions", {
)
})

test_that("across() works in distinct()", {
compare_dplyr_binding(
.input %>%
distinct(across(starts_with("d"))) %>%
collect() %>%
arrange(dbl, dbl2),
tbl
)
})

test_that("distinct() can return all columns", {
skip("ARROW-14045")
compare_dplyr_binding(
Expand Down

0 comments on commit 2577ac1

Please sign in to comment.