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

Fixes vector grouping injection. #2975

Merged
merged 2 commits into from
Nov 25, 2020

Conversation

cyriltovena
Copy link
Contributor

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 cyril.tovena@gmail.com

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 <cyril.tovena@gmail.com>
Copy link
Contributor

@kavirajk kavirajk left a 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 <cyril.tovena@gmail.com>
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 {
Copy link
Member

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?

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 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.

Copy link
Contributor Author

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.

@cyriltovena cyriltovena merged commit 06a89ea into grafana:master Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants