-
Notifications
You must be signed in to change notification settings - Fork 174
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
tbl_sql()
incorrectly fails via check_dots_used()
with duckdb
#1384
Comments
Hmm, maybe |
I believe |
I'll see if I can make a reprex, but it might take me a while. |
I think this is an issue with |
Why would that be better? Wouldn't it just fail? We don't want to fail here, but support an extra argument to our method. |
This is also a problem for the Bioconductor package Organism.dplyr, where a method In the example below,
|
Here's a very simple example illustrating that foo <- function(x, ...) {
rlang::check_dots_used()
UseMethod("foo")
}
foo.bar <- function(x, ..., a = 1) {
force(a)
invisible()
}
bar <- structure(list(), class = "bar")
foo(bar)
foo(bar, a = 1)
foo(bar, b = 1)
#> Error in `foo()`:
#> ! Arguments in `...` must be used.
#> ✖ Problematic argument:
#> • b = 1
#> ℹ Did you misspell an argument name?
#> Backtrace:
#> ▆
#> 1. └─global foo(bar, b = 1)
#> 2. └─rlang (local) `<fn>`()
#> 3. └─rlang:::check_dots(env, error, action, call)
#> 4. └─rlang:::action_dots(...)
#> 5. ├─base (local) try_dots(...)
#> 6. └─rlang (local) action(...)
foo.baz <- function(x, ..., b = 1) {
force(b)
NextMethod()
}
baz <- structure(list(), class = c("baz", "bar"))
foo(baz)
foo(baz, a = 1)
foo(baz, b = 1) Created on 2023-11-02 with reprex v2.0.2 |
But Is the root cause that @krlmlr in your example, who is supposed to use the |
I believe library(rlang)
tbl <- function(x, ...) {
check_dots_used()
UseMethod("tbl")
}
tbl.duckdb_connection <- function(x, ..., cache = FALSE) {
force(cache)
NextMethod()
}
tbl.DBIConnection <- function(x, ...) {
tbl(structure(list(x), class = "src_dbi"), ...)
}
tbl.src_dbi <- function(x, ...) {
TRUE
}
tbl(structure(list(), class = c("duckdb_connection", "DBIConnection")), cache = TRUE)
#> Error in `tbl()`:
#> ! Arguments in `...` must be used.
#> ✖ Problematic argument:
#> • cache = cache
#> ℹ Did you misspell an argument name?
#> Backtrace:
#> ▆
#> 1. ├─global tbl(...)
#> 2. ├─global tbl.duckdb_connection(...)
#> 3. ├─base::NextMethod()
#> 4. └─global tbl.DBIConnection(...)
#> 5. └─global tbl(structure(list(x), class = "src_dbi"), ...)
#> 6. └─rlang (local) `<fn>`()
#> 7. └─rlang:::check_dots(env, error, action, call)
#> 8. └─rlang:::action_dots(...)
#> 9. ├─base (local) try_dots(...)
#> 10. └─rlang (local) action(...) Created on 2023-11-02 with reprex v2.0.2 |
I think I see what you're saving: because |
From https://github.com/tidyverse/dbplyr/pull/1222/files#r1374651419.
What are we missing?
Created on 2023-10-27 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: