-
Notifications
You must be signed in to change notification settings - Fork 178
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
window_order crashing when deleting the variable that I am ordering for #1103
Comments
It isn't intentional but it kind of worked accidentally before. @catalamarti We'll try to fix this soon. As a workaround you could remove the window order by using an empty A reprex library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)
memdb_frame(x = 1, y = 1) %>%
window_order(y) %>%
select(-y) %>%
compute()
#> Error in `window_order()`:
#> ℹ In argument: `y`
#> Caused by error:
#> ! Object `y` not found.
#> Backtrace:
#> ▆
#> 1. ├─... %>% compute()
#> 2. ├─dplyr::compute(.)
#> 3. ├─dbplyr:::compute.tbl_sql(.)
#> 4. │ └─... %>% window_order(!!!op_sort(x))
#> 5. └─dbplyr::window_order(., !!!op_sort(x))
#> 6. └─dbplyr:::partial_eval_dots(.data, ..., .named = FALSE)
#> 7. └─dbplyr:::partial_eval_quo(dot, .data, error_call, dot_name, was_named[[i]])
#> 8. ├─rlang::try_fetch(...)
#> 9. │ ├─base::tryCatch(...)
#> 10. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 11. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#> 12. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#> 13. │ └─base::withCallingHandlers(...)
#> 14. └─dbplyr::partial_eval(get_expr(x), data, get_env(x), error_call = error_call)
#> 15. └─dbplyr:::partial_eval_sym(call, data, env)
#> 16. └─cli::cli_abort("Object {.var {name}} not found.", call = NULL)
#> 17. └─rlang::abort(...) Created on 2023-01-19 with reprex v2.0.2 @hadley The issue is that I would propose:
library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)
lf <- lazy_frame(x = 1, y = 1) %>%
window_order(y) %>%
select(-y)
# CRAN
lf$lazy_query$order_vars
#> [[1]]
#> <quosure>
#> expr: ^y
#> env: 0x7fd5e6bb78f8
# This should rather be empty This would also allow to simplify |
Using empty window_order() worked fine. It would be nice if it is fixed but as far as there is a solution it is fine. |
@mgirlich that proposal sounds good to me. |
@catalamarti The PR should fix your issue. If you want to try it out install via |
Before when using window_order I could do something for example:
Now when the variable that you ordered for is not present it crashes.
Example with dbplyr 2.0.0:
![working](https://user-images.githubusercontent.com/18575244/213242655-522d0de7-6747-42c8-92ce-66534c40c05f.png)
Now with the new version dbplyr 2.3.0:
![not_working](https://user-images.githubusercontent.com/18575244/213242638-d128fe38-2a99-4659-858c-066633b7e233.png)
As far as I know there is no way to delete the ordering so I am stuck and I have to use the previous version.
Is this something on purpose? Then how we can solve this error?
The text was updated successfully, but these errors were encountered: