Repository navigation
refactor: derive cross join equivalence properties as an inner join - #26631
Open
jayzhan211 wants to merge 3 commits into
Open
jayzhan211 wants to merge 3 commits into
jayzhan211 wants to merge 3 commits into
Conversation
jayzhan211
marked this pull request as ready for review
October 23, 2026 03:58
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?
only the last commit belongs to it.
Rationale for this change
CrossJoinExeccomputes its output facts (constants, equalities, orderings) by callingjoin_equivalence_propertieswithJoinType::Full. A cross join never pads rows with NULLs, so a full outer joinis the wrong model. Today this does not change any plan, because the current outer-join rules keep the constants
that a cross join needs. But it ties cross join to rules that are about NULL padding, and those rules are being
changed: with #26459 or #26042 merged, a query such as
sorts on
xagain even thoughx = 1still holds after the join. The cross-join cases added in #26570 fail witheither PR merged in.
What changes are included in this PR?
CrossJoinExecnow derives its equivalence properties as an inner join with no join keys, with a comment thatsays why. Nothing else changes: with no keys and no maintained input order, an inner join and a full outer join
give the same facts under the current rules.
What is the testing strategy for this PR?
The cross-join cases in
equivalence_properties.sltfrom #26570 cover this change. All sqllogictest files and thejoin and physical optimizer tests pass unchanged. I also merged #26459 and #26042 into this branch one at a time:
without this change the cross-join cases fail with an extra sort, and with it they pass.
Are there any user-facing changes?
No.