Skip to content

GH-45314: [R] arrow R package: multiple replacement disclaimers for str_replace_all - #51168

Closed
thisisnic wants to merge 2 commits into
apache:mainfrom
thisisnic:GH-45314-str_replace_all
Closed

GH-45314: [R] arrow R package: multiple replacement disclaimers for str_replace_all#51168
thisisnic wants to merge 2 commits into
apache:mainfrom
thisisnic:GH-45314-str_replace_all

Conversation

@thisisnic

@thisisnic thisisnic commented Sep 6, 2026

Copy link
Copy Markdown
Member

Rationale for this change

sub(), gsub(), str_replace(), str_replace_all(), str_remove(), and str_remove_all() only accept a single pattern/replacement, but neither the docs nor the error message said why.

What changes are included in this PR?

The validation error now says multiple replacements are not supported, and the limitation is documented against each of those functions on the "Functions available in Arrow dplyr queries" page.

Are these changes tested?

No

Are there any user-facing changes?

No

🤖 Generated with Claude Code, checked manually by @thisisnic

https://claude.ai/code/session_01Y273BE7ZELeBhwRRQH2xrv

@thisisnic
thisisnic requested a review from jonkeane as a code owner September 6, 2026 12:00
Copilot AI lite review requested due to automatic review settings September 6, 2026 12:00
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #45314 has been automatically assigned in GitHub to PR creator.

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.

🟡 Changes recommended

The updated pattern-length validation error is misleading for str_remove*() (it mentions “replacements”), and the new error wording isn’t currently protected by a targeted test assertion.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves the Arrow R dplyr function-mapping UX by making the “single pattern/replacement only” limitation explicit in both runtime validation errors and the generated “Functions available in Arrow dplyr queries” documentation.

Changes:

  • Update arrow_r_string_replace_function() validation errors to mention that multiple replacements aren’t supported.
  • Attach notes to the sub()/gsub()/str_replace*()/str_remove*() bindings so doc generation includes the limitation text.
  • Regenerate the function-mapping docs output so the acero help page lists the new disclaimers.
File summaries
File Description
r/R/dplyr-funcs-string.R Adjusts validation error text and adds notes metadata for replace/remove bindings.
r/R/dplyr-funcs-doc.R Regenerated doc list to include multiple pattern/replacement disclaimers.
r/man/acero.Rd Regenerated Rd output to reflect updated function-mapping notes.
Review details

Files not reviewed (1)

  • r/man/acero.Rd: Generated file
  • Files reviewed: 2/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment thread r/R/dplyr-funcs-string.R
Comment thread r/R/dplyr-funcs-string.R
Copilot AI review requested due to automatic review settings September 6, 2026 12:30

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.

🟡 Changes recommended

The updated error messaging still allows a generic “missing replacement” error path for stringr-style named pattern inputs, which undermines the goal of consistently informative validation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Files not reviewed (1)

  • r/man/acero.Rd: Generated file
  • Files reviewed: 3/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread r/R/dplyr-funcs-string.R
Comment on lines 369 to +372
if (length(replacement) != 1) {
validation_error("`replacement` must be a length 1 character vector")
validation_error(
"Multiple replacements not supported: `replacement` must be a length 1 character vector"
)
@thisisnic thisisnic closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants