Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Transforms values in a map in expr using the function func.
Syntax
transform_values(expr, func)
Arguments
expr: A MAP expression.func: A lambda function.
Returns
A MAP where the values have the type of the result of the lambda functions and the keys have the type of the expr MAP keys.
The lambda function must have 2 parameters. The first parameter represents the key. The second parameter represents the value.
The lambda function produces a new value for each entry in the map.
Examples
> SELECT transform_values(map_from_arrays(array(1, 2, 3), array(1, 2, 3)), (k, v) -> v + 1);
{1 -> 2, 2 -> 3, 3 -> 4}
> SELECT transform_values(map_from_arrays(array(1, 2, 3), array(1, 2, 3)), (k, v) -> k + v);
{1 -> 2, 2 -> 4, 3 -> 6}