From 8e9a26077470c48f4bed938b8e7f8c5e2cfdf36e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 1 Jun 2021 13:06:45 +0300 Subject: [PATCH] Fix null handling in removeAbove/BelowValue --- pkg/timeseries/transform_functions.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/timeseries/transform_functions.go b/pkg/timeseries/transform_functions.go index 7d0ad35..ff3f8b8 100644 --- a/pkg/timeseries/transform_functions.go +++ b/pkg/timeseries/transform_functions.go @@ -33,7 +33,7 @@ func TransformNull(nullValue float64) TransformFunc { func TransformRemoveAboveValue(threshold float64) TransformFunc { return func(point TimePoint) TimePoint { - if *point.Value > threshold { + if point.Value != nil && *point.Value > threshold { point.Value = nil } return point @@ -42,7 +42,7 @@ func TransformRemoveAboveValue(threshold float64) TransformFunc { func TransformRemoveBelowValue(threshold float64) TransformFunc { return func(point TimePoint) TimePoint { - if *point.Value < threshold { + if point.Value != nil && *point.Value < threshold { point.Value = nil } return point