Calculates the union of input Bitmaps and returns a new Bitmap.
BITMAP_UNION(<expr>)
| Argument | Description |
|---|---|
<expr> | Data type supporting Bitmap |
Returns a value of Bitmap type. If there is no valid data in the group, returns an empty Bitmap.
-- setup CREATE TABLE pv_bitmap ( dt INT, page INT, user_id BITMAP ) DISTRIBUTED BY HASH(dt) BUCKETS 1 PROPERTIES ("replication_num" = "1"); INSERT INTO pv_bitmap VALUES (1, 100, to_bitmap(100)), (1, 100, to_bitmap(200)), (1, 100, to_bitmap(300)), (2, 200, to_bitmap(300));
select bitmap_to_string(bitmap_union(user_id)) from pv_bitmap;
+-----------------------------------------+ | bitmap_to_string(bitmap_union(user_id)) | +-----------------------------------------+ | 100,200,300 | +-----------------------------------------+
select bitmap_to_string(bitmap_union(user_id)) from pv_bitmap where user_id is null;
+-----------------------------------------+ | bitmap_to_string(bitmap_union(user_id)) | +-----------------------------------------+ | | +-----------------------------------------+