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,
}
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!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.