From 0c99faa0ef4fd4040638af1e56c55bd7e0d93067 Mon Sep 17 00:00:00 2001 From: Can ZHANG Date: Wed, 29 Apr 2015 11:37:20 +0800 Subject: [PATCH] Fix inconsistent data type --- influxql/functions.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/influxql/functions.go b/influxql/functions.go index f81dde45947..3724e02a6a2 100644 --- a/influxql/functions.go +++ b/influxql/functions.go @@ -348,7 +348,7 @@ type spreadMapOutput struct { // MapSpread collects the values to pass to the reducer func MapSpread(itr Iterator) interface{} { - var out spreadMapOutput + out := &spreadMapOutput{} pointsYielded := false for _, k, v := itr.Next(); k != 0; _, k, v = itr.Next() { @@ -370,14 +370,14 @@ func MapSpread(itr Iterator) interface{} { // ReduceSpread computes the spread of values. func ReduceSpread(values []interface{}) interface{} { - var result spreadMapOutput + result := &spreadMapOutput{} pointsYielded := false for _, v := range values { if v == nil { continue } - val := v.(spreadMapOutput) + val := v.(*spreadMapOutput) // Initialize if !pointsYielded { result.Max = val.Max @@ -447,7 +447,7 @@ type firstLastMapOutput struct { // MapFirst collects the values to pass to the reducer func MapFirst(itr Iterator) interface{} { - out := firstLastMapOutput{} + out := &firstLastMapOutput{} pointsYielded := false for _, k, v := itr.Next(); k != 0; _, k, v = itr.Next() { @@ -470,14 +470,14 @@ func MapFirst(itr Iterator) interface{} { // ReduceFirst computes the first of value. func ReduceFirst(values []interface{}) interface{} { - out := firstLastMapOutput{} + out := &firstLastMapOutput{} pointsYielded := false for _, v := range values { if v == nil { continue } - val := v.(firstLastMapOutput) + val := v.(*firstLastMapOutput) // Initialize first if !pointsYielded { out.Time = val.Time @@ -497,7 +497,7 @@ func ReduceFirst(values []interface{}) interface{} { // MapLast collects the values to pass to the reducer func MapLast(itr Iterator) interface{} { - out := firstLastMapOutput{} + out := &firstLastMapOutput{} pointsYielded := false for _, k, v := itr.Next(); k != 0; _, k, v = itr.Next() { @@ -520,7 +520,7 @@ func MapLast(itr Iterator) interface{} { // ReduceLast computes the last of value. func ReduceLast(values []interface{}) interface{} { - out := firstLastMapOutput{} + out := &firstLastMapOutput{} pointsYielded := false for _, v := range values { @@ -528,7 +528,7 @@ func ReduceLast(values []interface{}) interface{} { continue } - val := v.(firstLastMapOutput) + val := v.(*firstLastMapOutput) // Initialize last if !pointsYielded { out.Time = val.Time