-
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
planner, executor: support batchget for range and list partition table #24856
Conversation
Almost LGTM, please address my small comments at your convenience @zhuo-zhi |
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.
Some minor questions/suggestions
physID := getPhysID(e.tblInfo, idxVals[e.partPos].GetInt64()) | ||
physID, err := getPhysID(e.tblInfo, e.partExpr, idxVals[e.partPos].GetInt64()) | ||
if err != nil { | ||
continue |
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.
Does it continue
instead of return err
only because getPhysID() only returns an error when there is no matching partition? I.e. would use TableDual?
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.
As for BatchGet
, if one data point in the where clause where col in (....)
doesn't match any partition, we can just safely ignore it, and continue trying to fetch the next data point.
TableDual is not applicable here because we have already built our executor in buildBatchPointGet
instead of buildTableDual
.
unsigned := mysql.HasUnsignedFlag(col.GetType().Flag) | ||
ranges := partitionExpr.ForRangePruning | ||
length := len(ranges.LessThan) | ||
partIdx := sort.Search(length, func(i int) 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.
This seems to be used in several places (like getPartitionInfo in planner/core/point_get_plan.go), could it be moved to its own function? (i.e. searching and finding the range partition?)
Maybe refactor/break out the same code from locateRangePartition?
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, now it's more like an ad hoc solution. Maybe we can refactor our code after partition by range columns(...)
and partition by list columns(...)
GA.
return i, nil | ||
} | ||
} | ||
panic("unique index must include all partition columns") |
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.
There are no hint in the name of the function or comment that it only applies to Unique indexes, could you add that to the comment above the function?
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.
Ok. It's updated in the new commit.
/lgtm (but I'm not yet in the reviewer list) |
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
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 0dd4e39
|
/merge |
@zhuo-zhi: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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 ti-community-infra/tichi repository. |
Please follow PR Title Format:
Or if the count of mainly changed packages are more than 3, use
|
What problem does this PR solve?
Issue Number: close #24476, subitem of #24150
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Check List
Tests
Side effects
Release note