CkRollupFunction
Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData
Aggregation function applied by a CkRollupAggregation. Mirrors the values of the
CkRollupFunction CK enum from the StreamData CK model so lifecycle / orchestrator code
does not have to depend on the generated CK enum.
public enum CkRollupFunction
Inheritance Object → ValueType → Enum → CkRollupFunction
Implements IComparable, ISpanFormattable, IFormattable, IConvertible
Remarks:
CkRollupFunction.Avg is materialised at storage time as two columns ({name}_sum and
{name}_count) so chained re-aggregation (rollup-of-a-rollup) stays numerically correct.
The single-column average is computed on read as sum / NULLIF(count, 0).
CkRollupFunction.TimeWeightedAvg follows the same pattern with an integral/duration pair —
see concept-time-weighted-aggregation.md (AB#4336).
Fields
| Name | Value | Description |
|---|---|---|
| Avg | 0 | Arithmetic mean. Stored as sum + count; the average is computed on read. |
| Min | 1 | Minimum value in the bucket. |
| Max | 2 | Maximum value in the bucket. |
| Sum | 3 | Sum of values in the bucket. |
| Count | 4 | Number of non-null values in the bucket. |
| TimeWeightedAvg | 5 | Time-weighted average with last-observation-carried-forward interval weighting, for event-based sources (one row per state change). Stored as an integral (Σ value × Δt in value·milliseconds) + covered-duration (milliseconds) pair; the average is computed on read as integral / NULLIF(duration, 0). On a 0/100 or boolean-like signal this yields the duty cycle per bucket. AB#4336. |
| StateDuration | 6 | Absolute time (milliseconds) the signal held the aggregation's ComparisonValue within the bucket, with the same LOCF carry as CkRollupFunction.TimeWeightedAvg. Stored as a single BIGINT column; chained rollups re-aggregate it with SUM. AB#4336. |
| First | 7 | Value of the source column at the earliest timestamp in the bucket (arg_min over time). Stored as a single column; forward aggregation over a raw source picks the value at MIN(timestamp), cascades pick the child bucket with the smallest window boundary. Numeric source columns only. AB#4188. |
| Last | 8 | Value of the source column at the latest timestamp in the bucket (arg_max over time). Stored as a single column; forward aggregation over a raw source picks the value at MAX(timestamp), cascades pick the child bucket with the largest window boundary. Numeric source columns only. AB#4188. |