Skip to content

support static data range, rollup priorities#9475

Open
pjain1 wants to merge 3 commits into
mainfrom
rollup_followups
Open

support static data range, rollup priorities#9475
pjain1 wants to merge 3 commits into
mainfrom
rollup_followups

Conversation

@pjain1
Copy link
Copy Markdown
Member

@pjain1 pjain1 commented May 20, 2026

Adds data_time_range for rollups and the base metrics view as well to declare coverage statically, and changes the same-grain selection tiebreaker to definition order to express rollup priority.

  • New data_time_range field on the metrics view and on each rollup. Accepts a rilltime expression (e.g. -1Y to now, -5Y to -1Y, inf). When set, the OLAP min/max probe for that table is skipped and the declared bounds are used for coverage checks.
  • Selection tiebreaker: among rollups that pass eligibility and coverage with the same grain, the earlier-defined one wins (was: smallest data range). This is for priority routing across same-grain rollups with overlapping dimensions.

Example

type: metrics_view
version: 1
model: events
timeseries: timestamp
data_time_range: -5Y to now     # base coverage; skips the base min/max probe

dimensions:
...
measures:
...

rollups:
  # Priority 1 — fewest rows for publisher-only queries
  - model: rollup_publisher
    time_grain: day
    data_time_range: -1Y to now
    dimensions: [publisher]
    measures:   [total_impressions]

  # Priority 2 — answers publisher+domain queries the above can't
  - model: rollup_pub_domain
    time_grain: day
    data_time_range: -1Y to now
    dimensions: [publisher, domain]
    measures:   [total_impressions]

  # Historical tier — older queries that the day rollups don't cover
  - model: rollup_monthly_archive
    time_grain: month
    data_time_range: -5Y to -1Y
    dimensions: [publisher, domain]
    measures:   [total_impressions]

A publisher-only query for last week routes to rollup_publisher. Adding a domain filter routes to rollup_pub_domain. A query 2 years back routes to rollup_monthly_archive. A query going over both windows falls back to the base.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@pjain1 pjain1 marked this pull request as draft May 20, 2026 15:36
@pjain1 pjain1 requested a review from begelundmuller May 22, 2026 13:17
@pjain1 pjain1 marked this pull request as ready for review May 22, 2026 13:17
@pjain1 pjain1 requested a review from nishantmonu51 May 22, 2026 13:17
Copy link
Copy Markdown
Collaborator

@nishantmonu51 nishantmonu51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 , LGTM.

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.

2 participants