pivot_array

Description

Converts an array of “key”-“value” pairs into an object with key-value attributes. Note: int64 numbers will be converted to float64 and may lose precision.

Return type

object

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

pivot_array( array, keyFieldName, valueFieldName )

Argument

Type

Required

Multiple

array

array

Required

Only one

keyFieldName

string

Required

Only one

valueFieldName

string

Required

Only one

Examples

pivot_array(array(FIELD.foo), "key", "value")

Converts ‘[{“key”: “k1”, “value”: “v1”} {“key”: “k2”, “value”: “v2”}, …]’ in column values to ‘{“k1”: “v1”, “k2”: “v2”, …}’

Aliases

array_pivot (deprecated)