apache / apache/arrow

[R] arrow R package: multiple replacement disclaimers for str_replace_all

Open
#45,314 2 comments 0 reactions 0 assignees View on GitHub
Component: R Status: needs champion Type: enhancement
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the enhancement requested

While PR https://github.com/apache/arrow/pull/39219 introduced an error message when the user passes pattern/replacement vectors with more than one element to `arrow_r_string_replace_function`, I'd like to suggest two enhancements.

* First and most fundamental: add a caveat on [this page](https://arrow.apache.org/docs/r/reference/acero.html#stringr), which, by the way, I use almost every day. On `r/R/dplyr-funcs-doc.R`:
```
#' * [`str_replace_all()`][stringr::str_replace_all()] Multiple replacements not yet supported,
#' `pattern`/`replacement` must be a length 1 character vector
```

* Second: make the `validation_error()` more explicit on what's happening. On `r/R/dplyr-funcs-string.R`:
```
if (length(pattern) != 1) {
validation_error(paste("Multiple replacements not supported,",
"`pattern` must be a length 1 character vector"))
}
if (length(replacement) != 1) {
validation_error(paste("Multiple replacements not supported,",
"`replacement` must be a length 1 character vector"))
}
```

I'm about to submit a PR. But first, I would like to confirm some minor things: (1) does the test file update automatically when I run `devtools::test()`? (I can't test my changes right now), (2) is there any other test or change I should make before submitting the PR?, (3) on `r/R/dplyr-funcs-doc.R` I wrote "not supported yet". Will this feature be implemented in the future or should I change it to "not supported"?

### Component(s)

R

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.