Fix bug where MovAvgReducer would allow NaN's to "corrupt" the moving avg

This commit is contained in:
Zachary Tong 2015-04-23 17:51:43 -04:00
parent 114d10e5a9
commit a218d59ce1
1 changed files with 1 additions and 2 deletions

View File

@ -115,10 +115,9 @@ public class MovAvgReducer extends Reducer {
Double thisBucketValue = resolveBucketValue(histo, bucket, bucketsPaths()[0], gapPolicy);
currentKey = bucket.getKey();
if (thisBucketValue != null) {
if (!(thisBucketValue == null || thisBucketValue.equals(Double.NaN))) {
values.offer(thisBucketValue);
// TODO handle "edge policy"
double movavg = model.next(values);
List<InternalAggregation> aggs = new ArrayList<>(Lists.transform(bucket.getAggregations().asList(), FUNCTION));