concat_arrays

Description

Returns a concatenation of N arrays array1, array2, arrayN.

concat_arrays accepts both ARRAY and VARIANT data types, but VARIANT columns that are not actually ARRAYs will be skipped. Null values will also be skipped.

Return type

generic array

Domain

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

Categories

Usage

concat_arrays(array, array_1, array_2, ...)

Argument

Type

Optional

Repeatable

Restrictions

array

array

no

no

none

array

array

no

yes

none

Examples

make_col foo:concat_arrays(make_array(1, 2), make_array(3), make_array("abc"))

Creates a column foo with an array that contains the concatenation of all items in the input arguments, e.g., [1, 2, 3, “abc”].

make_col foo:concat_arrays(make_array(1, 2), bar, baz, data)

Assume that bar is a variant that wraps the array [3]. Assume that baz is a variant that wraps a string “str”. Assume that data is a NULL array.

Creates a column foo with an array that contains the concatenation of all items in the input arguments as follows. Content of make_array(1, 2) is picked as it is actually an array. Content of bar is picked as it is actually an array. baz is skipped as it is not an array. data is also skipped, as it is null. The content of foo is then [1, 2. 3].