spread() function

The spread() function outputs the difference between the minimum and maximum values in each specified column. Only uint, int, and float column types can be used. The type of the output column depends on the type of input column:

  • For input columns with type uint or int, the output is an int
  • For input columns with type float the output is a float.

Function type: Aggregate
Output data type: Integer or Float (inherited from input column type)

spread(columns: ["_value"])



Specifies a list of columns on which to operate. Defaults to ["_value"].

Data type: Array of strings


from(bucket: "telegraf/autogen")
  |> range(start: -5m)
  |> filter(fn: (r) =>
    r._measurement == "cpu" and
    r._field == "usage_system"
  |> spread()


Bug Reports and Feedback

Thank you for being willing to help test InfluxDB v2.0 alpha! Feedback and bug reports are welcome and encouraged both for InfluxDB and this documentation.

Submit feedback in the InfluxData Community