ianmcook commented on a change in pull request #10190:
URL: https://github.com/apache/arrow/pull/10190#discussion_r623928115



##########
File path: r/R/dplyr.R
##########
@@ -410,6 +410,17 @@ build_function_list <- function(FUN) {
         options = list(null_encoding_behavior = null_encoding_behavior)
       )
     },
+    strsplit = function(x, split, fixed = FALSE, perl = FALSE, useBytes = 
FALSE){
+      
+      regex_metachars <- c(".", "\\", "|", "(", ")", "[", "{", "^", "$", "*", 
"+", "?")
+      is_regex <- any(map_lgl(regex_metachars, ~grepl(.x, split, fixed = 
TRUE)))
+      
+      # if !fixed but no regex metachars in split pattern, allow to proceed as 
split isn't regex
+      if(!fixed && is_regex || perl){
+        stop("regular expression matching not supported in strsplit for 
Arrow", call. = FALSE)
+      }

Review comment:
       I think it would be best to leave `perl` out of this check.
   
   In base R, `strsplit()` ignores `perl = TRUE` with this warning when `fixed` 
is `TRUE`:
   >`argument 'perl = TRUE' will be ignored`
   
   I think it would be best to do the same here—just below this, issue a 
warning just like that if `fixed && perl`.
   
   If `is_regex` is `FALSE` then it doesn't matter whether `perl` is `TRUE` or 
`FALSE`—it won't make any difference. So I don't it's necessary to do any 
further handling of `perl` besides issuing the warning I describe above.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to