-
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
executor: fix the behavior when index join meet prefix index #11081
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11081 +/- ##
===============================================
- Coverage 81.4838% 81.132% -0.3519%
===============================================
Files 423 423
Lines 90899 90068 -831
===============================================
- Hits 74068 73074 -994
- Misses 11535 11713 +178
+ Partials 5296 5281 -15 |
executor/index_lookup_join.go
Outdated
@@ -473,6 +475,10 @@ func (iw *innerWorker) handleTask(ctx context.Context, task *lookUpJoinTask) err | |||
func (iw *innerWorker) constructLookupContent(task *lookUpJoinTask) ([]*indexJoinLookUpContent, error) { | |||
lookUpContents := make([]*indexJoinLookUpContent, 0, task.outerResult.NumRows()) | |||
keyBuf := make([]byte, 0, 64) | |||
keyTypes := make([]*types.FieldType, 0, len(iw.keyCols)) |
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.
move line#478~481 to line #500 ?
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.
line500 is in a for loop.
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.
before for loop
and after if
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.
The if
branch is already in a for loop
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
util/ranger/ranger.go
Outdated
// In case of UTF8, prefix should be cut by characters rather than bytes | ||
// FixPrefixColDatum cuts the datum according to the prefix length. | ||
// If it's UTF8 encoded, we will cut it by characters rather than bytes. | ||
func FixPrefixColDatum(v *types.Datum, length int, tp *types.FieldType) bool { |
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.
how about s/FixPrefixColDatum/CutPrefix/
?
ranger.FixPrefixColDatum(&dLookUpKey[i], iw.colLens[i], keyTypes[i]) | ||
} | ||
} | ||
// dLookUpKey is sorted and deduplicated at sortAndDedupLookUpContents. |
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.
Unnecessary comment?
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.
Just to tell why we don't sort it here?
a154604
to
8b03d99
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.
LGTM.
/run-all-tests |
/run-unit-test |
It seems that, not for sure, we failed to cherry-pick this commit to release-2.1. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @winoros PTAL. |
What problem does this PR solve?
Index join doesn't handle the index with prefix column correctly.
Fix #11061
What is changed and how it works?
Cut the column by the length.
Check List
Tests
Related changes