Link Search Menu Expand Document

ARRAY_FILL

Scans through the given array from the first to the last element and replaces array[i] with array[i - 1] if the <function> returns 0. The first element of the given array is not replaced.

The Lambda function <function> is mandatory.

Syntax

ARRAY_FILL(<function>, <array>)

Parameters

Parameter Description Supported input types
<function> A Lambda function used to check elements in the array. Any Lambda function
<array> The array to be evaluated by the function. Any array

Return Type

ARRAY of the same type as the input array

Example

The following example returns an array where all values are greater than 1:

SELECT
	ARRAY_FILL(x -> x > 0, [ 1, 2, 3, 9 ]) AS levels;

Returns: 1,2,3,9