-
Notifications
You must be signed in to change notification settings - Fork 5.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 for correlated subqueries #4017
Comments
Relates to #2878 |
Greetings all! I note that the referenced issue was closed for 0.132... just wondering if any progress has been made on supporting correlated subqueries? |
@matthewwardrop : yes, @kokosing is actively working on this. Expect PRs soon! |
Excellent news! Thanks kokosing :). Looking forward to it being deployed :). |
@martint FYI Once the initial support correlated subqueries (see https://github.com/prestodb/presto/wiki/Correlated-subqueries) is done, our (roadmap) next goals are:
|
Also this is on our short term road map: #6638 |
I have case like this
It push me same exception. |
Yes. Your case seems to be a great example to use LATERAL join which is also in flight. I would rewrite your query to something like:
|
Hi All, Out of curiosity, will a coorelated subquery join such as this work in the future as part of your ongoing support for coorelated subqueries?
|
@brandynabrams Currently I do work on subqueries which are using Generally, since all the subqueries in TPCH and TPCDS extending support for subqueries become less important and we switched to things that may affect broader user audience (like join reordering). Anyway, still I feel somehow personally related and engaged with subqueries, push the support for them in my spare time. Once I finish #8435, I could start work on subqueries with |
Hey @kokosing, Thanks for the reply! Yes, I agree tasks like join reordering (which would be awesome) are more important. I'm very used to Postgres, and subqueries that use limit & order by was used very frequently by myself & my team. Some of our micro services still use postgres, but our data warehouse (treasure data) uses hive & presto combo.. and this type of unsupported subquery makes its frustrating sometimes.. currently my work around is a window function w/ rank() & partition by or joining the table to itself with a max() function, but these type of subqueries that involve limit / order by seem to be way simpler and provide cleaner code.. (if you use other syntax that is more performant / better to use.. i'm happy to try it out) But yah, long story short, if you are able to find time to add these types of subqueries.. that would be AWESOME! thanks man. |
Todays support for correlated subqueries is decent in Presto. There are still some subquery patterns which are still not supported, but these should be tracked as separate issues. |
hey @kokosing which connectors support correlated subqueries in presto? |
All. Because subqueries are supported by query planner and execution engine. I kind of do not understand question. If you mean which support subquery pushdown then none. |
@kokosing yeah. When I run queries like select foo from table1 where bar in (select bar from table2 where qux = 'qux') presto does a full table scan of |
Can you please open separate issue for that and please attach output of the EXPLAIN (distributed) of the query |
@aandis Presto needs a full table scan because the condition You have the options:
(No need for new separate issue, since this is already covered by #7428 and #8680) |
@findepi yeah I've tried option 1 in the past. It has it's own problems because the parameter list may exceed max query length/parameter length presto allows. So you have to split it in batches and run multiple queries which is additional non core application logic. It's nice to know #7428 will fix this. I'll keep an eye out. |
It relates to subqueries used in IN, EXISTS predicates and scalar subqueries.
The text was updated successfully, but these errors were encountered: