Skip to content

Commit 7e4b396

Browse files
hazgeMarat Karimov
andauthored
Fix end in select in some cases was inclusive (#54)
Co-authored-by: Marat Karimov <mkarimov@ourgapps.com>
1 parent 02fa0b2 commit 7e4b396

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

memory_partition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func (m *memoryMetric) selectPoints(start, end int64) []*DataPoint {
233233
})
234234
}
235235

236-
if end >= maxTimestamp {
236+
if end > maxTimestamp {
237237
endIdx = int(size)
238238
} else {
239239
// Use binary search because points are in-order.

memory_partition_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func Test_memoryPartition_SelectDataPoints(t *testing.T) {
8787
name: "select some points",
8888
metric: "metric1",
8989
start: 2,
90-
end: 4,
90+
end: 5,
9191
memoryPartition: func() *memoryPartition {
9292
m := newMemoryPartition(nil, 0, "").(*memoryPartition)
9393
m.insertRows([]Row{
@@ -117,6 +117,7 @@ func Test_memoryPartition_SelectDataPoints(t *testing.T) {
117117
want: []*DataPoint{
118118
{Timestamp: 2, Value: 0.1},
119119
{Timestamp: 3, Value: 0.1},
120+
{Timestamp: 4, Value: 0.1},
120121
},
121122
},
122123
{

0 commit comments

Comments
 (0)