docs-v2/content/flux/v0.x/stdlib/experimental/table/fill.md

2.6 KiB

title description menu weight flux/v0.x/tags
table.fill() function `table.fill()` adds a single row to empty tables in a stream of tables.
flux_0_x_ref
name parent identifier
table.fill experimental/table experimental/table/fill
201
transformations
table

table.fill() adds a single row to empty tables in a stream of tables.

Columns that are in the group key are filled with the column value defined in the group key. Columns not in the group key are filled with a null value.

Function type signature
(<-tables: stream[A]) => stream[A] where A: Record

{{% caption %}}For more information, see Function type signatures.{{% /caption %}}

Parameters

tables

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

Examples

Fill empty tables

import "experimental/table"
import "sampledata"

data =
    sampledata.int()
        |> filter(fn: (r) => r.tag != "t2", onEmpty: "keep")

data
    |> table.fill()

{{< expand-wrapper >}} {{% expand "View example input and ouput" %}}

Input data

_time _value *tag
2021-01-01T00:00:00Z -2 t1
2021-01-01T00:00:10Z 10 t1
2021-01-01T00:00:20Z 7 t1
2021-01-01T00:00:30Z 17 t1
2021-01-01T00:00:40Z 15 t1
2021-01-01T00:00:50Z 4 t1
_time _value *tag

Output data

_time _value *tag
2021-01-01T00:00:00Z -2 t1
2021-01-01T00:00:10Z 10 t1
2021-01-01T00:00:20Z 7 t1
2021-01-01T00:00:30Z 17 t1
2021-01-01T00:00:40Z 15 t1
2021-01-01T00:00:50Z 4 t1
_time _value *tag
t2

{{% /expand %}} {{< /expand-wrapper >}}