experimental.set() function

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

The experimental.set() function sets multiple static column values on all records. If a column already exists, the function updates the existing value. If a column does not exist, the function adds it with the specified value.

Once sufficiently vetted, experimental.set() will replace the existing set() function.

*Function type: Transformation*

  1. import "experimental"
  2. experimental.set(
  3. o: {column1: "value1", column2: "value2"}
  4. )

Parameters

o

A record that defines the columns and values to set. The key of each key-value pair defines the column name. The value of each key-value pair defines the column value.

*Data type: Record*

Examples

Set values for multiple columns

Example input table
_time_field_value
2019-09-16T12:00:00Ztemp71.2
2019-09-17T12:00:00Ztemp68.4
2019-09-18T12:00:00Ztemp70.8
Example query
  1. import "experimental"
  2. data
  3. |> experimental.set(
  4. o: {
  5. _field: "temperature",
  6. unit: "°F",
  7. location: "San Francisco"
  8. }
  9. )
Example output table
_time_field_valueunitlocation
2019-09-16T12:00:00Ztemperature71.2°FSan Francisco
2019-09-17T12:00:00Ztemperature68.4°FSan Francisco
2019-09-18T12:00:00Ztemperature70.8°FSan Francisco

Related articles