graphprotocol / graphprotocol/graph-node

[Feature] Windowed aggregates

Open
#5,302 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/aggregations enhancement Stale
Dominant language
Rust
Stars
3.2k
Forks
1.1k
Avg merge
4d 1h
Merged PRs (30d)
1

Description

Description

Aggregates can be formed either over the current bucket (hour, day) or the entire lifetime of the underlying timeseries. In some cases, it would also be useful to aggregate over a limited window, e.g., the last 6 hours. That could look something like

  recent_max_price: BigDecimal! @aggregate(fn: "max", arg: "price", window: 6)

The current ways to aggregate would be expressed as window: 1 (default) and window: "all" (lifetime/cumulative)

There's a bunch of things that aren't entirely clear:

  • Is it enough if the window is always an integer multiple of the bucket? Or should we offer expressing arbitrary times there, like window: "90 minutes"
  • How would users express that a windowed aggregate should be done for one interval but not the others, e.g., if the above aggregation is done both hourly and daily, how do you express "only add this to the hourly aggregates"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Begin by reviewing the existing aggregate syntax and how current-bucket and lifetime aggregates work; done requires an agreed window representation and interval scoping, with tests covering bounded, default, and lifetime windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, rust
Domain
api, data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.