From 7ccd047e534aa4abad93c23d16cd07d40c8f14ce Mon Sep 17 00:00:00 2001 From: Zakhar Bessarab Date: Tue, 2 Jul 2024 18:36:49 +0400 Subject: [PATCH] app/vmselect/promql: remove duplicated logic of filling NaN values for histograms Removed logic was used to fill nan values with lower buckets values: [1 2 3 nan nan nan] => [1 2 3 3 3 3]. Since buckets are now fixed from lower ones to upper this happens in the main loop, so there is no need in a second one. Signed-off-by: Zakhar Bessarab --- app/vmselect/promql/transform.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 59906da6c..660bf2e3e 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -1049,18 +1049,7 @@ func fixBrokenBuckets(i int, xss []leTimeseries) { if len(xss) < 2 { return } - // Fill NaN in upper buckets with the first non-NaN value found in lower buckets. - for j := len(xss) - 1; j >= 0; j-- { - v := xss[j].ts.Values[i] - if !math.IsNaN(v) { - j++ - for j < len(xss) { - xss[j].ts.Values[i] = v - j++ - } - break - } - } + // Substitute upper bucket values with lower bucket values if the upper values are NaN // or are bigger than the lower bucket values. vNext := xss[0].ts.Values[0]