Documentation

experimental.fill() function

Flux 0.112.0+

The experimental.fill() function is subject to change at any time. By using this function, you accept the risks of experimental functions.

The experimental.fill() function replaces all null values in the _value column with a non-null value.

import "experimental"

experimental.fill(value: 0.0)

// OR

experimental.fill(usePrevious: true)

Parameters

value and usePrevious are mutually exclusive.

value

Value to replace null values with. Data type must match the type of the _value column.

usePrevious

When true, replaces null values with the value of the previous non-null row.

tables

Input data. Default is piped-forward data (<-).

Examples


Fill null values with a specified non-null value

import "experimental"

data
  |> experimental.fill(value: 0.0)
Input data
_time_value
2021-01-01T00:00:00Z1.2
2021-01-01T00:01:00Z
2021-01-01T00:02:00Z2.3
2021-01-01T00:03:00Z
2021-01-01T00:04:00Z2.8
2021-01-01T00:05:00Z1.1
Output data
_time_value
2021-01-01T00:00:00Z1.2
2021-01-01T00:01:00Z0.0
2021-01-01T00:02:00Z2.3
2021-01-01T00:03:00Z0.0
2021-01-01T00:04:00Z2.8
2021-01-01T00:05:00Z1.1

Fill null values with the previous non-null value

import "experimental"

data
  |> experimental.fill(usePrevious: true)
Input data
_time_value
2021-01-01T00:00:00Z1.2
2021-01-01T00:01:00Z
2021-01-01T00:02:00Z2.3
2021-01-01T00:03:00Z
2021-01-01T00:04:00Z2.8
2021-01-01T00:05:00Z1.1
Output data
_time_value
2021-01-01T00:00:00Z1.2
2021-01-01T00:01:00Z1.2
2021-01-01T00:02:00Z2.3
2021-01-01T00:03:00Z2.3
2021-01-01T00:04:00Z2.8
2021-01-01T00:05:00Z1.1

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.