diff --git a/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MaxTimeSeriesBuilder.java b/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MaxTimeSeriesBuilder.java index 742b1b32c6d..589bbd1bafd 100644 --- a/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MaxTimeSeriesBuilder.java +++ b/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MaxTimeSeriesBuilder.java @@ -39,7 +39,7 @@ public MaxTimeSeriesBuilder(String id, TimeBuckets timeBuckets, List tag @Override public void addValueAtIndex(int timeBucketIndex, Double value) { - if (_values[timeBucketIndex] == null || value > _values[timeBucketIndex]) { + if (value != null && (_values[timeBucketIndex] == null || value > _values[timeBucketIndex])) { _values[timeBucketIndex] = value; } } diff --git a/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MinTimeSeriesBuilder.java b/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MinTimeSeriesBuilder.java index 93cdab77d4c..6247114d614 100644 --- a/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MinTimeSeriesBuilder.java +++ b/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/MinTimeSeriesBuilder.java @@ -39,7 +39,7 @@ public MinTimeSeriesBuilder(String id, TimeBuckets timeBuckets, List tag @Override public void addValueAtIndex(int timeBucketIndex, Double value) { - if (_values[timeBucketIndex] == null || value < _values[timeBucketIndex]) { + if (value != null && (_values[timeBucketIndex] == null || value < _values[timeBucketIndex])) { _values[timeBucketIndex] = value; } } diff --git a/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/SummingTimeSeriesBuilder.java b/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/SummingTimeSeriesBuilder.java index 2cf723b8e4a..8123dde1bf4 100644 --- a/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/SummingTimeSeriesBuilder.java +++ b/pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/series/builders/SummingTimeSeriesBuilder.java @@ -39,7 +39,9 @@ public SummingTimeSeriesBuilder(String id, TimeBuckets timeBuckets, List @Override public void addValueAtIndex(int timeBucketIndex, Double value) { - _values[timeBucketIndex] = (_values[timeBucketIndex] == null ? 0 : _values[timeBucketIndex]) + value; + if (value != null) { + _values[timeBucketIndex] = (_values[timeBucketIndex] == null ? 0.0 : _values[timeBucketIndex]) + value; + } } @Override