Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with summarise in Arrow #201

Open
thisisnic opened this issue Oct 19, 2022 · 2 comments
Open

Error with summarise in Arrow #201

thisisnic opened this issue Oct 19, 2022 · 2 comments

Comments

@thisisnic
Copy link
Contributor

library(arrow)
library(substrait)
library(dplyr)

# works in dplyr
mtcars %>%
  select(mpg, cyl, vs, am, gear, hp) %>%
  group_by(am) %>% summarise(s = sum(hp)) %>%
  collect()
#> # A tibble: 2 × 2
#>      am     s
#>   <dbl> <dbl>
#> 1     0  3045
#> 2     1  1649

# works in duckdb
mtcars %>%
  duckdb_substrait_compiler() %>%
  select(mpg, cyl, vs, am, gear, hp) %>%
  group_by(am) %>% summarise(s = sum(hp)) %>%
  collect()
#> # A tibble: 2 × 2
#>      am     s
#>   <dbl> <dbl>
#> 1     1  1649
#> 2     0  3045

# doesn't work in arrow
mtcars %>%
  arrow_substrait_compiler() %>%
  select(mpg, cyl, vs, am, gear, hp) %>%
  group_by(am) %>% summarise(s = sum(hp)) %>%
  collect()
#> Error in sum(hp): invalid 'type' (list) of argument
@paleolimbot
Copy link
Contributor

That's because there are no aggregation functions registered for arrow! It's basically trying to do:

base::sum(substrait:::simple_integer_field_reference(0))
#> Error in base::sum(substrait:::simple_integer_field_reference(0)): invalid 'type' (list) of argument

Created on 2022-10-19 by the reprex package (v2.0.1)

...because sum() isn't defined in arrow_funs (but it is in duckdb_funs).

@thisisnic
Copy link
Contributor Author

Aha, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants