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

Show source when trying to materialize a lazy data frame #432

Closed
krlmlr opened this issue Dec 31, 2024 · 1 comment · Fixed by #456
Closed

Show source when trying to materialize a lazy data frame #432

krlmlr opened this issue Dec 31, 2024 · 1 comment · Fixed by #456
Milestone

Comments

@krlmlr
Copy link
Member

krlmlr commented Dec 31, 2024

The error should contain the source of the call. How to achieve?

library(tidyverse)
library(duckplyr)


dd <- tibble(x = 1:100, y = rep(LETTERS[1:20], 5))


write_csv(dd, "test.csv")


## open file without reading it into memory and perform aggregations

df <- duck_file("test.csv", "read_csv")

df_stat <- df |>
  group_by(y) |>
  summarise(total = sum(x)) |>
  ungroup()
#> Error: Materialization is disabled, use collect() or as_tibble() to materialize

Created on 2024-12-31 with reprex v2.1.1

@krlmlr krlmlr added this to the 1.0.0 milestone Dec 31, 2024
@krlmlr
Copy link
Member Author

krlmlr commented Jan 11, 2025

Now, PR incoming:

library(tidyverse)

dd <- tibble(x = 1:100, y = rep(LETTERS[1:20], 5))


readr::write_csv(dd, "test.csv")


## open file without reading it into memory and perform aggregations

df <- duckplyr::duck_file("test.csv", "read_csv")

df_stat <- df |>
  group_by(y) |>
  summarise(total = sum(x)) |>
  ungroup()
#> Error in `group_by()`:
#> ! This operation cannot be carried out by DuckDB, and the input is a
#>   lazy duckplyr frame.
#> • Try `summarise(.by = ...)` or `mutate(.by = ...)` instead of `group_by()` and
#>   `ungroup()`.
#> • Use `compute(lazy = FALSE)` to materialize to temporary storage and continue
#>   with duckplyr.
#> • See the "Eager and lazy" section in `?duck_tbl()` for other options.

Created on 2025-01-11 with reprex v2.1.1

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