content/flux/v0/stdlib/experimental/group.md
experimental.group() introduces an extend mode to the existing group() function.
(<-tables: stream[A], columns: [string], mode: string) => stream[A] where A: Record
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
({{< req >}})
List of columns to use in the grouping operation. Default is [].
({{< req >}})
Grouping mode. extend is the only mode available to experimental.group().
columns parameter to group keys.Input data. Default is piped-forward data (<-).
import "experimental"
data
|> experimental.group(columns: ["region"], mode: "extend")
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | *host | region | _value |
|---|---|---|---|
| 2021-01-01T00:00:00Z | host1 | east | 41 |
| 2021-01-01T00:01:00Z | host1 | east | 48 |
| 2021-01-01T00:00:00Z | host1 | west | 34 |
| 2021-01-01T00:01:00Z | host1 | west | 12 |
| _time | *host | region | _value |
|---|---|---|---|
| 2021-01-01T00:00:00Z | host2 | east | 56 |
| 2021-01-01T00:01:00Z | host2 | east | 72 |
| 2021-01-01T00:00:00Z | host2 | west | 43 |
| 2021-01-01T00:01:00Z | host2 | west | 22 |
| _time | *host | *region | _value |
|---|---|---|---|
| 2021-01-01T00:00:00Z | host1 | east | 41 |
| 2021-01-01T00:01:00Z | host1 | east | 48 |
| _time | *host | *region | _value |
|---|---|---|---|
| 2021-01-01T00:00:00Z | host1 | west | 34 |
| 2021-01-01T00:01:00Z | host1 | west | 12 |
| _time | *host | *region | _value |
|---|---|---|---|
| 2021-01-01T00:00:00Z | host2 | east | 56 |
| 2021-01-01T00:01:00Z | host2 | east | 72 |
| _time | *host | *region | _value |
|---|---|---|---|
| 2021-01-01T00:00:00Z | host2 | west | 43 |
| 2021-01-01T00:01:00Z | host2 | west | 22 |
{{% /expand %}} {{< /expand-wrapper >}}