MAP_SIZE
Description
Calculates the number of elements in a Map
Syntax
MAP_SIZE(<map>)
Parameters
<map>
MAP
type, the input map content.
Return Value
Returns the number of elements in the Map
Usage Notes
- Both NULL keys and values are counted.
- For NULL parameters, returns NULL.
Examples
-
Regular parameters
select map_size(map()), map_size(map(1, "100", 0.1, 2, null, null));
+-----------------+---------------------------------------------+
| map_size(map()) | map_size(map(1, "100", 0.1, 2, null, null)) |
+-----------------+---------------------------------------------+
| 0 | 3 |
+-----------------+---------------------------------------------+ -
NULL parameters
select map_size(NULL);
+----------------+
| map_size(NULL) |
+----------------+
| NULL |
+----------------+