Skip to content
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

Add support for cross joins #11

Closed
ianmcook opened this issue Jan 16, 2020 · 4 comments
Closed

Add support for cross joins #11

ianmcook opened this issue Jan 16, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@ianmcook
Copy link
Owner

After the fix to tidyverse/dplyr#4206 is on CRAN, use it to enable cross joins by specifying by = character().

@ianmcook ianmcook added the enhancement New feature or request label Jan 16, 2020
@antonio-yu
Copy link

cross join does not work in query() functions
Codes like this does not work.
query (' select * from df1 cross join df2 where df1. = df2. ')

@ianmcook
Copy link
Owner Author

ianmcook commented Jan 9, 2023

In the version of dplyr currently on CRAN, it is possible to do a cross join with full_join(..., by = character()).

dplyr 1.1.0 (due to be submitted in CRAN in late January) will add a cross_join() function and soft-deprecate the above syntax (tidyverse/dplyr#6612).

I intend to make tidyquery require dplyr >= 1.1.0 and implement a translation of SQL CROSS JOIN to dplyr cross_join().
Update: See my comment below.

queryparser already supports cross joins so this does not require any work there.

@antonio-yu
Copy link

I intend to make tidyquery require dplyr >= 1.1.0 and implement a translation of SQL CROSS JOIN to dplyr cross_join().

queryparser already supports cross joins so this does not require any work there.

Does it mean CROSS JOIN will come true in tidyquery after dplyr >= 1.1.0 is released?

@ianmcook
Copy link
Owner Author

ianmcook commented Jan 12, 2023

@antonio-yu I went ahead and added support for cross joins in 537eb35. Please test it out and let me know if it works for you using the version of tidyquery on GitHub: remotes::install_github("ianmcook/tidyquery")

Cross joins should work in tidyquery now as long as you are using dplyr 1.0.0 or higher. I added code that detects what version of dplyr you are using. If are using an old version of dplyr that does not have the cross_join() function, then it translates SQL cross join to full_join(..., by = character()). If you are using the new dplyr that has cross_join(), then it translates to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants