TRANSFORM
functionsupportedCore SQL functionsTransforms an array based on the logic in a lambda expression.
Syntax
TRANSFORM( <array> , <lambda_expression> )
Parameters
| Name | Required | Description |
|---|---|---|
array | required | The array that contains the elements to be transformed. The array can be semi-structured or structured. |
lambda_expression | required | A lambda expression that defines the transformation logic on each array element. The lambda expression must have only one argument specified in the following syntax:Copy code <arg> [ <datatype> ] -> <expr> |
Returns
The return type of this function is a semi-structured or structured array of the lambda expression result. If either argument is NULL, the function returns NULL without reporting an error.
Usage notes
- When the data type for the lambda argument is explicitly specified, the array element is coerced into the specified type before lambda invocation. For information about coercion, see Data type conversion.
- When there is no data type specified for the lambda argument, its data type is derived from the input array as follows: If the input array is semi-structured, the data type of the lambda argument is VARIANT.
- If the input array is structured, the data type of the lambda argument is the data type of the array element.
- For semi-structured array input, a semi-structured array is returned. For structured array input, a structured array of the lambda expression result type is returned.