Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions r/R/dplyr-arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ arrange.arrow_dplyr_query <- function(.data, ..., .by_group = FALSE) {
# dplyr lets you arrange on e.g. x < mean(x), but we haven't implemented it.
# But we could, the same way it works in mutate() via join, if someone asks.
# Until then, just error.
# TODO: add a test for this
arrow_not_supported(
.actual_msg = "Expression not supported in arrange() in Arrow",
call = expr
call = exprs[[i]]
)
}
descs[i] <- x[["desc"]]
Expand Down
1 change: 0 additions & 1 deletion r/R/dplyr-filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ filter.arrow_dplyr_query <- function(.data, ..., .by = NULL, .preserve = FALSE)
# dplyr lets you filter on e.g. x < mean(x), but we haven't implemented it.
# But we could, the same way it works in mutate() via join, if someone asks.
# Until then, just error.
# TODO: add a test for this
arrow_not_supported(
.actual_msg = "Expression not supported in filter() in Arrow",
call = expr
Expand Down
8 changes: 8 additions & 0 deletions r/tests/testthat/test-dplyr-arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,11 @@ test_that("Can use across() within arrange()", {
example_data
)
})

test_that("arrange() with aggregation expressions errors", {
tab <- arrow_table(tbl)
expect_warning(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has to catch warning instead per:

── Warning ('test-dplyr-filter.R:496:3'): filter() with aggregation expressions errors ──
In int < mean(int): 
i Expression not supported in filter() in Arrow
> Pulling data into R
Backtrace:
     ▆
  1. ├─testthat::expect_error(filter(tab, int < mean(int)), "not supported in filter") at test-dplyr-filter.R:496:3
  2. │ └─testthat:::expect_condition_matching_(...)
  3. │   └─testthat:::quasi_capture(...)
  4. │     ├─testthat (local) .capture(...)
  5. │     │ └─base::withCallingHandlers(...)
  6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  7. ├─dplyr::filter(tab, int < mean(int))
  8. └─arrow:::filter.ArrowTabular(tab, int < mean(int))
  9.   └─arrow:::try_arrow_dplyr(...)
 10.     └─base::tryCatch(...)
 11.       └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 12.         └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 13.           └─value[[3L]](cond)
 14.             └─arrow:::abandon_ship(e, parent)

tab |> arrange(int < mean(int)),
"not supported in arrange"
)
})
8 changes: 8 additions & 0 deletions r/tests/testthat/test-dplyr-filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,11 @@ test_that(".by argument", {
"Can't supply `\\.by` when `\\.data` is grouped data"
)
})

test_that("filter() with aggregation expressions errors", {
tab <- arrow_table(tbl)
expect_warning(
tab |> filter(int < mean(int)),
"not supported in filter"
)
})
Loading