Skip to main content
Last updated on

MAP_KEYS

Description​

Extracts the keys from a given map into an ARRAY of the corresponding type.

Syntax​

MAP_KEYS(<map>)

Parameters​

  • <map> MAP type, the input map content.

Return Value​

Extracts the keys from a given map into an ARRAY of the corresponding type.

Examples​

  1. Regular parameters
    select map_keys(map()),map_keys(map(1, "100", 0.1, 2, null, null));
    +-----------------+---------------------------------------------+
    | map_keys(map()) | map_keys(map(1, "100", 0.1, 2, null, null)) |
    +-----------------+---------------------------------------------+
    | [] | [1.0, 0.1, null] |
    +-----------------+---------------------------------------------+
  2. NULL parameters
    select map_keys(NULL);
    +----------------+
    | map_keys(NULL) |
    +----------------+
    | NULL |
    +----------------+