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

*: Support avg in new plan #871

Merged
merged 2 commits into from
Jan 22, 2016
Merged

*: Support avg in new plan #871

merged 2 commits into from
Jan 22, 2016

Conversation

shenli
Copy link
Member

@shenli shenli commented Jan 21, 2016

ctx := v.GetContext()
switch x := ctx.Value.(type) {
case float64:
ctx.Value = x / float64(ctx.Count)
Copy link
Member

Choose a reason for hiding this comment

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

If ctx.Count is zero, can this work well?

Copy link
Member Author

Choose a reason for hiding this comment

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

If Count is zero, ctx.Value must be nil. So it will not be in this switch branch. I will add a test case for it.

@shenli
Copy link
Member Author

shenli commented Jan 22, 2016

PTAL @qiuyesuifeng

qiuyesuifeng added a commit that referenced this pull request Jan 22, 2016
@qiuyesuifeng qiuyesuifeng merged commit a59176b into master Jan 22, 2016
@qiuyesuifeng qiuyesuifeng deleted the shenli/dev-avg branch January 22, 2016 07:33
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
xhebox pushed a commit to xhebox/tidb that referenced this pull request Sep 28, 2021
xhebox pushed a commit to xhebox/tidb that referenced this pull request Oct 8, 2021
rleungx pushed a commit to rleungx/tidb that referenced this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants