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 <z.bessarab@victoriametrics.com>
This commit is contained in:
Zakhar Bessarab 2024-07-02 18:36:49 +04:00
parent d861062769
commit 7ccd047e53
No known key found for this signature in database
GPG key ID: 932B34D6FE062023

View file

@ -1049,18 +1049,7 @@ func fixBrokenBuckets(i int, xss []leTimeseries) {
if len(xss) < 2 { if len(xss) < 2 {
return 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 // Substitute upper bucket values with lower bucket values if the upper values are NaN
// or are bigger than the lower bucket values. // or are bigger than the lower bucket values.
vNext := xss[0].ts.Values[0] vNext := xss[0].ts.Values[0]