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

fixing interpolation logic #514

Merged
merged 1 commit into from
Sep 6, 2022
Merged

fixing interpolation logic #514

merged 1 commit into from
Sep 6, 2022

Conversation

WireBaron
Copy link
Contributor

This change avoids creating a new start point for an interpolated aggregate if the existing start point is at the interval boundary.

Fixes #499

Copy link
Contributor

@epgts epgts left a comment

Choose a reason for hiding this comment

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

I think my comments boil down to "we need more edge-case testing" :)

)
} else {
None
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get a test for gauge_agg too? One of these days I need to get back to deduplicating these...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, copied the counter_agg test here. We should look at deduplicating this for the next release or the following one (probably as part of stabilizing gauge_agg).

@@ -62,7 +62,7 @@ impl<'input> TimeWeightSummary<'input> {
_ => self.first
};
let new_end = match next {
Some(next) if self.last.ts < interval_start + interval_len => {
Copy link
Contributor

Choose a reason for hiding this comment

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

here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The removed if should never have failed on valid input (and with the assert fixed is guaranteed to not fail).

@@ -48,7 +48,7 @@ impl<'input> TimeWeightSummary<'input> {
prev: Option<TimeWeightSummary>,
next: Option<TimeWeightSummary>,
) -> TimeWeightSummary<'static> {
assert!(interval_start <= self.first.ts && interval_start + interval_len >= self.last.ts);
assert!(interval_start <= self.first.ts && interval_start + interval_len > self.last.ts);
Copy link
Contributor

Choose a reason for hiding this comment

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

The test still passes without this change.

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 is just fixing the assert to reflect that the aggregate is exclusive on the upper bound. If this assert fails, then the caller is trying to call an interpolated function using an interval that's smaller than their bucketing interval. It might still be useful to add a test that we handle invalid input correctly, but pg_test still has trouble with failure tests.

extension/src/counter_agg.rs Show resolved Hide resolved
@WireBaron WireBaron force-pushed the br/interpolated_delta_fix branch from 0b450d5 to 7f8996d Compare September 3, 2022 00:16
@WireBaron WireBaron requested a review from epgts September 6, 2022 18:47
@WireBaron
Copy link
Contributor Author

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 6, 2022

@bors bors bot merged commit 2eb84f0 into main Sep 6, 2022
@bors bors bot deleted the br/interpolated_delta_fix branch September 6, 2022 21:12
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.

interpolated_delta returns a OrderError
3 participants