tidb
tidb copied to clipboard
planner: fix a estimation case when index.hist.NDV is greater than index.topN.num.
What problem does this PR solve?
Issue Number: close https://github.com/pingcap/tidb/issues/61792
Problem Summary:
What changed and how does it work?
Check List
Tests
- [ ] Unit test
- [x] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test
- [ ] I checked and no code files have been changed.
Side effects
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility
Documentation
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
None
Hi @AilinKid. Thanks for your PR.
PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.
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.
Codecov Report
:x: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 73.8472%. Comparing base (8310982) to head (83df8b1).
:warning: Report is 585 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #61793 +/- ##
================================================
+ Coverage 73.0493% 73.8472% +0.7978%
================================================
Files 1730 1736 +6
Lines 481618 487972 +6354
================================================
+ Hits 351819 360354 +8535
+ Misses 108261 106019 -2242
- Partials 21538 21599 +61
| Flag | Coverage Δ | |
|---|---|---|
| integration | 42.6503% <70.0000%> (?) |
|
| unit | 72.6877% <70.0000%> (+0.4042%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.7804% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 46.6145% <ø> (+0.0286%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@AilinKid Please remember to update the test result sets.
/test check-dev2
@AilinKid: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test check-dev2
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.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: hawkingrei, qw4990
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~pkg/planner/OWNERS~~ [hawkingrei,qw4990]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
[LGTM Timeline notifier]
Timeline:
2025-06-18 04:09:04.068581476 +0000 UTC m=+244796.791760458: :ballot_box_with_check: agreed by hawkingrei.2025-06-20 06:56:49.769921258 +0000 UTC m=+427662.493100239: :ballot_box_with_check: agreed by qw4990.
@AilinKid: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| fast_test_tiprow | 83df8b1e6df93eca67833565d9e989e55bd5d675 | link | true | /test fast_test_tiprow |
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.
/test check-dev2
@AilinKid: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test check-dev2
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.
-1
Added a negative 1 comment above for the following reasons:
- Questions were raised by two reviewers about the need for "isFullLoad" check in this PR - but neither comment was answered/resolved in this PR.
- If the usage of isFullLoad is correct - it implies that the accuracy of notNullCount() is of concern if the statistics are not fully loaded. However, if this IF check fails (because of !isFullLoad), then the next step in the code (after that IF) will go ahead and use notNullCount() to calculate avgRowEstimate. That line should also have the same accuracy risk. This PR therefore appears to be incomplete.
In response to a cherrypick label: new pull request created to branch release-8.5: #63592.
But this PR has conflicts, please resolve them!