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

planner: fix a bug for chunk cost model. #14144

Merged
merged 6 commits into from
Dec 22, 2019

Conversation

wshwsh12
Copy link
Contributor

@wshwsh12 wshwsh12 commented Dec 19, 2019

What problem does this PR solve?

Fixes #14146
When using chunk cost model for some table, it maybe get Can’t find a proper physical plan for this query.

What is changed and how it works?

Check avgSize before using Log2(avgSize)

Check List

Tests

Code changes

Side effects

Related changes

Release note

@wshwsh12 wshwsh12 requested a review from a team as a code owner December 19, 2019 12:32
@ghost ghost requested review from alivxxx and winoros and removed request for a team December 19, 2019 12:32
Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

Please add test for this fix.

@wshwsh12 wshwsh12 requested a review from a team as a code owner December 19, 2019 14:05
@ghost ghost requested review from qw4990 and XuHuaiyu and removed request for a team December 19, 2019 14:05
@wshwsh12 wshwsh12 added sig/planner SIG: Planner type/bug-fix This PR fixes a bug. labels Dec 20, 2019
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

SunRunAway
SunRunAway previously approved these changes Dec 20, 2019
Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

reset LGTM

@SunRunAway SunRunAway added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT2 Indicates that a PR has LGTM 2. status/can-merge Indicates a PR has been approved by a committer. labels Dec 20, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 20, 2019

/run-all-tests

@@ -176,6 +179,9 @@ func (c *Column) AvgColSizeListInDisk(count int64) float64 {
// Keep two decimal place.
// Minus Log2(avgSize) for unfixed-len type LEN.
avgSize := float64(c.TotColSize) / float64(count)
if avgSize < 1 {
return math.Round((avgSize)*100) / 100
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add unit test in testStatsSuite.TestAvgColLen?

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway SunRunAway added the status/can-merge Indicates a PR has been approved by a committer. label Dec 20, 2019
@SunRunAway SunRunAway added the status/LGT2 Indicates that a PR has LGTM 2. label Dec 20, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 20, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Dec 20, 2019

@wshwsh12 merge failed.

@wshwsh12
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Dec 22, 2019

/run-all-tests

@sre-bot sre-bot merged commit 510c36d into pingcap:master Dec 22, 2019
@wshwsh12 wshwsh12 deleted the fix_cost_model branch April 21, 2020 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can find physical plan when use Chunk Cost model
5 participants