Gosling-dude commented on issue #33432:
URL: https://github.com/apache/arrow/issues/33432#issuecomment-5565340500

   Hi @thisisnic - I'd like to champion this one.
   
   Plan, following Neal's earlier comment: special-case a missing `replacement` 
in the R bindings rather than calling the replace kernel. When `replacement` is 
`NA_character_`, t`ranslate str_replace(x, pattern, NA) / str_replace_all(x, 
pattern, NA) `to roughly:
   
   `if_else(str_detect(x, pattern), NA_character_, x)`
   
   so the whole string becomes NA when the pattern matches, matching 
stringr/base R (fixed() and regex patterns both).
   
   Changes would land in r/R/dplyr-funcs-string.R with tests in 
r/tests/testthat/test-dplyr-funcs-string.R covering regex + fixed patterns, no 
match, and already-NA input. Will open a PR as `GH-33432: [R] Match stringr 
behavior for str_replace with NA replacement` shortly. Let me know if you'd 
prefer the fix at the C++ kernel level instead.


-- 
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]

Reply via email to