fill() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.50 is the most recent stable version of Flux.

The fill() function replaces all null values in an input stream with a non-null value.

Function type: Transformation

fill(column: "_value", value: 0.0)

// OR

fill(column: "_value", usePrevious: true)

Parameters

column

The column in which to replace null values. Defaults to "_value".

Data type: String

value

The constant value to use in place of nulls. The value type must match the value type of the column.

Data type: Boolean | Integer | UInteger | Float | String | Time | Duration

usePrevious

When true, assigns the value set in the previous non-null row.

Cannot be used with value.

Data type: Boolean | Integer | UInteger | Float | String | Time | Duration

Examples

Fill null values with a specified non-null value
from(bucket: "telegraf/autogen")
  |> range(start: -1h)
  |> filter(fn: (r) =>
    r._measurement == "cpu" and
    r.cpu == "cpu-total"
  )
  |> fill(value: 0.0)
Fill null values with the previous non-null value
from(bucket: "telegraf/autogen")
  |> range(start: -1h)
  |> filter(fn: (r) =>
    r._measurement == "cpu" and
    r.cpu == "cpu-total"
  )
  |> fill(usePrevious: true)

FILL