minor: Improve equivalence handling of joins#16893
Merged
Merged
Conversation
Contributor
Author
|
@comphead @xudong963 do you have any time to review this? |
comphead
approved these changes
Jul 28, 2025
comphead
left a comment
Contributor
There was a problem hiding this comment.
Thanks @berkaysynnada that is lgtm, however I'm not quite sure how the test asserts the changes? Should it be some performance benefit of using prefixed orderings for outer joins?
Contributor
|
This PR seems stuck -- is it still waiting on some tests or is it ready to merge? |
xudong963
self-requested a review
August 6, 2025 01:46
Contributor
Author
|
I just added a test showing the purpose of this change |
Contributor
|
🎉 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Which issue does this PR close?
Rationale for this change
While building the equivalence properties of joins, we can identify more precise orderings when the join is a LeftJoin and the join algorithm preserves the order of the left input (and similarly for RightJoin with the right input).
What changes are included in this PR?
In addition to the main change described above:
hash_join_swap_subrulewith the actual optimizer rule it represents, as this is the rule we should be testingbuild_sides_record_batchesutility to include a new column that generates randomly ordered data. While not yet used, this column will be useful for future fuzz testing of joins.reorder_output_after_swap()andswap_join_projection(), as these functions are likely to be needed across optimizer rules.Are these changes tested?
Are there any user-facing changes?