Counts the number of distinct values in the input expression. The return value is the same as COUNT(DISTINCT expr).
BITMAP_UNION_INT(<expr>)
| Argument | Description |
|---|---|
<expr> | The input expression. Supported types: TinyInt, SmallInt, Integer. |
Returns the number of distinct values in the column. If there is no valid data in the group, returns 0.
-- 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)), (1, 300, to_bitmap(300)), (2, 200, to_bitmap(300));
select bitmap_union_int(dt) from pv_bitmap;
+----------------------+ | bitmap_union_int(dt) | +----------------------+ | 2 | +----------------------+
select bitmap_union_int(dt) from pv_bitmap where dt is null;
+----------------------+ | bitmap_union_int(dt) | +----------------------+ | 0 | +----------------------+