-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Planner: Run full partition pruning if convertToPointGet converted keys to SortKey #59918
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
Planner: Run full partition pruning if convertToPointGet converted keys to SortKey #59918
Conversation
Skipping CI for Draft Pull Request. |
Hi @mjonss. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test all |
@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/retest |
@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #59918 +/- ##
================================================
+ Coverage 72.9654% 73.2799% +0.3145%
================================================
Files 1699 1703 +4
Lines 469477 476770 +7293
================================================
+ Hits 342556 349377 +6821
- Misses 105828 106093 +265
- Partials 21093 21300 +207
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
KEY partitioning does not seem to be affected, since it is using |
// TODO: Is there a simpler way, or existing function for this?!? | ||
tblCols := make([]*expression.Column, 0, len(indexInfo.Columns)) | ||
var partNameSlice types.NameSlice | ||
for _, tblCol := range tblInfo.Columns { | ||
found := false | ||
for _, idxCol := range indexCols { | ||
if idxCol.ID == tblCol.ID { | ||
tblCols = append(tblCols, idxCol) | ||
found = true | ||
break | ||
} | ||
} | ||
partNameSlice = append(partNameSlice, &types.FieldName{ | ||
ColName: tblCol.Name, | ||
TblName: tblInfo.Name, | ||
DBName: ast.NewCIStr(dbName), | ||
OrigTblName: tblInfo.Name, | ||
OrigColName: tblCol.Name, | ||
}) | ||
if !found { | ||
tblCols = append(tblCols, &expression.Column{ | ||
ID: tblCol.ID, | ||
OrigName: tblCol.Name.O, | ||
RetType: tblCol.FieldType.Clone(), | ||
}) | ||
} | ||
} |
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.
Is this operations common for partitioning tables? If Yes, could we wrap this operation as a separate function in partition_prune.go
?
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.
I tried using ColumnInfos2ColumnsAndNames()
but there were test failures. So I'm keeping this code for now.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Defined2014, qw4990 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/test unit-test |
@qw4990: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@mjonss: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
In response to a cherrypick label: new pull request created to branch |
…ys to SortKey (pingcap#59918) close pingcap#59827
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #59827
Problem Summary:
When PointGetPlan is created by
convertToPointGet
, theIndexValues
comes from the Range optimizer, and if any of the LIST/RANGE COLUMNS has a non-binary collation, they conditions values are converted to SortKey, which does not work with the LIST/RANGE COLUMNS partitioning pruning code, since they will unconditionally convert it again to SortKey, which may fail finding a matching partition.NOTE: This only affects PointGet, since BatchPointGet is not supported yet.
What changed and how does it work?
If the IndexValues are already converted, run the normal partition pruning code on the conditions, to find the matching partition.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.