Converts multiple arrays of the ARRAY data type into a single array.
Syntax
flatten(arrayOfArray)Parameters
arrayOfArray: arrays of the ARRAY data type.
Return value
Multiple arrays of the ARRAY data type are converted into a single array in the order of the elements.
If the input value is
null, null is returned.If the input parameters are not arrays of the ARRAY data type, an error is returned.
Examples
SELECT flatten(array(array(1, 2), array(3, 4)));The following result is returned:
[1,2,3,4]Related functions
FLATTEN is a complex type function. For more information about the functions that are used to process data of complex data types, such as ARRAY, MAP, STRUCT, and JSON, see Complex type functions.