fix median() function bug, closes #690

This commit is contained in:
Alexander Zobnin
2019-03-01 13:42:37 +03:00
parent 5884c8f3f9
commit 55158de311

View File

@@ -116,7 +116,9 @@ function aggregateByWrapper(interval, aggregateFunc, datapoints) {
function aggregateWrapper(groupByCallback, interval, datapoints) {
var flattenedPoints = _.flatten(datapoints, true);
return groupBy(flattenedPoints, interval, groupByCallback);
// groupBy_perf works with sorted series only
const sortedPoints = ts.sortByTime(flattenedPoints);
return groupBy(sortedPoints, interval, groupByCallback);
}
function percentil(interval, n, datapoints) {