Skip to content

Comments

planner: Remove an unused return value from cardinality.Selectivity.#65900

Merged
ti-chi-bot[bot] merged 1 commit intopingcap:masterfrom
wddevries:remove_unused_return_from_cardinality_selectivity
Feb 2, 2026
Merged

planner: Remove an unused return value from cardinality.Selectivity.#65900
ti-chi-bot[bot] merged 1 commit intopingcap:masterfrom
wddevries:remove_unused_return_from_cardinality_selectivity

Conversation

@wddevries
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #65899

Problem Summary:

What changed and how does it work?

This pull request removes the second unused return value in cardinality.Selectivity.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.
    • This return value is not used.

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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/planner SIG: Planner labels Jan 29, 2026
@tiprow
Copy link

tiprow bot commented Jan 29, 2026

Hi @wddevries. 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.

Details

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.

@lance6716
Copy link
Contributor

/lgtm

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 29, 2026
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 80.76923% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.8380%. Comparing base (245c8e1) to head (94d2ef1).
⚠️ Report is 41 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65900        +/-   ##
================================================
+ Coverage   77.7927%   77.8380%   +0.0453%     
================================================
  Files          2001       1923        -78     
  Lines        545191     536347      -8844     
================================================
- Hits         424119     417482      -6637     
+ Misses       119410     118835       -575     
+ Partials       1662         30      -1632     
Flag Coverage Δ
integration 41.9856% <61.5384%> (-6.1839%) ⬇️
unit 76.9336% <76.9230%> (+0.5041%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 56.7974% <ø> (ø)
parser ∅ <ø> (∅)
br 48.8957% <ø> (-12.0781%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wddevries
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Jan 29, 2026

@wddevries: 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.

Details

In response to this:

/retest

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.

@wddevries
Copy link
Contributor Author

/test unit-test

@tiprow
Copy link

tiprow bot commented Jan 29, 2026

@wddevries: 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.

Details

In response to this:

/test unit-test

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.

@ti-chi-bot ti-chi-bot bot added lgtm approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 1, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 1, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-29 04:18:30.847031083 +0000 UTC m=+1245138.460987939: ☑️ agreed by lance6716.
  • 2026-02-01 18:53:29.983916165 +0000 UTC m=+33881.085314881: ☑️ agreed by terry1purcell.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies the planner/cardinality.Selectivity API by removing its unused second return value and updates all call sites accordingly.

Changes:

  • Change cardinality.Selectivity to return only (float64, error) instead of (float64, []*StatsNode, error).
  • Update all planner call sites to match the new signature.
  • Update benchmarks/tests that called Selectivity to use the new signature.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/planner/cardinality/selectivity.go Removes the unused []*StatsNode return value from Selectivity and adjusts internal returns accordingly.
pkg/planner/cardinality/selectivity_test.go Updates benchmark/tests to use the new (float64, error) signature.
pkg/planner/core/stats.go Updates selectivity derivation call sites to the new signature.
pkg/planner/core/exhaust_physical_plans.go Updates selectivity estimation calls used during task construction.
pkg/planner/core/find_best_task.go Updates selectivity estimation calls during plan construction.
pkg/planner/core/indexmerge_path.go Updates selectivity call for index-merge AND path estimation.
pkg/planner/core/indexmerge_unfinished_path.go Updates selectivity call for index-merge OR path estimation.
pkg/planner/core/operator/physicalop/physical_table_scan.go Updates selectivity call used for pushed filter estimation.
pkg/planner/core/operator/physicalop/task.go Updates selectivity call used for root task condition handling.
pkg/planner/core/operator/physicalop/task_base.go Updates selectivity call used when converting MPP task to root task.
pkg/planner/core/operator/physicalop/tiflash_predicate_push_down.go Updates selectivity calls used for TiFlash predicate pushdown heuristics.
Comments suppressed due to low confidence (1)

pkg/planner/core/stats.go:537

  • The commented-out block below still references nodes from cardinality.Selectivity, but Selectivity no longer returns stats nodes. Please update/remove that TODO snippet (or adjust it to the new API) to avoid leaving stale, non-actionable guidance in the code.
	selectivity, err := cardinality.Selectivity(ds.SCtx(), ds.TableStats.HistColl, conds, filledPaths)
	if err != nil {
		logutil.BgLogger().Debug("something wrong happened, use the default selectivity", zap.Error(err))
		selectivity = cost.SelectionFactor
	}

@terry1purcell
Copy link
Contributor

/retest-required

@tiprow
Copy link

tiprow bot commented Feb 1, 2026

@terry1purcell: 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.

Details

In response to this:

/retest-required

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.

@terry1purcell
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Feb 1, 2026
@terry1purcell
Copy link
Contributor

/retest-required

@hawkingrei
Copy link
Member

/retest

@terry1purcell
Copy link
Contributor

/retest-required

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, lance6716, terry1purcell

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hawkingrei
Copy link
Member

/retest

@hawkingrei
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot bot merged commit 77b0fee into pingcap:master Feb 2, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused second return value from cardinality.Selectivity()

4 participants