diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index 0ddb46d6b..35d3cdde7 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -2964,6 +2964,23 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r1, r2, r3, r4, r5, r6} f(q, resultExpected) }) + t.Run(`prometheus_buckets(zero-vmrange-value)`, func(t *testing.T) { + t.Parallel() + q := `sort(prometheus_buckets(label_set(0, "vmrange", "0...0")))` + r1 := netstorage.Result{ + MetricName: metricNameExpected, + Values: []float64{0, 0, 0, 0, 0, 0}, + Timestamps: timestampsExpected, + } + r1.MetricName.Tags = []storage.Tag{ + { + Key: []byte("le"), + Value: []byte("+Inf"), + }, + } + resultsExpected := []netstorage.Result{r1} + f(q, resultsExpected) + }) t.Run(`prometheus_buckets(valid)`, func(t *testing.T) { t.Parallel() q := `sort(prometheus_buckets(( diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 9801e757c..065b521f6 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -363,6 +363,7 @@ func vmrangeBucketsToLE(tss []*timeseries) []*timeseries { ts := xs.ts if isZeroTS(ts) { // Skip time series with zeros. They are substituted by xssNew below. + xsPrev = xs continue } if xs.start != xsPrev.end {