-
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
exec: fix LIKE handling for patterns like '%a%' #38911
exec: fix LIKE handling for patterns like '%a%' #38911
Conversation
GetLikeOperator was choosing the wrong operator when both the first and last characters of the pattern were wildcards. I fixed this logic and improved the unit tests to cover GetLikeOperator rather than just the underlying operators. While I was here I also added better handling for the case where there are no wildcards, i.e. exact string matching. Fixes cockroachdb#38888 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.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)
bors r+ |
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 @solongordon)
pkg/sql/exec/like_ops_test.go, line 78 at r1 (raw file):
}, { pattern: "%e%",
We should test "mixed" cases like %e_
and _e%
. It seems to me that such cases are not handled (or I'm not seeing it).
38908: exec: Fix type ambiguity error out for IN and NOT IN. r=jordanlewis a=rohany A previous PR introduced this error, this PR fixes it and adds a regression test. Release note: None 38911: exec: fix LIKE handling for patterns like '%a%' r=solongordon a=solongordon GetLikeOperator was choosing the wrong operator when both the first and last characters of the pattern were wildcards. I fixed this logic and improved the unit tests to cover GetLikeOperator rather than just the underlying operators. While I was here I also added better handling for the case where there are no wildcards, i.e. exact string matching. Fixes #38888 Release note: None Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu> Co-authored-by: Solon Gordon <solon@cockroachlabs.com>
Build succeeded |
GetLikeOperator was choosing the wrong operator when both the first and
last characters of the pattern were wildcards. I fixed this logic and
improved the unit tests to cover GetLikeOperator rather than just the
underlying operators.
While I was here I also added better handling for the case where there
are no wildcards, i.e. exact string matching.
Fixes #38888
Release note: None