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

add test for large mean aggregations #2390

Merged
merged 2 commits into from
Apr 22, 2015

Conversation

neonstalwart
Copy link
Contributor

related to #2346

this adds a test for calculating mean values where the sum of the values causes an overflow. fix to be pushed to this branch once the tests are confirmed to cause a failure

@toddboom
Copy link
Contributor

@neonstalwart this is a smart change. i think this was how means were getting calculated in v0.8.x, but it was rewritten for the new query engine architecture.

@neonstalwart
Copy link
Contributor Author

@toddboom thanks. i think ReduceStddev needs the same treatment for calculating the mean except that i'm having troubles with flattening a slice of slices in ReduceStddev (see #2354)

@@ -211,29 +211,31 @@ func MapMean(itr Iterator) interface{} {

for _, k, v := itr.Next(); k != 0; _, k, v = itr.Next() {
out.Count++
out.Sum += v.(float64)
out.Mean += (v.(float64) - out.Mean) / float64(out.Count)
}
return out
}

type meanMapOutput struct {
Count int
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@toddboom i had a question about this... should Count be a float64? everywhere it gets used (except for where it's calculated) it gets cast to float64 and i don't know go well enough to know what is more idiomatic.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think leaving count as an integer makes sense to me. I don't think the cast is particularly expensive, so I'd leave it that way for now unless you feel strongly otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't have a strong feeling - only uncertainty - so i'll leave it as is 😃

@corylanou
Copy link
Contributor

+1

toddboom added a commit that referenced this pull request Apr 22, 2015
add test for large mean aggregations
@toddboom toddboom merged commit 619d8ac into influxdata:master Apr 22, 2015
@neonstalwart neonstalwart deleted the running-mean branch April 22, 2015 20:59
pauldix added a commit that referenced this pull request Apr 24, 2015
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.

3 participants