Skip to content

Commit

Permalink
unmarshal stddev appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
neonstalwart committed Apr 23, 2015
1 parent 23c38fb commit 762a770
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions influxql/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 762a770

Please sign in to comment.