From 8f4790625def4a738189a809c267900ecbf2ee70 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 6 Jun 2019 17:07:28 +0300 Subject: [PATCH] app/vmselect/promql: return the correct time series from `quantile` Previously arbitrary time series could be returned from `quantile` depending on sort order for the last data point in the selected range. Fix this by returning the calculated time series. Fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/55 --- app/vmselect/promql/aggr.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/vmselect/promql/aggr.go b/app/vmselect/promql/aggr.go index 2ccbbbc47c..6950e26153 100644 --- a/app/vmselect/promql/aggr.go +++ b/app/vmselect/promql/aggr.go @@ -457,6 +457,7 @@ func newAggrQuantileFunc(phis []float64) func(tss []*timeseries) []*timeseries { idx := int(math.Round(float64(len(tss)-1) * phi)) dst.Values[n] = tss[idx].Values[n] } + tss[0] = dst return tss[:1] } }