-
Notifications
You must be signed in to change notification settings - Fork 179
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
"! Can't extract an environment from a call." when using dplyr::desc()
.
#1548
Comments
dplyr::desc()
.
I'm also encountering this in a mtcars <- mtcars |>
tibble::rownames_to_column("model")
mtcars_lzy <- conn |>
copy_to(mtcars, temporary = TRUE)
top_hp <- mtcars_lzy |>
select(model, mpg, hp, disp) |>
slice_max(n = 4L, order_by = hp)
bottom_wt <- mtcars_lzy |>
select(model, mpg, cyl, wt) |>
slice_min(n =15L, order_by = wt)
semi_join(top_hp, bottom_wt, by = "model")
# Error in `get_env()`:
# an't extract an environment from a call.
# Run `rlang::last_trace()` to see where the error occurred. Per the sql("`RHS`")$col01 <= 15L Rendering either of It seems to work, however, if I avoid top_hp <- mtcars_lzy |>
select(model, mpg, hp, disp) |>
arrange(desc(hp)) |>
head(4)
bottom_wt <- mtcars_lzy |>
select(model, mpg, cyl, wt) |>
arrange(wt) |>
head(15)
semi_join(top_hp, bottom_wt, by = "model")
# # Source: SQL [?? x 4]
# # Database: MyConnection
# # Ordered by: desc(hp)
# model mpg hp disp
# <chr> <dbl> <dbl> <dbl>
# 1 Ford Pantera L 15.8 264 351 |
Slightly simpler example avoiding t1 = conn |> tbl(sql('SELECT 1 AS a, 0 AS v UNION ALL SELECT 2 AS a, 0 AS v'))
t2 = conn |> tbl(sql('SELECT 1 AS a, 1 AS v UNION ALL SELECT 3 AS a, 1 AS v'))
# plain semi_join works
invisible(semi_join(t1, t2, by='a'))
# as does an arrange() approach [incl. desc(v)]
semi_join(t1, head(arrange(t2, v), 2), by='a')
# but fails on a continued query why 'y' is a slice_max()
semi_join(t1, slice_max(t2, v, n=2), by='a')
# Error in `get_env()`:
# ! Can't extract an environment from a call.
# Run `rlang::last_trace()` to see where the error occurred. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure if this is a bug or not, but I have run into the following issue.
My actual workflow is with company data but I have managed to reproduce it with a pipeline that is close enough:
This works:
Returns:
This does not work:
Returns:
The text was updated successfully, but these errors were encountered: