This documentation is related to an older version of Firebolt. For the most current documentation, see Firebolt documentation.
ANY_MATCH
Returns 1
if at least one of the elements of an array matches the results of the function provided in the <function>
parameter. Otherwise returns 0
.
Syntax
ANY_MATCH(<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 matched with the function. | Any array |
Return Types
- Returns
1
if the conditions are met - Returns
0
if the conditions are not met
Example
Because there are values in the levels
greater than 3
, the function returns 1
.
SELECT
ANY_MATCH(x -> x > 3, [ 1, 2, 3, 9 ]) AS levels;
Returns: 1
As there is no level 10
in the array, the function returns 0
.
SELECT
ANY_MATCH(x -> x = 10, [ 1, 2, 3, 9 ]) AS levels;
Returns: 0