thisisnic commented on PR #41223:
URL: https://github.com/apache/arrow/pull/41223#issuecomment-2059537731
This is cool. A few additional tests it might be worth chucking in to show
how it works (or in the docs somewhere?) that are illustrative of a few things
I wanted to check:
``` r
library(dplyr)
library(arrow)
single_transform <- function(x){
str_remove_all(x, "[aeiou]")
}
multistep_transform <- function(x){
y = stringr::str_replace_all(x, "B", "c")
z = str_remove_all(y, "[aeiou]")
z2 = str_to_upper(z)
z2
}
multistep_transform_in_one <- function(x){
str_to_upper(str_remove_all(stringr::str_replace_all(x, "B", "c"),
"[aeiou]"))
}
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
tibble::tibble(x = c("Foo", "Bar", "Baz", "Qux")) %>%
arrow_table() %>%
mutate(y = multistep_transform(x)) %>%
collect()
#> # A tibble: 4 × 2
#> x y
#> <chr> <chr>
#> 1 Foo F
#> 2 Bar CR
#> 3 Baz CZ
#> 4 Qux QX
tibble::tibble(x = c("Foo", "Bar", "Baz", "Qux")) %>%
arrow_table() %>%
mutate(y = multistep_transform_in_one(x)) %>%
collect()
#> # A tibble: 4 × 2
#> x y
#> <chr> <chr>
#> 1 Foo F
#> 2 Bar CR
#> 3 Baz CZ
#> 4 Qux QX
```
--
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]