Skip to main content

BITMAP_FROM_STRING

Description​

Convert a string into a BITMAP. The string consists of a group of unsigned bigint numbers separated by commas. (The number values are between: 0 ~ 18446744073709551615) For example, the string "0, 1, 2" will be converted into a Bitmap, where the 0th, 1st, and 2nd bits are set. When the input field is invalid, NULL is returned

Syntax​

 BITMAP_FROM_STRING(<str>)

Parameters​

ParameterDescription
<str>Array string, for example "0, 1, 2" string will be converted to a Bitmap with bits 0, 1, 2 set

Return Value​

Returns a BITMAP

  • When the input field is invalid, the result is NULL

Examples​

select bitmap_to_string(bitmap_from_string("0, 1, 2")) bts;
+-------+
| bts |
+-------+
| 0,1,2 |
+-------+
select bitmap_from_string("-1, 0, 1, 2") bfs;
+------+
| bfs |
+------+
| NULL |
+------+
select bitmap_to_string(bitmap_from_string("0, 1, 18446744073709551615")) bts;
+--------------------------+
| bts |
+--------------------------+
| 0,1,18446744073709551615 |
+--------------------------+