fix(query) Long lookback queries with or vector() operations fail to materialize #1547
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Queries like
sum(rate(foo{}[long look back])) or vector(0)
fail to materialize. This is aBinaryJoin
withrhs
having aScalarFixedDoublePlan
. Long time range planner for long lookbacks exceeding raw cluster retention get pushed down to downsample cluster and changes the end time. Following code in LongTimeRangePlanner specifically did this update to end timeThe issue however comes from the fact that
ScalarFixedDoublePlan
uses seconds precision butlhs
of theBinaryJoin
stores the milliseconds for end time without truncation which causes the assertion inBinaryJoin
to check the end date to fail.Since
latestDownsampleTimestampFn
is the latest downsample time in milliseconds and we support a minimum granularity between samples to a second, we truncate this time to latest second dropping the 1/1000th seconds .Pull Request checklist