Skip to content

Commit 6dbc31e

Browse files
committed
Add tests for filter() and arrange() with aggregation expressions
1 parent 744f0ec commit 6dbc31e

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

r/R/dplyr-arrange.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ arrange.arrow_dplyr_query <- function(.data, ..., .by_group = FALSE) {
4646
# dplyr lets you arrange on e.g. x < mean(x), but we haven't implemented it.
4747
# But we could, the same way it works in mutate() via join, if someone asks.
4848
# Until then, just error.
49-
# TODO: add a test for this
5049
arrow_not_supported(
5150
.actual_msg = "Expression not supported in arrange() in Arrow",
5251
call = expr

r/R/dplyr-filter.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ filter.arrow_dplyr_query <- function(.data, ..., .by = NULL, .preserve = FALSE)
4242
# dplyr lets you filter on e.g. x < mean(x), but we haven't implemented it.
4343
# But we could, the same way it works in mutate() via join, if someone asks.
4444
# Until then, just error.
45-
# TODO: add a test for this
4645
arrow_not_supported(
4746
.actual_msg = "Expression not supported in filter() in Arrow",
4847
call = expr

r/tests/testthat/test-dplyr-arrange.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,11 @@ test_that("Can use across() within arrange()", {
245245
example_data
246246
)
247247
})
248+
249+
test_that("arrange() with aggregation expressions errors", {
250+
tab <- arrow_table(tbl)
251+
expect_error(
252+
tab |> arrange(int < mean(int)),
253+
"not supported in arrange"
254+
)
255+
})

r/tests/testthat/test-dplyr-filter.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,3 +490,11 @@ test_that(".by argument", {
490490
"Can't supply `\\.by` when `\\.data` is grouped data"
491491
)
492492
})
493+
494+
test_that("filter() with aggregation expressions errors", {
495+
tab <- arrow_table(tbl)
496+
expect_error(
497+
tab |> filter(int < mean(int)),
498+
"not supported in filter"
499+
)
500+
})

0 commit comments

Comments
 (0)