Skip to content
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

Merged
merged 18 commits into from
Feb 19, 2021

Conversation

Reminiscent
Copy link
Contributor

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

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note

  • No release note

@Reminiscent Reminiscent requested a review from a team as a code owner January 19, 2021 06:28
@Reminiscent Reminiscent requested review from lzmhhh123 and removed request for a team January 19, 2021 06:28
@Reminiscent
Copy link
Contributor Author

/label sig/planner, component/statistics, type/enhancement

@ti-srebot ti-srebot added component/statistics sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement. labels Jan 19, 2021
@rebelice
Copy link
Contributor

/cc @rebelice

@Reminiscent Reminiscent requested a review from a team as a code owner January 19, 2021 07:45
@github-actions github-actions bot added the sig/execution SIG execution label Jan 19, 2021
@Reminiscent
Copy link
Contributor Author

/cc @qw4990

statistics/cmsketch.go Outdated Show resolved Hide resolved

if len(popedTopN) != 0 {
popedTopNHg := statistics.NewHistogram(allID[i], 0, 0, 0, allFieldType[i], 0, 0)
popedTopNHg.AddIdxVals(popedTopN)
Copy link
Contributor

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.

Copy link
Contributor Author

@Reminiscent Reminiscent Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update. PTAL @rebelice

statistics/handle/handle.go Outdated Show resolved Hide resolved
statistics/cmsketch.go Outdated Show resolved Hide resolved
Comment on lines +640 to +646
totCnt := uint64(0)
for _, topN := range topNs {
totCnt += topN.TotalCount()
}
if totCnt == 0 {
return nil, nil
}
Copy link
Contributor

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.

@Reminiscent
Copy link
Contributor Author

@qw4990 Update. PTAL

Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 19, 2021
@Reminiscent
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@rebelice rebelice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Feb 19, 2021
ti-srebot
ti-srebot previously approved these changes Feb 19, 2021
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Feb 19, 2021
@Reminiscent
Copy link
Contributor Author

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 19, 2021
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@Reminiscent merge failed.

@Reminiscent
Copy link
Contributor Author

/run-all-tests

@Reminiscent
Copy link
Contributor Author

/run-all-tests

@qw4990 qw4990 merged commit 8842bbc into pingcap:master Feb 19, 2021
@Reminiscent Reminiscent deleted the mergeTopN branch August 5, 2021 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/statistics sig/execution SIG execution sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants