thisisnic commented on PR #41223:
URL: https://github.com/apache/arrow/pull/41223#issuecomment-2064355518

   This is what I was referring to with "not supported in arrow" 
@nealrichardson though I hadn't realised it already works really well when 
calling functions via `mutate()` in terms of reporting the failed function, so 
things might be fine as-is, though printing out which function doesn't have 
bindings would be a nice-to-have.
   
   ``` r
   library(arrow)
   library(dplyr)
   
   single_transform <- function(x){
     # this function does have bindings
     stringr::str_remove_all(x, "[aeiou]")
   }
   
   # succeeds
   tibble::tibble(x = c("Foo", "Bar", "Baz", "Qux")) %>%
     arrow_table() %>%
     mutate(y = single_transform(x)) %>%
     collect()
   #> # A tibble: 4 × 2
   #>   x     y    
   #>   <chr> <chr>
   #> 1 Foo   F    
   #> 2 Bar   Br   
   #> 3 Baz   Bz   
   #> 4 Qux   Qx
   
   single_transform2 <- function(x){
     # this function doesn't have bindings
     stringr::str_to_sentence(x)
   }
   
   tibble::tibble(x = c("Foo", "Bar", "Baz", "Qux")) %>%
     arrow_table() %>%
     mutate(y = stringr::str_to_sentence(x)) %>%
     collect()
   #> Warning: Expression stringr::str_to_sentence(x) not supported in Arrow; 
pulling
   #> data into R
   #> # A tibble: 4 × 2
   #>   x     y    
   #>   <chr> <chr>
   #> 1 Foo   Foo  
   #> 2 Bar   Bar  
   #> 3 Baz   Baz  
   #> 4 Qux   Qux
   
   tibble::tibble(x = c("Foo", "Bar", "Baz", "Qux")) %>%
     arrow_table() %>%
     mutate(y = single_transform2(x)) %>%
     collect()
   #> Warning: Expression single_transform2(x) not supported in Arrow; pulling 
data
   #> into R
   #> # A tibble: 4 × 2
   #>   x     y    
   #>   <chr> <chr>
   #> 1 Foo   Foo  
   #> 2 Bar   Bar  
   #> 3 Baz   Baz  
   #> 4 Qux   Qux
   ```
   


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