Files
doris/docs/en/sql-manual/sql-functions/bitmap-functions/bitmap_union.md
jiafeng.zhang 267e8b67c2 [refactor][doc]The new version of the document is online (#9272)
replace the `docs/` with `new-docs/`
2022-04-28 15:22:34 +08:00

1.6 KiB

title, language
title language
bitmap_union en

bitmap_union function

description

Aggregate function, used to calculate the grouped bitmap union. Common usage scenarios such as: calculating PV, UV.

Syntax

BITMAP BITMAP_UNION(BITMAP value)

Enter a set of bitmap values, find the union of this set of bitmap values, and return.

example

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

Combined with the bitmap_count function, the PV data of the web page can be obtained

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

When the user_id field is int, the above query semantics is equivalent to

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

keyword

BITMAP_UNION, BITMAP