ARRAY_FILTER
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Returns a new array containing only the elements for which the provided lambda expression returns true.
<array>: The input array to filter.<lambda>: A lambda expression that takes one parameter and returns a boolean value. Elements for which the lambda returns true are included in the result.
Returns an array containing only the elements where the lambda expression evaluated to true. Returns NULL if the input array is NULL. Returns an empty array if no elements match the condition.
- The lambda expression must return a boolean value. Non-boolean return types result in an error.
- The lambda can’t reference columns or variables from the outer query scope.
- The order of elements in the result matches their order in the input array.
Keep only even numbers from an array.
Returns [2, 4, 6].
Keep strings that don’t contain uppercase letters.
Returns ["abc", "very long string", "lower case"].
Filter nested arrays based on their contents.
Returns [[1, 2, 3], [2, 3, 4]].
Keep elements greater than a threshold.
Returns [25, 30].
Chain ARRAY_FILTER with other array operations.
Returns 3.