VeloDB Cloud
SQL Manual
Functions
bitmap-functions
to_bitmap

to_bitmap

Description

Syntax:

BITMAP TO_BITMAP(expr)

This function converts an unsigned bigint ranging from 0 to 18446744073709551615 to a bitmap containing the input value. If the input value is beyond the above range, it will return null. This function is mainly used to load integer value into bitmap fields in stream load tasks. For example,

cat data | curl --location-trusted -u user:passwd -T - -H "columns: dt,page,user_id, user_id=to_bitmap(user_id)"   http://host:8410/api/test/testDb/_stream_load

Example

mysql> select bitmap_count(to_bitmap(10));
+-----------------------------+
| bitmap_count(to_bitmap(10)) |
+-----------------------------+
|                           1 |
+-----------------------------+

MySQL> select bitmap_to_string(to_bitmap(-1));
+---------------------------------+
| bitmap_to_string(to_bitmap(-1)) |
+---------------------------------+
|                                 |
+---------------------------------+

Keywords

TO_BITMAP,BITMAP