[
https://issues.apache.org/jira/browse/ARROW-18244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17628919#comment-17628919
]
Lucas Mation commented on ARROW-18244:
--------------------------------------
[~npr] OK. Then, I guess we should close this issue, since ifelse if fixed in
the dev version.
But on str_replace (and maybe this should be a ticket of it's own) it does not
replicate R's behaviuour in this case
```
q <- data.table(x=c('','1','2'))
q %>% write_dataset('q')
#in R
q %>% mutate(x2=x %>% str_replace('^\\s*$',NA_character_))
x x2
1: <NA>
2: 1 1
3: 2 2
#in arrow
q2 <- 'q' %>% open_dataset %>% mutate(x2=x %>%
str_replace('^\\s*$',NA_character_)) %>% collect
q2
x x2
1:
2: 1 1
3: 2 2
```
> [R] `mutate(x2=ifelse(x=='',NA,x))` Error: Function 'if_else' has no kernel
> matching input types
> -------------------------------------------------------------------------------------------------
>
> Key: ARROW-18244
> URL: https://issues.apache.org/jira/browse/ARROW-18244
> Project: Apache Arrow
> Issue Type: Bug
> Reporter: Lucas Mation
> Assignee: Neal Richardson
> Priority: Major
> Fix For: 11.0.0
>
>
>
> ```
> q <- data.table(x=c('','30111976','01011976'))
> q %>% write_dataset('q')
> q2 <- 'q' %>% open_dataset %>% mutate(x2=ifelse(x=='',NA,x)) %>% collect
> Error in `collect()`:
> ! NotImplemented: Function 'if_else' has no kernel matching input types
> (bool, bool, string)
> Run `rlang::last_error()` to see where the error occurred.
> ```
> In [Functions available in Arrow dplyr
> queries|https://arrow.apache.org/docs/r/reference/acero.html] it is stated
> that ifelse() is available, but the error above suggests otherwise.
> Update, "str_replace" is another function that is supposedly available in
> 10.0.0 but is not (or does not seem to be):
> ```
> q2 <- 'q' %>% open_dataset %>% mutate(x2=x %>% str_replace('',NA)) %>% collect
> Error: Expression x %>% str_replace("", NA) not supported in Arrow
> Call collect() first to pull data into R.
> ```
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)