Skip to main content
Returns values from an array that matches the given filter. This function comes in the following two forms. The lambda adoption allows for more flexible array filtering. For more information about lambda functions, see Lambda expression. This function is supported from v2.5.

Syntax

  • array_filter(array, array<bool>) Returns values from an array that matches array<bool>.
  • array_filter(lambda_function, arr1,arr2...) Returns values from an array that matches the lambda function.

Parameters

array: the array to filter values from. array<bool>: the expression used to filter values. lambda_function: the lambda function used to filter values.

Usage notes

  • The two input parameters of array_filter(array, array<bool>) must be ARRAY and the filter expression can evaluate to array<bool>.
  • The lambda function in array_filter(lambda_function, arr1,arr2...) follows the usage notes in array_map().
  • If the input array is null, null is returned. If the filter array is null, an empty array is returned.

Examples

  • Examples without using lambda functions
  • Examples using lambda functions