ARRAY_REDUCE
Learn how to use the ARRAY_REDUCE array function in PlaidCloud Lakehouse. Applies iteratively the lambda function to the elements of the array, so as to...
Applies iteratively the lambda function to the elements of the array, so as to reduce the array to a single value.
Analyze Syntax
func.array_reduce( <array>, <lambda> )
Analyze Examples
func.array_reduce([1, 2, 3, 4], (x, y) -> (x + y))
┌─────────────────────────────────────────────────────┐
│ func.array_reduce([1, 2, 3, 4], (x, y) -> (x + y)) │
├─────────────────────────────────────────────────────┤
│ 10 │
└─────────────────────────────────────────────────────┘
SQL Syntax
ARRAY_REDUCE( <array>, <lambda> )
SQL Examples
SELECT ARRAY_REDUCE([1, 2, 3, 4], (x,y) -> x + y);
┌───────────────────────────────────────────────┐
│ array_reduce([1, 2, 3, 4], (x, y) -> (x + y)) │
├───────────────────────────────────────────────┤
│ 10 │
└───────────────────────────────────────────────┘