docs/en/sql-reference/sql-functions/array-functions/array_to_bitmap.md
Converts an array into BITMAP values. This function is supported from v2.3.
BITMAP array_to_bitmap(array)
array: Elements in an array can be of the BIGINT, INT, TINYINT, or SMALLINT type.
Returns a value of the BITMAP type.
If the data type of elements in the input array is invalid, such as STRING or DECIMAL, an error is returned.
If an empty array is entered, an empty BITMAP value is returned.
If NULL is entered, NULL is returned.
Example 1: Convert an array into BITMAP values. This function must be nested in bitmap_to_array because BITMAP values cannot be displayed.
MySQL > select bitmap_to_array(array_to_bitmap([1,2,3]));
+-------------------------------------------+
| bitmap_to_array(array_to_bitmap([1,2,3])) |
+-------------------------------------------+
| [1,2,3] |
+-------------------------------------------+
Example 2: Enter an empty array and an empty array is returned.
MySQL > select bitmap_to_array(array_to_bitmap([]));
+--------------------------------------+
| bitmap_to_array(array_to_bitmap([])) |
+--------------------------------------+
| [] |
+--------------------------------------+
Example 3: Enter NULL and NULL is returned.
MySQL > select array_to_bitmap(NULL);
+-----------------------+
| array_to_bitmap(NULL) |
+-----------------------+
| NULL |
+-----------------------+