Seddryck / Tseesecake

Tseesecake is a lightweight proxy for time-series query engines, supporting multiple database engines and storage providers, with a SQL dialect dedicated to time series
https://seddryck.github.io/Tseesecake
Apache License 2.0
2 stars 1 forks source link

Define default aggregation for a measurement #70

Open Seddryck opened 11 months ago

Seddryck commented 11 months ago

It should be possible to define a default aggregation for each measurement when specifying the Timeseries. The default aggregation is defined by the keyword DEFAULT AGGREGATION. Values can be all aggregations except COUNT.

CREATE TIMESERIES WindEnergy AS (
...
    Forecasted MEASUREMENT DEFAULT AGGREGATION SUM,
...
)

The default aggregation can be used anywhere by replacing the explicit aggregation by the keyword AGGREGATE.

SELECT
    Instant,
    AGGREGATE(Forecasted)
FROM
    WindEnergy

should be equivalent to

SELECT
    Instant,
    SUM(Forecasted)
FROM
    WindEnergy