Skip to content

Add Native Support for List Functions (Dependent on Lambda Support) #14509

@berkaysynnada

Description

@berkaysynnada

Is your feature request related to a problem or challenge?

Working with nested list data requires cumbersome unnesting and re-aggregation steps. Native list functions (list_transform, list_filter, and list_reduce) would let users directly operate on list types with concise, expressive syntax, improving both usability and performance.

This feature relies on support for lambda functions which is tracked in (#14205).

Describe the solution you'd like

Implement native list functions that operate directly on nested list types using lambda expressions. For example:

list_transform: Apply a lambda function to each element in a list.
list_filter: Filter list elements based on a lambda predicate.
list_reduce: Aggregate list elements using a lambda function.

Note that the lambda function support itself is not available yet, see #14205 for that work. Once lambdas are supported, these list functions can be built on top of them.

Describe alternatives you've considered

No response

Additional context

Example:

INSERT INTO foo VALUES 
    ([1], 10),
    ([1, 2, 3], 5),
    ([-1, NULL, 2], 7);


SELECT list_transform(col_a, x -> x + col_b) AS transformed_foo
FROM foo;

transformed_foo:
[11]
[6, 7, 8]
[6, NULL, 9]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions