-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 subqueries in order_by, group_by, distinct, and windows #4417
Support subqueries in order_by, group_by, distinct, and windows #4417
Conversation
Let's create a new struct called ByExpr and use the opportunity to support subqueries in both group by and order by? |
Happy to do that, only concern with doing that will be anywhere that was explicitly matching on |
1990210
to
e75984f
Compare
Alright, made some adjustments. There are three outstanding issues:
If we're good to move forward with this, then I will flesh out the tests both here and in |
Working on wrapping this up today. I'm ending up doing windows support because windows uses the same code that The big thing I'm realizing based on your comment about testing non-dynamic cases is that I definitely haven't handled the compile time builder side of things. I'm going to try to do that as well, but I'm not sure if I'll be able to pull it off w/o some tips. I'll follow up and we can see how far I get 👍 |
e75984f
to
0c43701
Compare
Still have some equivalent tests to write in ecto_sql. I'm curious if the non-dynamic/dynamic split is important to test in |
494cb6c
to
e15b707
Compare
Just commenting to point out that this should be ready to review. I can't see (for some reason) how or why the integration tests failed, but I'm assuming that it is because there are required changes in |
@zachdaniel Normally we have the PR in ecto_sql point here, then if the integration tests pass there we know we are good and leave this one alone. |
@greg-rychlewski like I'd update the |
yeah exactly |
Done :) its building now. |
c15d399
to
57fdecb
Compare
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
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.
Looks great to me. Any other comments @greg-rychlewski? :)
looks good to me :) |
💚 💙 💜 💛 ❤️ |
needed to support the work done here elixir-ecto/ecto#4417
So this seems to work without too much change required, but I do have one main misgiving: This requires a modification to
Ecto.QueryExpr
, which AFAIK is used in other places that won't be anticipate having subqueries in them.I've got a test that shows this working as-is with
ecto_sql
: elixir-ecto/ecto_sql#607