-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
opt: prevent null-rejection cycle with RightJoin #92102
Conversation
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.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)
-- commits
line 11 at r1:
nit: CommuteRightJoin -> CommuteLeftJoin (throughout this paragraph)
The null-rejection rules that simplify outer joins ignore RightJoin expressions because the `CommuteRightJoin` rule normally converts RightJoins to LeftJoins. However, in the case when `CommuteRightJoin` is disabled, we can hit a case where an `IS NOT NULL` filter gets pushed down but then gets pulled back up by decorrelation rules when it can't simplify the RightJoin, causing a cycle. This patch fixes the problem by preventing RightJoins from requesting null-rejection when `CommuteRightJoin` is disabled. Fixes cockroachdb#91917 Release note: None
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
Previously, rytaft (Rebecca Taft) wrote…
nit: CommuteRightJoin -> CommuteLeftJoin (throughout this paragraph)
Oops, that's a good catch. CommuteRightJoin
is actually right, but I need to change it below. Done.
TFTR! |
Build failed: |
bors r+ |
Build failed (retrying...): |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from d9155e1 to blathers/backport-release-22.1-92102: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.1.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Nice find! Thanks for fixing this. |
The null-rejection rules that simplify outer joins ignore RightJoin expressions because the
CommuteRightJoin
rule normally converts RightJoins to LeftJoins. However, in the case whenCommuteRightJoin
is disabled, we can hit a case where anIS NOT NULL
filter gets pushed down but then gets pulled back up by decorrelation rules when it can't simplify the RightJoin, causing a cycle. This patch fixes the problem by preventing RightJoins from requesting null-rejection whenCommuteRightJoin
is disabled.Fixes #91917
Release note: None