MAP_TRANSFORM_VALUES (Lakehouse v1)
Applies a transformation to each value in a map using a lambda expression.
SQL Syntax
Section titled “SQL Syntax”MAP_TRANSFORM_VALUES(<map>, (<key>, <value>) -> <value_transformation>)Return Type
Section titled “Return Type”Returns a map with the same keys as the input map but with values modified according to the specified lambda transformation.
SQL Examples
Section titled “SQL Examples”This example reduces each product’s price by 10%, while the product IDs (keys) remain unchanged:
SELECT MAP_TRANSFORM_VALUES({101: 100.0, 102: 150.0, 103: 200.0}, (product_id, price) -> price * 0.9) AS discounted_prices;
┌───────────────────────────────────┐│ discounted_prices │├───────────────────────────────────┤│ {101:90.00,102:135.00,103:180.00} │└───────────────────────────────────┘