MAP_DELETE

Learn how to use the MAP_DELETE map function in PlaidCloud Lakehouse. Returns an existing MAP with one or more keys removed. Includes syntax and examples.

Returns an existing MAP with one or more keys removed.

SQL Syntax

MAP_DELETE( <map>, <key1> [, <key2>, ... ] )
MAP_DELETE( <map>, <array> )

Arguments

ArgumentsDescription
<map>The MAP that contains the KEY to remove.
<keyN>The KEYs to be omitted from the returned MAP.
<array>The Array of KEYs to be omitted from the returned MAP.

:::note

  • The types of the key expressions and the keys in the map must be the same.
  • Key values not found in the map will be ignored. :::

Return Type

Map.

SQL Examples

SELECT MAP_DELETE({'a':1,'b':2,'c':3}, 'a', 'c');
┌───────────────────────────────────────────┐
 map_delete({'a':1,'b':2,'c':3}, 'a', 'c') 
├───────────────────────────────────────────┤
 {'b':2}                                   
└───────────────────────────────────────────┘

SELECT MAP_DELETE({'a':1,'b':2,'c':3}, ['a', 'b']);
┌─────────────────────────────────────────────┐
 map_delete({'a':1,'b':2,'c':3}, ['a', 'b']) 
├─────────────────────────────────────────────┤
 {'c':3}                                     
└─────────────────────────────────────────────┘