Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query) Long lookback queries with or vector() operations fail to materialize #1547

Merged
merged 1 commit into from
Apr 1, 2023

Conversation

amolnayak311
Copy link
Contributor

@amolnayak311 amolnayak311 commented Mar 31, 2023

Queries like sum(rate(foo{}[long look back])) or vector(0) fail to materialize. This is a BinaryJoin with rhs having a ScalarFixedDoublePlan. 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 time

copyLogicalPlanWithUpdatedTimeRange(periodicSeriesPlan,
          TimeRange(periodicSeriesPlan.startMs, latestDownsampleTimestampFn + offsetMillis.min))

The issue however comes from the fact that ScalarFixedDoublePlan uses seconds precision but lhs of the BinaryJoin stores the milliseconds for end time without truncation which causes the assertion in BinaryJoin 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

  • The commit(s) message(s) follows the contribution guidelines ?
  • Tests for the changes have been added (for bug fixes / features) ?
  • Docs have been added / updated (for bug fixes / features) ?

@amolnayak311 amolnayak311 merged commit 4920c0d into filodb:develop Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants