From 1458450dba18a230f9b19e76d5f64c14fb88a3d0 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 2ccbbbc47..6950e2615 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] } }