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

Distribute avg aggregation #331

Merged
merged 2 commits into from
Nov 23, 2023
Merged

Conversation

fpetkovski
Copy link
Collaborator

We currently do not distribute the average aggregation because would be incorrect to calculate an average over averages. However, we could rewrite it as sum / count and distribute those two aggregations independently.

We currently do not distribute the average aggregation because would be
incorrect to calculate an average over averages. However, we could rewrite
it as sum / count and distribute those two aggregations independently.

Signed-off-by: Filip Petkovski <[email protected]>
Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Taking a page out of promxy's book? 😄

logicalplan/distribute_avg.go Outdated Show resolved Hide resolved
Co-authored-by: Giedrius Statkevičius <[email protected]>
Signed-off-by: Filip Petkovski <[email protected]>
@fpetkovski fpetkovski merged commit fc12861 into thanos-io:main Nov 23, 2023
6 checks passed
@@ -129,6 +129,7 @@ var distributiveAggregations = map[parser.ItemType]struct{}{
parser.SUM: {},
parser.MIN: {},
parser.MAX: {},
parser.AVG: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might be harmless, but technically its not true that AVG is distributive right? We work around it by rewriting it to sum/count in a different optimizer so that we never have to see avg in this optimizer if i understand correctly. Adding this here seems like it could be a subtle bug waiting to happen

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think you are right!

I will try to fix this next week, since we have a separate optimizer that rewrites avg, we should remove it from this list.

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.

3 participants