VeloDB Cloud
SQL Manual
Data Types
BITMAP

BITMAP

Description

BITMAP

BITMAP cannot be used as a key column. The aggregation type when creating a table is BITMAP_UNION.

The user does not need to specify the length and default value. The system will determine the length according to the data aggregation degree.

The BITMAP column can only be queried or used by its supporting functions such as bitmap_union_count, bitmap_union, bitmap_hash, and bitmap_hash64.

The use of BITMAP in offline scenarios will slow down the import. When handling large data volume, the query speed will be slower than HLL and faster than Count Distinct.

Note: In real-time scenarios, if BITMAP does not use a global dictionary, using bitmap_hash() may cause an error rate of about 1/1000. You may use bitmap_hash64 for lower error rate.

Example

select hour, BITMAP_UNION_COUNT(pv) over(order by hour) uv from(
   select hour, BITMAP_UNION(device_id) as pv
   from metric_table -- Query the accumulated UV per hour
   where datekey=20200922
group by hour order by 1
) final;

Keywords

BITMAP