graphprotocol / graphprotocol/graph-node
[Feature] Windowed aggregates
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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