Commit ed7dbad4 authored by Murali Vilayannur's avatar Murali Vilayannur Committed by Facebook Github Bot

Fix rangeAdjust to handle cases of non-overlapping time ranges

Summary:
When adjusting nextBucketStart by rounding down, we should also check if
that causes it to not overlap with the user-specified [start, end) time
interval. If it does not overlap, then return an empty return type since
this bucket does not contribute anything to the specified time-range.

Reviewed By: simpkins

Differential Revision: D14121401

fbshipit-source-id: bbfb1d6a71c9fb99244cdff887a7a9ee18741f25
parent ab893da3
......@@ -491,6 +491,12 @@ ReturnType BucketedTimeSeries<VT, CT>::rangeAdjust(
// latestTime_.
if (bucketStart <= latestTime_ && nextBucketStart > latestTime_) {
nextBucketStart = latestTime_ + Duration(1);
// If nextBucketStart is now lower than start then it means that we have
// never recorded any data points in the requested time interval,
// and can simply return 0.
if (start >= nextBucketStart) {
return ReturnType{};
}
}
if (start <= bucketStart && end >= nextBucketStart) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment