Skip to content

Commit

Permalink
Discard points after requested interval end
Browse files Browse the repository at this point in the history
  • Loading branch information
alpinskiy committed Sep 19, 2023
1 parent 6fc0a4c commit 1991ec1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/promql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,11 @@ func (ev *evaluator) weightData(data []*[]float64) []float64 {
for _, lod := range ev.t.LODs {
for m := 0; m < lod.Len; m++ {
k := j + m
if ev.t.Time[k] >= ev.t.Start {
// points outside requested interval aren't contribute to series weight
continue
if ev.t.Time[k] < ev.t.Start {
continue // skip points before requested interval start
}
if ev.t.End <= ev.t.Time[k] {
break // discard points after requested interval end
}
v := (*data)[k]
if !math.IsNaN(v) {
Expand Down

0 comments on commit 1991ec1

Please sign in to comment.