Skip to content

Decide SQL temporal aggregate reduction semantics #415

Description

@milindsrivastava1997

What to decide

Decide whether SQL's explicit temporal functions, asap_rate and asap_increase, should lower to Reduction::PerEntity or to a Reduction::Reduce(...) form.

Ordinary SQL aggregates are cross-entity Reduce operations. The current temporal bridge is the exception: it lowers to TimeRange + PerEntity, matching PromQL's per-series range semantics. This choice affects output identity, timestamp retention, schema shape, summary realization, and what SQL's GROUP BY means around a temporal function.

Current behavior

asap_rate(value, ts, window)
  → TimeRange
  → Aggregate { reduction: PerEntity, measures: [Rate] }

The implementation work for #409 will proceed with this existing behavior and expose the derived measure as rate / increase internally. This issue must determine whether that is the intended long-term SQL semantic contract.

Acceptance criteria

  • Record the intended SQL semantics for asap_rate and asap_increase, including entity identity, time-axis behavior, and interaction with GROUP BY.
  • Choose PerEntity or Reduce and explain why the alternative is incorrect or deferred.
  • Specify the required output-schema and SQL alias behavior.
  • Identify any migration or compatibility consequences for existing temporal SQL queries.

Blocked by

None — decision can proceed in parallel with #409, whose current implementation follows the existing PerEntity behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions