Documentation

aggregate.define() function

aggregate.define() is a user-contributed function maintained by the package author and can be updated or removed at any time.

aggregate.define() constructs an aggregate function record.

Function type signature
(
    compute: A,
    init: B,
    reduce: C,
    ?fill: D,
) => (
    ?column: E,
    ?fill: F,
) => {
    reduce: C,
    init: B,
    fill: F,
    compute: A,
    column: E,
}
For more information, see Function type signatures.

Parameters

init

(Required) Function to compute the initial state of the output. This can return either the final aggregate or a temporary state object that can be used to compute the final aggregate. The values parameter will always be a non-empty array of values from the specified column.

reduce

(Required) Function that takes in another buffer of values and the current state of the aggregate and computes the updated state.

compute

(Required) Function that takes the state and computes the final aggregate.

fill

Value passed to fill(). If present, the fill value determines what the aggregate does when there are no values. This can either be a value or one of the predefined identifiers, null or none. This value must be the same type as the value return from compute.


Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.