Skip to content
Closed
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
2 changes: 1 addition & 1 deletion r/R/dataset-scan.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ tail_from_batches <- function(batches, n) {
map_batches <- function(X, FUN, ..., .data.frame = TRUE) {
# TODO: ARROW-15271 possibly refactor do_exec_plan to return a RecordBatchReader
plan <- ExecPlan$create()
final_node <- plan$Build(X)
final_node <- plan$Build(as_adq(X))
reader <- plan$Run(final_node)
FUN <- as_mapper(FUN)

Expand Down
8 changes: 8 additions & 0 deletions r/tests/testthat/test-dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,14 @@ test_that("map_batches", {
c(5, 10)
)

# Can take a raw dataset as X argument
expect_equal(
ds %>%
map_batches(~ count(., part)) %>%
arrange(part),
tibble(part = c(1, 2), n = c(10, 10))
)

# $Take returns RecordBatch, which gets binded into a tibble
expect_equal(
ds %>%
Expand Down