-
Notifications
You must be signed in to change notification settings - Fork 173
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
Support join_by()
#1074
Support join_by()
#1074
Conversation
R/join-cols-compat.R
Outdated
check_dots_empty0(...) | ||
|
||
if (!is.character(vars)) { | ||
message <- glue("Join columns in `{input}` must be character vectors.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this error arise? Is it an internal error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, it is an internal error. I basically only copied over the file from dplyr https://github.com/tidyverse/dplyr/blob/main/R/join-cols.R.
return(x) | ||
check_join_by_supported <- function(by, call = caller_env()) { | ||
if (any(by$filter != "none")) { | ||
cli_abort("Rolling joins aren't supported on database backends.", call = call) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems likely we'll need to relax this on a per backend basis at some point, but I don't think we need to do it prospectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there are many backends that support ASOF style joins though. None of the common ones like Postgres, SQLite, MS SQL Server, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But at least there are usually some workarounds to get the same results. In case I need a rolling join in the database I might just implement the workaround in dbplyr 😄
@@ -284,7 +284,8 @@ sql_join_tbls <- function(con, by, na_matches = "never") { | |||
sql_expr_matches(sql(lhs[[i]]), sql(rhs[[i]]), con = con) | |||
}) | |||
} else { | |||
compare <- paste0(lhs, " = ", rhs) | |||
by$condition[by$condition == "=="] <- "=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only real change to the SQL generation right? Pretty much everything else is improved input validation and new handling of output columns?
Support for the awesome new
join_by()
clause 😄