-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
c458697
to
da1a900
Compare
// 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": |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
006556c
to
392232c
Compare
Fixed a logic bug in there, updated PR pushed. I will make the other suggested changes now. |
392232c
to
f289808
Compare
This check has been moved to earlier in the planning phase.
f289808
to
5a00991
Compare
5a00991
to
573e705
Compare
All requested changes made. |
+1 |
looks rad, +1 |
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.