Giter Site home page Giter Site logo

Add support for cross joins about tidyquery HOT 4 CLOSED

ianmcook avatar ianmcook commented on June 5, 2024 1
Add support for cross joins

from tidyquery.

Comments (4)

antonio-yu avatar antonio-yu commented on June 5, 2024

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

from tidyquery.

ianmcook avatar ianmcook commented on June 5, 2024

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.

from tidyquery.

antonio-yu avatar antonio-yu commented on June 5, 2024

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?

from tidyquery.

ianmcook avatar ianmcook commented on June 5, 2024

@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.

from tidyquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.