app/vmselect: always return zero for stddev func if there is only one value (#1659)

The fix will always return zero if received set of items consists of one
element only, which also means no deviation.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
Roman Khavronenko 2021-09-29 00:38:55 +03:00 committed by GitHub
parent dd536b475c
commit de810031bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1373,7 +1373,7 @@ func rollupStdvar(rfa *rollupFuncArg) float64 {
} }
if len(values) == 1 { if len(values) == 1 {
// Fast path. // Fast path.
return values[0] return 0
} }
var avg float64 var avg float64
var count float64 var count float64