-
Notifications
You must be signed in to change notification settings - Fork 5.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
executor, planner: support indexMerge limit embeded with non partition table #42811
Conversation
[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 submitting an approval review. |
/retest |
1 similar comment
/retest |
|
||
// pruneTableWorkerTaskIdxRows prune idxRows and only keep columns that will be used in byItems. | ||
func (w *indexMergeProcessWorker) pruneTableWorkerTaskIdxRows(task *indexMergeTableTask) { | ||
if plan, ok := w.indexMerge.partialPlans[task.partialPlanID][0].(*plannercore.PhysicalTableScan); ok { |
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.
Can the bottom of the partial plan is IndexScan
?
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 IndexScan
no need prune retChk. Columns required by byItems
are always first.
if plan, ok := w.indexMerge.partialPlans[task.partialPlanID][0].(*plannercore.PhysicalTableScan); ok { | ||
prune := make([]int, 0, len(w.indexMerge.byItems)) | ||
for _, item := range plan.ByItems { | ||
c, _ := item.Expr.(*expression.Column) |
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 order by an expression like col + 1
?
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.
It's not support yet. The planner will not generate a such plan.
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.
order by col+1
will be optimized to order by col
.
order by f(col)
or order by f(col1, col2)
are clearly that they cannot use the order property of the index.
if plan, ok := w.indexMerge.partialPlans[task.partialPlanID][0].(*plannercore.PhysicalTableScan); ok { | ||
prune := make([]int, 0, len(w.indexMerge.byItems)) | ||
for _, item := range plan.ByItems { | ||
c, _ := item.Expr.(*expression.Column) |
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 item.Expr.(*expression.Column).Index
is the same thing as the i
in for i, col := range plan.Schema().Columns
.
You can use the Index
directly.
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.
Oh, the ByItems
are shared between partial scans. We cannot use the Index
. But i think we can use Schema.ColumnIndex
or Schema.Contains
to find the column by unique id, no need to use ID
?
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.
Updated.
It confused me about ID
and UniqueID
in expression.Column
. I found we use ID
to compare with model.ColumnInfo
, and use UniqueID
to compare with expression.Column
. @winoros
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, ID is the meta data of model.ColumnInfo
, created by DDL. So ID
is a table-level meta data.
UniqueID
is generated during planning. It's unique at the SQL level.
We often use UniqueID
to check the equivalence of the expression.Column
. Use ID
to know which ColumnInfo
it represents.
/retest |
1 similar comment
/retest |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: ea995a9
|
/retest |
1 similar comment
/retest |
@Defined2014: 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/test-infra repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: ref #41028
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.