We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
*_join()
select()
A *_join() followed by select() currently produces an unnecessary subquery. This can easily be combined in a single query.
library(dplyr, warn.conflicts = FALSE) library(dbplyr, warn.conflicts = FALSE) lf <- lazy_frame(x = 1, a = 1) lf2 <- lazy_frame(x = 1, b = 2) left_join(lf, lf2, by = "x") %>% select(x, b)
Currently
SELECT `x`, `b` FROM ( SELECT `LHS`.`x` AS `x`, `a`, `b` FROM `df` AS `LHS` LEFT JOIN `df` AS `RHS` ON (`LHS`.`x` = `RHS`.`x`) ) `q01`
Should be
SELECT `LHS`.`x` AS `x`, `b` FROM `df` AS `LHS` LEFT JOIN `df` AS `RHS` ON (`LHS`.`x` = `RHS`.`x`)
semi_join(lf, lf2, by = "x") %>% select(x)
SELECT `x` FROM ( SELECT * FROM `df` AS `LHS` WHERE EXISTS ( SELECT 1 FROM `df` AS `RHS` WHERE (`LHS`.`x` = `RHS`.`x`) ) ) `q01`
SELECT x FROM `df` AS `LHS` WHERE EXISTS ( SELECT 1 FROM `df` AS `RHS` WHERE (`LHS`.`x` = `RHS`.`x`) )
Created on 2022-05-10 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
A
*_join()
followed byselect()
currently produces an unnecessary subquery. This can easily be combined in a single query.Currently
Should be
Currently
Should be
Created on 2022-05-10 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: