[ 
https://issues.apache.org/jira/browse/ARROW-17948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicola Crane updated ARROW-17948:
---------------------------------
    Description: 
ARROW-14071 and ARROW-16444 cover evaluating user-defined functions in 
different ways, but could we extend this behaviour so it be possible to 
evaluate generics?  Here's an example of how that works in dplyr from a [Stack 
Overflow 
question|https://stackoverflow.com/questions/73950714/is-it-possible-to-use-generics-in-apache-arrow]:


{code:r}
library(dplyr)

df <- data.frame(a = c("these", "are", "some", "strings"),
                 b = 1:4)

boop <- function(x, ...) UseMethod("boop", x)

boop.numeric <- function(x) mean(x, na.rm = TRUE)

boop.character <- function(x) mean(nchar(x), na.rm =TRUE )

df %>% summarise(across(everything(), boop))
{code}


  was:
ARROW-14071 covers evaluating user-defined functions, but once this is 
implemented, would it be possible to evaluate generics?  Here's an example of 
how that works in dplyr from a [Stack Overflow 
question|https://stackoverflow.com/questions/73950714/is-it-possible-to-use-generics-in-apache-arrow]:


{code:r}
library(dplyr)

df <- data.frame(a = c("these", "are", "some", "strings"),
                 b = 1:4)

boop <- function(x, ...) UseMethod("boop", x)

boop.numeric <- function(x) mean(x, na.rm = TRUE)

boop.character <- function(x) mean(nchar(x), na.rm =TRUE )

df %>% summarise(across(everything(), boop))
{code}



> [R] arrow_eval user-defined generic functions  
> -----------------------------------------------
>
>                 Key: ARROW-17948
>                 URL: https://issues.apache.org/jira/browse/ARROW-17948
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Nicola Crane
>            Priority: Major
>
> ARROW-14071 and ARROW-16444 cover evaluating user-defined functions in 
> different ways, but could we extend this behaviour so it be possible to 
> evaluate generics?  Here's an example of how that works in dplyr from a 
> [Stack Overflow 
> question|https://stackoverflow.com/questions/73950714/is-it-possible-to-use-generics-in-apache-arrow]:
> {code:r}
> library(dplyr)
> df <- data.frame(a = c("these", "are", "some", "strings"),
>                  b = 1:4)
> boop <- function(x, ...) UseMethod("boop", x)
> boop.numeric <- function(x) mean(x, na.rm = TRUE)
> boop.character <- function(x) mean(nchar(x), na.rm =TRUE )
> df %>% summarise(across(everything(), boop))
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to