MAP_FILTER (Lakehouse v1)
Filters key-value pairs from a map using a lambda expression to define the condition.
SQL Syntax
Section titled “SQL Syntax”MAP_FILTER(<map>, (<key>, <value>) -> <condition>)Return Type
Section titled “Return Type”Returns a map that includes only the key-value pairs meeting the condition specified by the lambda expression.
SQL Examples
Section titled “SQL Examples”This example returns a map containing only the products with stock quantities below 10:
SELECT MAP_FILTER({101:15, 102:8, 103:12, 104:5}, (product_id, stock) -> (stock < 10)) AS low_stock_products;
┌────────────────────┐│ low_stock_products │├────────────────────┤│ {102:8,104:5} │└────────────────────┘