メインコンテンツまでスキップ
バージョン: Stable-3.3

bitmap_union

説明

グループ化後の値のセットに対して bitmap union を計算します。一般的な使用シナリオには、PV や UV の計算が含まれます。

構文

BITMAP BITMAP_UNION(BITMAP value)

select page_id, bitmap_union(user_id)
from table
group by page_id;

この関数を bitmap_count() と一緒に使用して、ウェブページの UV を取得します。

select page_id, bitmap_count(bitmap_union(user_id))
from table
group by page_id;

user_id が整数の場合、上記のクエリ文は次のものと同等です。

select page_id, count(distinct user_id)
from table
group by page_id;

キーワード

BITMAP_UNION, BITMAP