Documentation

    list_filter

    Keep the list items for which a lambda expression returns true. The lambda result must be convertible to BOOLEAN, and the output has the same type as the input list.

    Also available as array_filter, filter.

    Try an expression

    In Formula, enter the expression and set Output type to VARCHAR.

    Expression

    list_filter([3, 4, 5], lambda x : x > 4)

    Result

    '[5]'

    The expression returns INTEGER[]. Formula stores it as VARCHAR in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.

    Arguments and types

    list_filter(list, lambda(x))
    list
    List
    lambda(x)
    Lambda expression
    Supported signatures (1)
    list_filter(list: ANY[], lambda(x): LAMBDA) → ANY[]

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Things to know

    If the first argument is missing, the result is NULL.

    Browse lists & arraysDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.