Copilot commented on code in PR #51168:
URL: https://github.com/apache/arrow/pull/51168#discussion_r3943872198
##########
r/R/dplyr-funcs-string.R:
##########
@@ -362,10 +362,14 @@ register_bindings_string_regex <- function() {
arrow_r_string_replace_function <- function(max_replacements) {
function(pattern, replacement, x, ignore.case = FALSE, fixed = FALSE) {
if (length(pattern) != 1) {
- validation_error("`pattern` must be a length 1 character vector")
+ validation_error(
+ "Multiple replacements not supported: `pattern` must be a length 1
character vector"
+ )
}
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"
+ )
Review Comment:
The PR updates the error text, but there doesn’t appear to be any test
asserting the new "Multiple … not supported:" prefix (current tests only match
the trailing substring). Consider tightening/adding a test expectation so the
new wording doesn’t regress.
##########
r/R/dplyr-funcs-string.R:
##########
@@ -362,10 +362,14 @@ register_bindings_string_regex <- function() {
arrow_r_string_replace_function <- function(max_replacements) {
function(pattern, replacement, x, ignore.case = FALSE, fixed = FALSE) {
if (length(pattern) != 1) {
- validation_error("`pattern` must be a length 1 character vector")
+ validation_error(
+ "Multiple replacements not supported: `pattern` must be a length 1
character vector"
+ )
}
Review Comment:
The `length(pattern) != 1` validation error says "Multiple replacements not
supported" even for `str_remove()`/`str_remove_all()`, where the user only
supplies `pattern` (no replacement). This makes the error message misleading
and inconsistent with the new docs notes that call this out as multiple
patterns.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]