FILTER

functionsupportedCore SQL functions

docs.snowflake.com ↗

Semi-structured and structured data functions

Filters an array based on the logic in a lambda expression.

Syntax

FILTER( <array> , <lambda_expression> )

Parameters

NameRequiredDescription
arrayrequiredThe array that contains the elements to be filtered. The array can be semi-structured or structured.
lambda_expressionrequiredA lambda expression that defines the filter condition on each array element. The lambda expression must have only one argument specified in the following syntax:Copy code <arg> [ <datatype> ] -> <expr>

Returns

The return type of this function is an array of the same type as the input array. The returned array contains the elements for which the filter condition returns TRUE. If either argument is NULL, the function returns NULL without reporting an error.

Usage notes

See also