Skip to content

Running / cumulative aggregates on time-bucket primitive #1607

@rubenvdlinde

Description

@rubenvdlinde

Deferred from: add-time-bucket-aggregation (see openspec/changes/add-time-bucket-aggregation/proposal.md Non-goals).

The first cut emits one bucket value per date_trunc group. Dashboards commonly want running totals (cumulative count, rolling avg). Out of scope because:

  • Postgres path needs window functions (SUM(...) OVER (ORDER BY bucket)) — non-trivial composition with the RBAC predicate.
  • PHP fallback would need a separate accumulation pass.
  • Solr / ES handle this via cumulative_sum pipelines (ES) or stats + post-processing — different translator surface.

Scope when picked up:

  • New optional AggregationQuery::window: { type: 'cumulative' | 'rolling', size?: int }.
  • Postgres window-function emission in tryNativeAggregation().
  • PHP polyfill in the fallback path.
  • GraphQL: GroupByInput.window: WindowInput.
  • REST: query params window=cumulative / window=rolling&windowSize=7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions