-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fixes vector grouping injection. #2975
Fixes vector grouping injection. #2975
Conversation
During an improvement I introduced a bug where we would pre-aggregate some range vector aggregations, although the result is not the same. We can only inject vector grouping in range vector if the operation is associative through grouping. This is not the case for max/min/stddev/stddvar/quantile/avg_over_time. Signed-off-by: Cyril Tovena <[email protected]>
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.
LGTM!
Signed-off-by: Cyril Tovena <[email protected]>
return r.extractor(e.grouping, len(e.grouping.groups) == 0) | ||
} | ||
return e.left.Extractor() | ||
} | ||
|
||
// canInjectVectorGrouping tells if a vector operation can inject grouping into the nested range vector. | ||
func canInjectVectorGrouping(vecOp, rangeOp string) bool { | ||
if vecOp != OpTypeSum { |
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.
This should work with other types as well (min, max, count), right?
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 know from fact that it doesn't work with count, we have a test in sharding that fails.
It might work for max and min but I don't have a test backing me up.
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.
This basically deserves a big test harness.
During an improvement I introduced a bug where we would pre-aggregate some range vector
aggregations, although the result is not the same.
We can only inject vector grouping in range vector if the operation is associative through grouping.
This is not the case for max/min/stddev/stddvar/quantile/avg_over_time.
Signed-off-by: Cyril Tovena [email protected]