TO_BITMAP
Descriptionβ
Converts an unsigned bigint to a Bitmap.
The input is an unsigned bigint with a value in the range 0 to 18446744073709551615, and the output is a Bitmap containing that element.
Syntaxβ
TO_BITMAP(<expr>)
Parametersβ
Parameter | Description |
---|---|
<expr> | An unsigned bigint with a range of 0 to 18446744073709551615 |
Return Valueβ
A Bitmap containing the corresponding bigint.
Returns NULL
if the input value is not within the specified range.
Examplesβ
To convert an integer to a Bitmap and count the number of elements in the Bitmap:
select bitmap_count(to_bitmap(10));
The result will be:
+-----------------------------+
| bitmap_count(to_bitmap(10)) |
+-----------------------------+
| 1 |
+-----------------------------+
To convert a negative integer to a Bitmap, which is outside the valid range, and convert it to a string:
select bitmap_to_string(to_bitmap(-1));
The result will be:
+---------------------------------+
| bitmap_to_string(to_bitmap(-1)) |
+---------------------------------+
| |
+---------------------------------+