docs-v2/content/v2.0/reference/flux/functions/built-in/transformations/duplicate.md

1.0 KiB

title description aliases menu weight
duplicate() function The `duplicate()` function duplicates a specified column in a table.
/v2.0/reference/flux/functions/transformations/duplicate
v2_0_ref
name parent
duplicate built-in-transformations
401

The duplicate() function duplicates a specified column in a table. If the specified column is part of the group key, it will be duplicated, but will not be part of the output table's group key.

Function type: Transformation
Output data type: Object

duplicate(column: "column-name", as: "duplicate-name")

Parameters

column

The column to duplicate.

Data type: String

as

The name assigned to the duplicate column.

Data type: String

{{% note %}} If the as column already exists, this function will overwrite the existing values. {{% /note %}}

Examples

from(bucket: "telegraf/autogen")
	|> range(start:-5m)
	|> filter(fn: (r) => r._measurement == "cpu")
	|> duplicate(column: "host", as: "server")