diff --git a/tsdb/tsm1/array_cursor.gen.go b/tsdb/tsm1/array_cursor.gen.go index 9d7d421e6f..61ad5f8e11 100644 --- a/tsdb/tsm1/array_cursor.gen.go +++ b/tsdb/tsm1/array_cursor.gen.go @@ -293,9 +293,11 @@ func (c *floatArrayDescendingCursor) Next() *cursors.FloatArray { } } - if pos > 0 && c.res.Timestamps[pos-1] <= c.end { + // If the earliest timestamp is strictly earlier than + // the end time, remove it from the result and repeat. + if pos > 0 && c.res.Timestamps[pos-1] < c.end { pos -= 2 - for pos >= 0 && c.res.Timestamps[pos] <= c.end { + for pos >= 0 && c.res.Timestamps[pos] < c.end { pos-- } pos++ @@ -603,9 +605,11 @@ func (c *integerArrayDescendingCursor) Next() *cursors.IntegerArray { } } - if pos > 0 && c.res.Timestamps[pos-1] <= c.end { + // If the earliest timestamp is strictly earlier than + // the end time, remove it from the result and repeat. + if pos > 0 && c.res.Timestamps[pos-1] < c.end { pos -= 2 - for pos >= 0 && c.res.Timestamps[pos] <= c.end { + for pos >= 0 && c.res.Timestamps[pos] < c.end { pos-- } pos++ @@ -913,9 +917,11 @@ func (c *unsignedArrayDescendingCursor) Next() *cursors.UnsignedArray { } } - if pos > 0 && c.res.Timestamps[pos-1] <= c.end { + // If the earliest timestamp is strictly earlier than + // the end time, remove it from the result and repeat. + if pos > 0 && c.res.Timestamps[pos-1] < c.end { pos -= 2 - for pos >= 0 && c.res.Timestamps[pos] <= c.end { + for pos >= 0 && c.res.Timestamps[pos] < c.end { pos-- } pos++ @@ -1225,9 +1231,11 @@ func (c *stringArrayDescendingCursor) Next() *cursors.StringArray { } } - if pos > 0 && c.res.Timestamps[pos-1] <= c.end { + // If the earliest timestamp is strictly earlier than + // the end time, remove it from the result and repeat. + if pos > 0 && c.res.Timestamps[pos-1] < c.end { pos -= 2 - for pos >= 0 && c.res.Timestamps[pos] <= c.end { + for pos >= 0 && c.res.Timestamps[pos] < c.end { pos-- } pos++ @@ -1537,9 +1545,11 @@ func (c *booleanArrayDescendingCursor) Next() *cursors.BooleanArray { } } - if pos > 0 && c.res.Timestamps[pos-1] <= c.end { + // If the earliest timestamp is strictly earlier than + // the end time, remove it from the result and repeat. + if pos > 0 && c.res.Timestamps[pos-1] < c.end { pos -= 2 - for pos >= 0 && c.res.Timestamps[pos] <= c.end { + for pos >= 0 && c.res.Timestamps[pos] < c.end { pos-- } pos++ diff --git a/tsdb/tsm1/array_cursor.gen.go.tmpl b/tsdb/tsm1/array_cursor.gen.go.tmpl index ea1f1d0ac5..e10f29b245 100644 --- a/tsdb/tsm1/array_cursor.gen.go.tmpl +++ b/tsdb/tsm1/array_cursor.gen.go.tmpl @@ -300,9 +300,11 @@ func (c *{{$type}}) Next() {{$arrayType}} { } } - if pos > 0 && c.res.Timestamps[pos-1] <= c.end { + // If the earliest timestamp is strictly earlier than + // the end time, remove it from the result and repeat. + if pos > 0 && c.res.Timestamps[pos-1] < c.end { pos -= 2 - for pos >= 0 && c.res.Timestamps[pos] <= c.end { + for pos >= 0 && c.res.Timestamps[pos] < c.end { pos-- } pos++