From 762a77079a2b82947bf9eb5e84a1931ec8287511 Mon Sep 17 00:00:00 2001 From: ben hockey Date: Thu, 23 Apr 2015 10:35:12 -0500 Subject: [PATCH] unmarshal stddev appropriately --- influxql/functions.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/influxql/functions.go b/influxql/functions.go index a7c4a6a84a6..d3978a452ba 100644 --- a/influxql/functions.go +++ b/influxql/functions.go @@ -153,6 +153,12 @@ func InitializeUnmarshaller(c *Call) (UnmarshalFunc, error) { err := json.Unmarshal(b, &o) return &o, err }, nil + case "stddev": + return func(b []byte) (interface{}, error) { + val := make([]float64, 0) + err := json.Unmarshal(b, &val) + return val, err + }, nil default: return func(b []byte) (interface{}, error) { var val interface{} @@ -397,9 +403,7 @@ func ReduceStddev(values []interface{}) interface{} { if value == nil { continue } - for _, val := range value.([]float64) { - data = append(data, val) - } + data = append(data, value.([]float64)...) } // If no data or we only have one point, it's nil or undefined