-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
util: build right range when where stmt only have string column. #16645
Conversation
/run-all-tests |
/run-integration-copr-test |
Codecov Report
@@ Coverage Diff @@
## master #16645 +/- ##
================================================
- Coverage 80.4000% 80.3720% -0.0280%
================================================
Files 506 506
Lines 137082 136861 -221
================================================
- Hits 110214 109998 -216
+ Misses 18268 18264 -4
+ Partials 8600 8599 -1 |
util/ranger/checker.go
Outdated
@@ -32,6 +32,11 @@ func (c *conditionChecker) check(condition expression.Expression) bool { | |||
case *expression.ScalarFunction: | |||
return c.checkScalarFunction(x) | |||
case *expression.Column: | |||
if s, ok := condition.(*expression.Column); ok { | |||
if s.RetType.EvalType() == types.ETString { | |||
return false |
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.
Then we cannot use index for this kind of filter? would it cause performance regression?
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.
Yes. Maybe it cause performance regression, but It is a correctness question. In Mysql, the range is empty also. If we use index, it can only filter null
and ''
.
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.
lgtm
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.
LGTM
/run-all-tests |
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-2.1 in PR #16657 |
cherry pick to release-3.0 in PR #16658 |
cherry pick to release-3.1 in PR #16659 |
cherry pick to release-4.0 in PR #16660 |
What problem does this PR solve?
Issue Number: close #16505 , close #16190
Problem Summary: TableIndexScan's result is different from TableFullScan and Selection.
What is changed and how it works?
What's Changed: If the where stmt only have String column, it shouldn't be one of accessCondition to build access range. Because we should convert the string to float to check it is ture/false.
How it Works: However, revert #16135 that only cover some cases. The pr can cover all situations.
Related changes
Check List
Tests
Release note
Fix the wrong result when where stmt only have string column.