duplicate() function

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:* Record

  1. 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*

If the as column already exists, this function will overwrite the existing values.

Examples

  1. from(bucket: "example-bucket")
  2. |> range(start:-5m)
  3. |> filter(fn: (r) => r._measurement == "cpu")
  4. |> duplicate(column: "host", as: "server")