-> operator, which reads “goes to”. The left side of -> is the input parameters (if any) and the right side is an expression.
From v2.5 onwards, the database supports using lambda expressions in the following higher-order SQL functions: array_map(), array_filter(), array_sum(), and array_sortby().
Syntax
Parameters
-
parameter: the input parameters for the lambda expression, which can accept zero, one, or more parameters. Two or more input parameters are enclosed in parentheses. -
expression: a simple expression that referencesparameter. The expression must be valid for the input parameters.
Return value
The type of the return value is determined by the result type ofexpression.
Usage notes
Almost all scalar functions can be used in a lambda body. But there are a few exceptions:- Subqueries are not supported, for example,
x -> 5 + (SELECT 3). - Aggregate functions are not supported, for example,
x -> min(y). - Window functions are not supported.
- Table functions are not supported.
- Correlated columns cannot occur in lambda functions.