ARRAY.OF
Converts any value to an array.
Converts any value to an array.
- If the
input
argument is already an array, Tamr applies theconversion_function
to all elements ofinput
. - If the
input
argument is not an array, Tamr applies theconversion_function
directly to it, then wraps the result in an array as the sole element.
The output type of the conversion_function
defines the type for the contents of the output array.
Tip: To find the function that best meets your needs, review similar function ARRAY.
SYNTAX
array.of(conversion_function, input)
conversion_function
- Type: function
- Description: The function to apply to the input or, if the input is already an array, to all elements of the input. This function must take any type.
input
- Type: any
- Description: The value to convert to an array whose contents are typed according to the
conversion_function
.
OUTPUT
Array
EXAMPLES
SELECT array.of(to_string, doubleCol) as stringArrayCol
doubleCol | --> | stringArrayCol |
---|---|---|
-1.1 | ['-1.1'] | |
0 | ['0'] | |
1.1 | ['1.1'] |
SELECT array.of(to_double, stringArrayCol) as doubleArrayCol
stringArrayCol | --> | doubleArrayCol |
---|---|---|
['-1.1', '0', '1.1'] | [-1.1, 0, 1.1] | |
[null, 'one', '55.55'] | [null, null, 55.55] |
Updated about 2 years ago