-
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
statistics: merge partition-level TopN to global-level TopN #22433
Conversation
/label sig/planner, component/statistics, type/enhancement |
/cc @rebelice |
/cc @qw4990 |
statistics/handle/handle.go
Outdated
|
||
if len(popedTopN) != 0 { | ||
popedTopNHg := statistics.NewHistogram(allID[i], 0, 0, 0, allFieldType[i], 0, 0) | ||
popedTopNHg.AddIdxVals(popedTopN) |
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 seems to be a problem with the AddIdxVals
. If the value is greater or less than the boundaries of all buckets, it cannot be inserted.
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.
Update. PTAL @rebelice
totCnt := uint64(0) | ||
for _, topN := range topNs { | ||
totCnt += topN.TotalCount() | ||
} | ||
if totCnt == 0 { | ||
return nil, nil | ||
} |
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.
Why do we need to check this? It seems unnecessary.
@qw4990 Update. PTAL |
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 |
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
/merge |
/run-all-tests |
@Reminiscent merge failed. |
/run-all-tests |
/run-all-tests |
What problem does this PR solve?
Issue Number: related: #18551
Problem Summary:
We introduce two-level statistics for the partition tables. This PR is part of it and is used to merge topN.
What is changed and how it works?
Proposal (in Chinese)
merge multi topN to a new topN.
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Release note