MAP_PICK (Lakehouse v1)
Returns a new MAP containing the specified key-value pairs from an existing MAP.
SQL Syntax
Section titled “SQL Syntax”MAP_PICK( <map>, <key1> [, <key2>, ... ] )MAP_PICK( <map>, <array> )Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
<map> | The input MAP. |
<keyN> | The KEYs to be included from the returned MAP. |
<array> | The Array of KEYs to be included from the returned MAP. |
Return Type
Section titled “Return Type”Map.
SQL Examples
Section titled “SQL Examples”SELECT MAP_PICK({'a':1,'b':2,'c':3}, 'a', 'c');┌─────────────────────────────────────────┐│ map_pick({'a':1,'b':2,'c':3}, 'a', 'c') │├─────────────────────────────────────────┤│ {'a':1,'c':3} │└─────────────────────────────────────────┘
SELECT MAP_PICK({'a':1,'b':2,'c':3}, ['a', 'b']);┌───────────────────────────────────────────┐│ map_pick({'a':1,'b':2,'c':3}, ['a', 'b']) │├───────────────────────────────────────────┤│ {'a':1,'b':2} │└───────────────────────────────────────────┘