thisisnic commented on a change in pull request #11473:
URL: https://github.com/apache/arrow/pull/11473#discussion_r732591008



##########
File path: r/R/dplyr-functions.R
##########
@@ -645,6 +645,27 @@ nse_funcs$str_ends <- function(string, pattern, negate = 
FALSE) {
   out
 }
 
+nse_funcs$str_count <- function(string, pattern) {
+  opts <- get_stringr_pattern_options(enexpr(pattern))
+  if (length(pattern) > 1) {
+    arrow_not_supported("Pattern argument longer than 1")
+  }

Review comment:
       ```suggestion
     if !is.string(pattern) {
       arrow_not_supported("`pattern` must be a length 1 character vector; 
other values")
     }
   ```
   
   Small tweak - using "must" phrasing as per tidyverse error styling.  The 
above message looks weird but results in:
   
   `Warning: In str_count(x, pattern = c("a", "b")), `pattern` must be a length 
1 character vector; other values not supported by Arrow; pulling data into R`
   
   Also, `is.string()` gives you type and length checking in 1 function.




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