Skip to content

GH-51655: [R] Advance long-standing deprecations in map_batches() and pull() - #51658

Merged
thisisnic merged 2 commits into
apache:mainfrom
thisisnic:GH-51655-deprepcations-r-26
Sep 30, 2026
Merged

thisisnic merged 2 commits into
apache:mainfrom
thisisnic:GH-51655-deprepcations-r-26

Conversation

@thisisnic

@thisisnic thisisnic commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Old deprecation warnings hadn't been dealt with

What changes are included in this PR?

I've deprecated the .data.frame argument in map_batches() but I think we actually may be better off leaving pull() as-is given it's been like that for such a long time.

Are these changes tested?

Existing tests

Are there any user-facing changes?

Yes

pull() on Arrow data no longer warns about a future change of default; it will keep returning an R vector by default, with as_vector = FALSE or options(arrow.pull_as_vector = FALSE) to get a ChunkedArray.

The deprecated .data.frame argument to map_batches() has been removed.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Copilot AI balanced review requested due to automatic review settings September 30, 2026 12:52
@thisisnic
thisisnic requested a review from jonkeane as a code owner September 30, 2026 12:52
@github-actions github-actions Bot added the awaiting committer review Awaiting committer review label Sep 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The public API changes need a current release-note entry.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Keeps pull() returning R vectors by default and removes the deprecated map_batches() argument.

Changes:

  • Removes .data.frame from map_batches().
  • Finalizes pull() defaults and documentation.
  • Updates related tests.
File Description
r/​R/​dataset-scan.R Removes deprecated argument.
r/​R/​dplyr-collect.R Defaults pull() to vectors.
r/​R/​dplyr-funcs-doc.R Updates pull() documentation.
r/​R/​arrow-package.R Updates method summary.
r/​man/​map_batches.Rd Updates generated reference.
r/​man/​acero.Rd Updates generated reference.
r/​tests/​testthat/​helper-arrow.R Removes obsolete test option.
r/​tests/​testthat/​test-dplyr-query.R Tests finalized behavior.
Files not reviewed (2)
  • r/man/acero.Rd: Generated file
  • r/man/map_batches.Rd: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread r/R/dataset-scan.R
Copilot AI balanced review requested due to automatic review settings September 30, 2026 13:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation, tests, documentation, and release notes consistently reflect the intended API behavior.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Files not reviewed (2)
  • r/man/acero.Rd: Generated file
  • r/man/map_batches.Rd: Generated file

@jonkeane jonkeane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this. My question at the end of my one comment is actually answered in the news down below, but I'm going to leave it in the comment for posterity (which is recursive posterity, apparently)

Comment thread r/R/dplyr-collect.R
}

handle_pull_as_vector <- function(out, as_vector) {
if (is.null(as_vector)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did some digging (well tasked a clanker to do the digging...) to see why we did this in the first place. Here it is for posterity (or some future clanker to dig it up). We originally proposed to do this since there wasn't another ergonomic way to get a chunked array, and unlike dbplyr where this was originally inspired by, Arrow has an in-memory representation, so there wasn't a requirement to turn it into an R vector.

It turns out that broke dependencies so we made it opt in at the time, though there has been consistent feedback that other engines like data.table also return just a vector (and conceptually dplyr does this with data.frames too, it strips the outer data.frameness).

I'm good with undeprecating this. Though I am slightly curious (and we should do this in a follow on if we do), do we now have a (more) ergonomic way to get a chunked array? is it pull(..., as_vector=FALSE)? or something else?

@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Sep 30, 2026
@thisisnic
thisisnic merged commit 26310ff into apache:main Sep 30, 2026
36 checks passed
@thisisnic thisisnic removed the awaiting merge Awaiting merge label Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants