feat: fill in NaN values when buffers dont contain requested data at the start or end of the buffers

This commit is contained in:
Aditya Ujeniya
2026-07-20 13:35:31 +02:00
parent f83f8afa86
commit 7b8668b8e4
5 changed files with 160 additions and 51 deletions
+4 -5
View File
@@ -298,15 +298,14 @@ func (l *Level) toCheckpointFile(from, to int64, m *MemoryStore) (*CheckpointFil
}
data := make([]schema.Float, (to-from)/b.frequency+1)
data, start, end, err := b.read(from, to, data)
// trim=true: read() returns only the real data extent, sliced so that
// Data[0] aligns with Start (the checkpoint reload contract).
data, start, _, err := b.read(from, to, data, true)
if err != nil {
return nil, err
}
for i := int((end - start) / b.frequency); i < len(data); i++ {
data[i] = schema.NaN
}
retval.Metrics[metric] = &CheckpointMetrics{
Frequency: b.frequency,
Start: start,