-
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
Broaden the join types that can be used with UNNEST. #8200
Comments
This issue has been automatically marked as stale because it has not had any activity in the last 2 years. If you feel that this issue is important, just comment and the stale tag will be removed; otherwise it will be closed in 7 days. This is an attempt to ensure that our open issues remain valuable and relevant so that we can keep track of what needs to be done and prioritize the right things. |
Is there any plan for support on this to be added? |
https://stackoverflow.com/a/44927437 - Using left join is the only way to prevent unnest from dropping the rows with null values for the column that is unnested. Kindly prioritize this ask. |
Hey thanks for raising this up. I'm not aware of active development on this issue, but I'll reopen it for tracking. If it is specified in SQL spec, then I don't see a reason it should not be supported, but I'll let the committers chime in, and if they feel okay with this issue, it should be ready to pick up. |
This seems to be reasonable. But the motivation seems to be different from the original issue. I'm wondering what's the motivation for the original (with a filter on the unnest rows). |
Just to hop back onto this...
I think it would be valid SQL - conditions can be placed in a
As above, I think that the most illustrative example would be when using an |
@JonNorman The
As long as the query engine is smart enough. Presto currently has a quite naive (and inefficient) implementation of |
@rongrong I totally agree with you here and perhaps that is already happening - it just isn't clear that this is happening when writing the SQL. Theoretically I suppose we could remove general For me the argument for why we want different join types in general applies for why we'd want it when using At a high level, my motivation for raising this issue is that I it's my opinion that the semantics of a |
I agree. But again, supporting more join types is a separate topic from the example you gave, which is more related to improving UNNEST performance. Both are valid issues. Do you want to work on these? |
Hi @rongrong - apologies for dropping this one. I would like to contribute, but am not able to do so at the moment. I'm keeping this on my list though so hope to be able to at some point. Whilst I agree that they are two different issues, I think that they are closely related, and so I'd be most interested in expanding join support semantics. This is because I expect (perhaps naively!) that by allowing for explicit |
Any chance that LEFT JOIN UNNEST will be added to Presto? |
|
This is the first time I've raised an issue in this repo, please let me know if this should be raised elsewhere / stated differently / other pre-requirements.
TL;DR: When using UNNEST, joins other than CROSS JOIN should be available to limit the rows being returned.
When expanding an array (using
UNNEST and CROSS JOIN
), it is often necessary to limit the result set for each row with a subsequentwhere
clause. This can become a performance issue when the expanded array has many elements in it and there are many rows being unnested and returned before then being discarded.Currently this has to be done as follows:
I want to be able to write:
or with
inner join
.Executing the above statement produces the following error:
UNNEST on other than the right side of CROSS JOIN is not supported
.Is there a good reason for this restriction? I can't find any discussion of this in the issues or on other forums and would suggest that the expected behaviour of using different joins is clear and should be supported.
The text was updated successfully, but these errors were encountered: