Skip to content

Commit

Permalink
Merge pull request #367 from msaf1980/master
Browse files Browse the repository at this point in the history
fix empty result in moving function
  • Loading branch information
Civil committed Oct 15, 2018
2 parents 21aed51 + a94b484 commit ce2f31d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions expr/functions/moving/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@ func (f *moving) Do(e parser.Expr, from, until int64, values map[parser.MetricRe
return nil, err
}

var result []*types.MetricData

if len(arg) == 0 {
return result, nil
}

var offset int

if scaleByStep {
windowSize /= int(arg[0].StepTime)
offset = windowSize
}

var result []*types.MetricData

for _, a := range arg {
w := &types.Windowed{Data: make([]float64, windowSize)}

Expand Down

0 comments on commit ce2f31d

Please sign in to comment.