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 Aliaksandr Valialkin
parent 72468c9d75
commit f46f847531
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

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