From fbb572a180999f36ec80dece38aee0500fe48def Mon Sep 17 00:00:00 2001 From: Noah Labrecque <62020678+unfinishedprogram@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:17:16 -0500 Subject: [PATCH] fix: apply correct bounds to sf and tf (#5274) --- app/vmselect/promql/rollup.go | 4 ++-- app/vmselect/promql/rollup_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index 7b7075128..d10c40a86 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -955,11 +955,11 @@ func newRollupHoltWinters(args []interface{}) (rollupFunc, error) { return rfa.prevValue } sf := sfs[rfa.idx] - if sf <= 0 || sf >= 1 { + if sf < 0 || sf > 1 { return nan } tf := tfs[rfa.idx] - if tf <= 0 || tf >= 1 { + if tf < 0 || tf > 1 { return nan } diff --git a/app/vmselect/promql/rollup_test.go b/app/vmselect/promql/rollup_test.go index 12a3b0acb..766a33eae 100644 --- a/app/vmselect/promql/rollup_test.go +++ b/app/vmselect/promql/rollup_test.go @@ -470,12 +470,12 @@ func TestRollupHoltWinters(t *testing.T) { } f(-1, 0.5, nan) - f(0, 0.5, nan) - f(1, 0.5, nan) + f(0, 0.5, -856) + f(1, 0.5, 34) f(2, 0.5, nan) f(0.5, -1, nan) - f(0.5, 0, nan) - f(0.5, 1, nan) + f(0.5, 0, -54.1474609375) + f(0.5, 1, 25.25) f(0.5, 2, nan) f(0.5, 0.5, 34.97794532775879) f(0.1, 0.5, -131.30529492371622)