-
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: fix panic in GenerateLookupJoin #59741
Conversation
18b4358
to
1288a1d
Compare
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! 1 of 0 LGTMs obtained (waiting on @rytaft)
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 4 of 4 files at r1, 2 of 2 files at r2.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @mgartner)
pkg/sql/opt/xform/testdata/rules/join, line 3178 at r1 (raw file):
# Regression test for #59738. findConstantFilterCols should not panic when # it finds constant filters that are not in the scanned table.
[nit] this comment is a bit confusing. Instead of "scanned table", maybe say "index of the lookup join"?
In cockroachdb#57690 a new code path was introduced from `findConstantFilterCols` from `GenerateLookupJoins`. This new code path made it possible for the filters passed to `findConstantFilterCols` to contain columns that are not part of the given table. This violated the assumption that the filter only contains columns in the given table and caused a panic. This commit fixes the issue by neglecting constant filters for columns not in the given table. Fixes cockroachdb#59738 Release note (bug fix): A bug has been fixed that caused errors when joining two tables when one of the tables had a computed column. This bug was present since version 21.1.0-alpha.2 and not present in any production releases.
Release note: None
1288a1d
to
7612677
Compare
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! 2 of 0 LGTMs obtained (waiting on @rytaft)
pkg/sql/opt/xform/testdata/rules/join, line 3178 at r1 (raw file):
Previously, rytaft (Rebecca Taft) wrote…
[nit] this comment is a bit confusing. Instead of "scanned table", maybe say "index of the lookup join"?
Done.
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 3 files at r3, 2 of 2 files at r4.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 2 stale)
TFTRs! bors r+ |
Build succeeded: |
opt: fix panic in GenerateLookupJoin
In #57690 a new code path was introduced from
findConstantFilterCols
from
GenerateLookupJoins
. This new code path made it possible for thefilters passed to
findConstantFilterCols
to contain columns that arenot part of the given table. This violated the assumption that the
filter only contains columns in the given table and caused a panic. This
commit fixes the issue by neglecting constant filters for columns not in
the given table.
Fixes #59738
Release note (bug fix): A bug has been fixed that caused errors when
joining two tables when one of the tables had a computed column. This
bug was present since version 21.1.0-alpha.2 and not present in any
production releases.
opt: move findConstantFilterCols to general_funcs.go
Release note: None