Closed alejandrodnm closed 1 year ago
I'll add a test to check that we are getting just one chunk
Can you explain somewhere what it was that we got wrong in the previous implementation?
Can you explain somewhere what it was that we got wrong in the previous implementation?
done
When using
from
anduntil
parameters to find chunks in the source, we added aWHERE
statement to filter chunks based on these conditions:For
chunk.range_start < until
, we match chunks that start before the completion point. But ifrange_start
of a chunk equals theuntil
value, the chunk is ignored sinceuntil
is exclusive and this chunk is outside the backfill range.For
from <= chunk.range_end
, we match chunks that end after or at the backfill start. But whenrange_end
equalsfrom
value, this chunk should be ignored, becauserange_end
is exclusive and the chunk falls outside the desired range.Consider the chunks as [start-end) ranges:
The current statement
from <= chunk.range_end
incorrectly matches both chunks. The first chunk doesn't have a time value inside the backfill period becausemax(time) < range_end
inside a chunk.To fix this, we remove the equality from the second condition and match only when
from
is less thanchunk.range_end
.