Skip to content

Applies iteratively the lambda function to the elements of the array, so as to reduce the array to a single value.

func.array_reduce( <array>, <lambda> )
func.array_reduce([1, 2, 3, 4], (x, y) -> (x + y))
┌─────────────────────────────────────────────────────┐
│ func.array_reduce([1, 2, 3, 4], (x, y) -> (x + y)) │
├─────────────────────────────────────────────────────┤
10
└─────────────────────────────────────────────────────┘
ARRAY_REDUCE( <array>, <lambda> )
SELECT ARRAY_REDUCE([1, 2, 3, 4], (x,y) -> x + y);
┌───────────────────────────────────────────────┐
│ array_reduce([1, 2, 3, 4], (x, y) -> (x + y)) │
├───────────────────────────────────────────────┤
10
└───────────────────────────────────────────────┘