Skip to main content

MAP_VALUES

Description

Extracts the values from a given MAP into an ARRAY of the corresponding type.

Syntax

MAP_VALUES(<map>)

Parameters

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

Return Value

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

Usage Notes

  1. For NULL parameters, returns NULL.
  2. For empty MAP objects, returns an empty array.
  3. NULL values in the MAP are also included in the returned array.

Examples

  1. Regular parameters

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

    select map_values(null);
    +------------------+
    | map_values(null) |
    +------------------+
    | NULL |
    +------------------+