bitmap_union_count
Descriptionβ
Computes the union of input Bitmaps and returns their cardinality.
Syntaxβ
BITMAP_UNION_COUNT(<expr>)
Parametersβ
Parameter | Description |
---|---|
<expr> | Supported data types of BITMAP |
Return Valueβ
Returns the size of the Bitmap union, that is, the number of elements after deduplication
Exampleβ
select dt,page,bitmap_to_string(user_id) from pv_bitmap;
+------+------+---------------------------+
| dt | page | bitmap_to_string(user_id) |
+------+------+---------------------------+
| 1 | 100 | 100,200,300 |
| 2 | 200 | 300 |
+------+------+---------------------------+
Calculate the deduplication value of user_id:
select bitmap_union_count(user_id) from pv_bitmap;
+-------------------------------------+
| bitmap_count(bitmap_union(user_id)) |
+-------------------------------------+
| 3 |
+-------------------------------------+