{"a":1, "b":2}. One key-value pair constitutes one element. {"a":1, "b":2} contains two elements.
This function is supported from v3.0 onwards. It is the alias of map_size().
Syntax
Parameters
any_map: the MAP value from which you want to retrieve the number of elements.
Return value
Returns a value of the INT value. If the input is NULL, NULL is returned. If a key or value in the MAP value is NULL, NULL is processed as a normal value.Examples
Query MAP data from a native table
From v3.1 onwards, the database supports defining MAP columns when you create a table. This example uses tabletest_map, which contains the following data:
col_map column.
Query MAP data from data lake
This example uses Hive tablehive_map, which contains the following data:
col_map column.