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

make stddev work #2354

Merged
merged 5 commits into from Apr 29, 2015
Merged

make stddev work #2354

merged 5 commits into from Apr 29, 2015

Conversation

neonstalwart
Copy link
Contributor

it looks like stddev isn't working but there are no tests covering it

@neonstalwart
Copy link
Contributor Author

i expect this PR will fail as it is (i have an extra commit that should fix it) but this seems like a test script failure

cc @otoolep @corylanou

@toddboom
Copy link
Contributor

@neonstalwart agreed, that's a weird one. kicking the build to see if it pulls down correctly the next time.

@neonstalwart
Copy link
Contributor Author

@toddboom 😞 didn't work

@otoolep
Copy link
Contributor

otoolep commented Apr 21, 2015

Build script has been fixed, please rebase so CI testing can re-run.

@neonstalwart
Copy link
Contributor Author

i need some help here... i'm fairly sure that ReduceStddev is getting something like [[1,2,3],[4,5,6]] (i.e. [][]float64) but i don't understand go well enough to come up with the right syntax to make this work. ReduceStddev seems to be the only function that doesn't get just a flat slice of values. any advice?

@neonstalwart
Copy link
Contributor Author

hmm... i've got this working for TestSingleServer but it fails for Test3NodeServer. anyone got an idea?

@neonstalwart
Copy link
Contributor Author

i think i've actually got this PR working. can someone take a look at why this failed? i think it's a CI failure rather than a real failure but i don't understand what's happened.

cc @otoolep @toddboom

@otoolep
Copy link
Contributor

otoolep commented Apr 23, 2015

Thanks @neonstalwart -- it is a failure unrelated to your change. We are currently investigating the root cause of these failures in CI.

@neonstalwart
Copy link
Contributor Author

roll the 🎲 again and this time it passes 🎉

@neonstalwart
Copy link
Contributor Author

this is ready for review now - once the values were properly unmarshalled everything started to make more sense.

@neonstalwart neonstalwart changed the title add test for stddev make stddev work Apr 23, 2015
@neonstalwart
Copy link
Contributor Author

i'm not sure who is responsible for which parts of influxdb but it looks like @pauldix shows up a lot in the blame for influxql/functions.go so he gets a mention to see if this could get a review.

@@ -419,7 +425,7 @@ func ReduceStddev(values []interface{}) interface{} {
sq := math.Pow(dif, 2)
variance += sq
}
variance = variance / float64(len(data)-1)
variance = variance / float64(count-1)
Copy link
Member

Choose a reason for hiding this comment

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

Should check for count == 1 or this'll be bad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

look at line 410

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it probably wouldn't be a bad idea to add a test for count < 2 though. i can work on that if you want.

Copy link
Member

Choose a reason for hiding this comment

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

ah, no, that's fine, didn't see it.

@corylanou
Copy link
Contributor

+1

@neonstalwart
Copy link
Contributor Author

i went ahead and added a test for one point - i think it's a significant case.

pauldix added a commit that referenced this pull request Apr 29, 2015
@pauldix pauldix merged commit 8d91b75 into influxdata:master Apr 29, 2015
@pauldix
Copy link
Member

pauldix commented Apr 29, 2015

Thanks @neonstalwart!

@neonstalwart neonstalwart deleted the stddev branch May 11, 2015 21:53
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.

None yet

5 participants