Skip to content

Commit

Permalink
Retain sort applied on more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
robskillington committed Feb 3, 2021
1 parent a3cb2d4 commit f422699
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/query/graphite/native/aggregation_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,10 @@ func applyByNode(ctx *common.Context, seriesList singlePathSpec, nodeNum int, te
wg.Wait()
}

r := ts.NewSeriesList()
// Retain metadata but we definitely did not retain sort order.
r := ts.SeriesList(seriesList)
r.Values = output
r.SortApplied = false
return r, nil
}

Expand Down
5 changes: 4 additions & 1 deletion src/query/graphite/native/builtin_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ func useSeriesAbove(
}
}

r := ts.NewSeriesList()
// Retain metadata but mark as unsorted since this was done in parallel.
r := ts.SeriesList(seriesList)
r.Values = output
r.SortApplied = false
return r, nil
}

Expand Down Expand Up @@ -296,6 +298,7 @@ func grep(_ *common.Context, seriesList singlePathSpec, regex string) (ts.Series
}
}

// Retain sort applied function.
r := ts.SeriesList(seriesList)
r.Values = filtered
return r, nil
Expand Down
5 changes: 3 additions & 2 deletions src/query/graphite/native/summarize.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ func smartSummarize(
results[i] = series.RenamedTo(newName)
}

r := ts.NewSeriesList()
// Retain whether sort was applied or not and metadata.
r := ts.SeriesList(series)
r.Values = results
return r, nil
}
Expand Down Expand Up @@ -242,7 +243,7 @@ var (
specificationFunc: averageSpecificationFunc,
}
medianFuncInfo = funcInfo{
fname: "median",
fname: "median",
// median does not have a consolidationFunc
specificationFunc: medianSpecificationFunc,
}
Expand Down

0 comments on commit f422699

Please sign in to comment.