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

Numeric aggregation check #2548

Merged
merged 4 commits into from
May 12, 2015
Merged

Numeric aggregation check #2548

merged 4 commits into from
May 12, 2015

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented May 12, 2015

With this change in place, an error will be returned to the client if an attempt is made to perform a numeric aggregation on non-numeric data.

Fixes issues #2299, #2062, #2543.

@otoolep otoolep force-pushed the numeric_agg_check branch 3 times, most recently from c458697 to da1a900 Compare May 12, 2015 19:40
@otoolep
Copy link
Contributor Author

otoolep commented May 12, 2015

@pauldix

// IsNumeric returns whether a given aggregate can only be run on numeric fields.
func IsNumeric(c *Call) bool {
switch c.Name {
case "sum", "mean", "median", "min", "max", "spread", "stddev", "percentile":
Copy link
Member

Choose a reason for hiding this comment

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

I would invert this. We should assume that the aggregate is numeric since it most cases it is. That way the check in planning will get run by default if someone adds a new aggregate function but forgets to add it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, @beckettsean and I were just discussing doing exactly that.

@otoolep otoolep force-pushed the numeric_agg_check branch 2 times, most recently from 006556c to 392232c Compare May 12, 2015 20:07
@otoolep
Copy link
Contributor Author

otoolep commented May 12, 2015

Fixed a logic bug in there, updated PR pushed. I will make the other suggested changes now.

This check has been moved to earlier in the planning phase.
@otoolep
Copy link
Contributor Author

otoolep commented May 12, 2015

All requested changes made.

@toddboom
Copy link
Contributor

+1

@pauldix
Copy link
Member

pauldix commented May 12, 2015

looks rad, +1

otoolep added a commit that referenced this pull request May 12, 2015
@otoolep otoolep merged commit 6741675 into master May 12, 2015
@otoolep otoolep deleted the numeric_agg_check branch May 12, 2015 20:31
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

3 participants