-
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
colexec: fix LIKE operators when patterns have escape characters #68289
Conversation
Release note (bug fix): Previously, CockroachDB could incorrectly evaluate LIKE expressions when the pattern contained the escape characters `\` if the expressions were executed via the vectorized engine.
Whenever we're planning a projection expression, we have 3 cases: the left is constant, the right is constants, and neither are constants. For the second case we have some optimized operators. Previously, those operators weren't exercised via the TestEval/vectorized because in the eval tests the left side is constant. This commit switches the planning to force planning of those optimized operators. This shouldn't really have an effect on planning of actual queries. This was prompted by the bug in LIKE operators that is fixed in the previous commit. Had we forced the planning for our eval tests, we would have caught it earlier. This also revealed an incompatibility for our IN operator implementation when the right side is an empty tuple which this commit also fixes. However, I don't think this scenario can be hit in production because the optimizer folds such an expression into correct `false`. Thus, there is no release note. 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.
Nice! Good idea to fix upTestEval/vectorized
.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @otan)
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 r2.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @otan)
Should this be backported to 20.2 and 21.1? |
Yeah, I think we should backport to 20.2 and 21.1 but only the first commit (that's why I didn't put labels on the PR and will do the backport manually). TFTR! bors r+ |
68289: colexec: fix LIKE operators when patterns have escape characters r=yuzefovich a=yuzefovich **colexec: fix LIKE operators when patterns have escape characters** Fixes: #68040. Release note (bug fix): Previously, CockroachDB could incorrectly evaluate LIKE expressions when the pattern contained the escape characters `\` if the expressions were executed via the vectorized engine. **colbuilder: force planning of optimized projection operators** Whenever we're planning a projection expression, we have 3 cases: the left is constant, the right is constants, and neither are constants. For the second case we have some optimized operators. Previously, those operators weren't exercised via the TestEval/vectorized because in the eval tests the left side is constant. This commit switches the planning to force planning of those optimized operators. This shouldn't really have an effect on planning of actual queries. This was prompted by the bug in LIKE operators that is fixed in the previous commit. Had we forced the planning for our eval tests, we would have caught it earlier. This also revealed an incompatibility for our IN operator implementation when the right side is an empty tuple which this commit also fixes. However, I don't think this scenario can be hit in production because the optimizer folds such an expression into correct `false`. Thus, there is no release note. Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
Build failed: |
I wanted to point out that there are other unsolved problems with the |
#44123 is a different beast - there, the problem seems to be during constraint generation in the optimizer. Seems like an unrelated flake. bors r+ |
Build failed (retrying...): |
Build succeeded: |
colexec: fix LIKE operators when patterns have escape characters
Fixes: #68040.
Release note (bug fix): Previously, CockroachDB could incorrectly
evaluate LIKE expressions when the pattern contained the escape
characters
\
if the expressions were executed via the vectorizedengine.
colbuilder: force planning of optimized projection operators
Whenever we're planning a projection expression, we have 3 cases: the
left is constant, the right is constants, and neither are constants. For
the second case we have some optimized operators. Previously, those
operators weren't exercised via the TestEval/vectorized because in the
eval tests the left side is constant. This commit switches the planning
to force planning of those optimized operators. This shouldn't really
have an effect on planning of actual queries.
This was prompted by the bug in LIKE operators that is fixed in the
previous commit. Had we forced the planning for our eval tests, we would
have caught it earlier.
This also revealed an incompatibility for our IN operator implementation when
the right side is an empty tuple which this commit also fixes. However,
I don't think this scenario can be hit in production because the
optimizer folds such an expression into correct
false
. Thus, there isno release note.
Release note: None