Converts an array of arrays into a flat array. This means for every element that is an array, this function extracts its elements into the new array. The resulting flattened array contains all the elements from all source arrays.
- Applies to any depth of nested arrays.
- Does not change arrays that are already flat.
|Parameter||Description||Supported input types|
| ||The array of arrays to be flattened||Any |
ARRAY of the same type as the input array
The following example flattens multiple arrays of level IDs:
SELECT FLATTEN([ [ [ 1, 2 ] ], [ [ 2, 3 ], [ 3, 4 ] ] ])
[1, 2, 2, 3, 3, 4]