You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Gosling-dude (via GitHub)" <gi...@apache.org> on 2026/09/07 05:57:03 UTC
[PR] GH-33432: [R] Match base/stringr semantics for str_replace() with NA replacement [arrow]
Gosling-dude opened a new pull request, #51197:
URL: https://github.com/apache/arrow/pull/51197
### Rationale for this change
`base::sub()`/`gsub()` and `stringr::str_replace()`/`str_replace_all()` set the whole
element to `NA` when the replacement is `NA` and the pattern matches. The Acero
`replace_substring[_regex]` kernels don't support that and splice a literal `"NA"`
into the string, e.g. `str_replace("one", "o", NA_character_)` returns `"NAne"`
instead of `NA`.
### What changes are included in this PR?
Special-case an `NA` `replacement` in the shared `sub`/`gsub`/`str_replace`/`str_replace_all`
binding helper and rewrite it as `if_else(<pattern matches>, NA, x)` using
`match_substring[_regex]`. Covers regex, fixed, and ignore-case patterns.
### Are these changes tested?
Yes — new test in `test-dplyr-funcs-string.R` comparing against base/stringr for
regex/fixed/ignore-case, empty strings, and `NA` input.
### Are there any user-facing changes?
Bug fix only; `str_replace(x, p, NA)` now returns `NA` on match instead of a
corrupted string.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-33432: [R] Match base/stringr semantics for str_replace() with NA replacement [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #51197:
URL: https://github.com/apache/arrow/pull/51197#issuecomment-5565740711
:warning: GitHub issue #33432 **has been automatically assigned in GitHub** to PR creator.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-33432: [R] Match base/stringr semantics for str_replace() with NA replacement [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on PR #51197:
URL: https://github.com/apache/arrow/pull/51197#issuecomment-5645561812
@Gosling-dude Worth opening a GitHub issues, yeah, cheers!
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-33432: [R] Match base/stringr semantics for str_replace() with NA replacement [arrow]
Posted by "Gosling-dude (via GitHub)" <gi...@apache.org>.
Gosling-dude commented on PR #51197:
URL: https://github.com/apache/arrow/pull/51197#issuecomment-5642772773
The failing `AMD64 Windows R release` check is unrelated to this change — it's failing at CI setup, before the R build even starts: the pinned MinIO archive it fetches (`minio.RELEASE.2025-01-20T14-49-07Z`) now 410s on `dl.min.io`, so a re-run won't help. This looks like a repo-wide CI infra issue affecting Windows R jobs generally. @thisisnic, since you've already approved — is this a known issue, or should I flag it elsewhere (dev@arrow.apache.org / a separate JIRA)?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-33432: [R] Match base/stringr semantics for str_replace() with NA replacement [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic merged PR #51197:
URL: https://github.com/apache/arrow/pull/51197
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-33432: [R] Match base/stringr semantics for str_replace() with NA replacement [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on PR #51197:
URL: https://github.com/apache/arrow/pull/51197#issuecomment-5645959172
Never mind, already tracking in https://github.com/apache/arrow/issues/47908
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org