Skip to content

Commit

Permalink
Fix input type
Browse files Browse the repository at this point in the history
  • Loading branch information
yyin-sc committed Sep 4, 2020
1 parent 4348ec5 commit 36c0c65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/query/graphite/native/aggregation_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,22 @@ func divideSeries(ctx *common.Context, dividendSeriesList, divisorSeriesList sin

// aggregate takes a list of series and returns a new series containing the
// value aggregated across the series at each datapoint using the specified function.
func aggregate(ctx *common.Context, series multiplePathSpecs, fname string) (ts.SeriesList, error) {
func aggregate(ctx *common.Context, series singlePathSpec, fname string) (ts.SeriesList, error) {
switch fname {
case Empty, Sum, SumSeries, Total:
return sumSeries(ctx, series)
return sumSeries(ctx, multiplePathSpecs(series))
case Min, MinSeries:
return minSeries(ctx, series)
return minSeries(ctx, multiplePathSpecs(series))
case Max, MaxSeries:
return maxSeries(ctx, series)
return maxSeries(ctx, multiplePathSpecs(series))
case Avg, Average, AverageSeries:
return averageSeries(ctx,series)
return averageSeries(ctx,multiplePathSpecs(series))
case Multiply, MultiplySeries:
return multiplySeries(ctx, series)
return multiplySeries(ctx, multiplePathSpecs(series))
case Diff, DiffSeries:
return diffSeries(ctx, series)
return diffSeries(ctx, multiplePathSpecs(series))
case Count, CountSeries:
return countSeries(ctx, series)
return countSeries(ctx, multiplePathSpecs(series))
default:
return ts.NewSeriesList(), errors.NewInvalidParamsError(fmt.Errorf("invalid func %s", fname))
}
Expand Down
4 changes: 2 additions & 2 deletions src/query/graphite/native/aggregation_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ func TestSumSeries(t *testing.T) {

func TestAggregate(t *testing.T) {
testAggregatedSeries(t, func(ctx *common.Context, series multiplePathSpecs) (ts.SeriesList, error) {
return aggregate(ctx, series, "sum")
return aggregate(ctx, singlePathSpec(series), "sum")
}, 15.0, 28.0, 30.0, 17.0, "invalid sum value for step %d")

testAggregatedSeries(t, func(ctx *common.Context, series multiplePathSpecs) (ts.SeriesList, error) {
return aggregate(ctx, series, "maxSeries")
return aggregate(ctx, singlePathSpec(series), "maxSeries")
}, 15.0, 15.0, 17.0, 17.0, "invalid max value for step %d")
}

Expand Down

0 comments on commit 36c0c65

Please sign in to comment.