Categories:

Semi-structured and structured data functions (Map)

MAP_KEYS¶

Returns the keys in a MAP.

Syntax¶

MAP_KEYS( <map> )
Copy

Arguments¶

map

The input map.

Returns¶

Returns a structured ARRAY containing the keys in the MAP. The order of the keys is undefined.

Examples¶

List the keys in a map:

SELECT MAP_KEYS({'a':1,'b':2,'c':3}::MAP(VARCHAR,NUMBER))
  AS map_keys;
Copy
+----------+
| MAP_KEYS |
|----------|
| [        |
|   "a",   |
|   "b",   |
|   "c"    |
| ]        |
+----------+