-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
SQL: Plan non-equijoin conditions as cross join followed by filter. #14978
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Druid has previously refused to execute joins with non-equality-based conditions. This was well-intentioned: the idea was to push people to write their queries in a different, hopefully more performant way. But as we're moving towards fuller SQL support, it makes more sense to allow these conditions to go through with the best plan we can come up with: a cross join followed by a filter. In some cases this will allow the query to run, and people will be happy with that. In other cases, it will run into resource limits during execution. But we should at least give the query a chance. This patch also updates the documentation to explain how people can tell whether their queries are being planned this way.
asdf2014
reviewed
Sep 15, 2023
Co-authored-by: Benedict Jin <asdf2014@apache.org>
github-actions
bot
added
the
Area - MSQ
For multi stage queries - https://github.com/apache/druid/issues/12262
label
Sep 15, 2023
LakshSingla
approved these changes
Sep 16, 2023
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.
LGTM, We should also ship #14976 along with the same releases, since the doc changes in this PR reference the IS_NOT_DISTINCT_FROM function added in that patch.
somu-imply
added a commit
to somu-imply/druid
that referenced
this pull request
Sep 22, 2023
…ilter. (apache#14978)" This reverts commit 4f498e6.
10 tasks
somu-imply
added a commit
to somu-imply/druid
that referenced
this pull request
Sep 22, 2023
…ilter. (apache#14978)" This reverts commit 4f498e6.
10 tasks
somu-imply
added a commit
to somu-imply/druid
that referenced
this pull request
Sep 22, 2023
…ilter. (apache#14978)" This reverts commit 4f498e6.
10 tasks
abhishekagarwal87
added a commit
that referenced
this pull request
Nov 29, 2023
…15302) This PR revives #14978 with a few more bells and whistles. Instead of an unconditional cross-join, we will now split the join condition such that some conditions are now evaluated post-join. To decide what sub-condition goes where, I have refactored DruidJoinRule class to extract unsupported sub-conditions. We build a postJoinFilter out of these unsupported sub-conditions and push to the join.
yashdeep97
pushed a commit
to yashdeep97/druid
that referenced
this pull request
Dec 1, 2023
…pache#15302) This PR revives apache#14978 with a few more bells and whistles. Instead of an unconditional cross-join, we will now split the join condition such that some conditions are now evaluated post-join. To decide what sub-condition goes where, I have refactored DruidJoinRule class to extract unsupported sub-conditions. We build a postJoinFilter out of these unsupported sub-conditions and push to the join.
yashdeep97
pushed a commit
to yashdeep97/druid
that referenced
this pull request
Dec 1, 2023
…pache#15302) This PR revives apache#14978 with a few more bells and whistles. Instead of an unconditional cross-join, we will now split the join condition such that some conditions are now evaluated post-join. To decide what sub-condition goes where, I have refactored DruidJoinRule class to extract unsupported sub-conditions. We build a postJoinFilter out of these unsupported sub-conditions and push to the join.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area - Batch Ingestion
Area - Documentation
Area - MSQ
For multi stage queries - https://github.com/apache/druid/issues/12262
Area - Querying
Area - SQL
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Druid has previously refused to execute joins with non-equality-based conditions. This was well-intentioned: the idea was to push people to write their queries in a different, hopefully more performant way.
But as we're moving towards fuller SQL support, it makes more sense to allow these conditions to go through with the best plan we can come up with right now: a cross join followed by a filter. In some cases this will allow the query to run, and people will be happy with that. In other cases, it will run into resource limits during execution. But we should at least give the query a chance.
This patch also updates the documentation to explain how people can tell whether their queries are being planned this way.