intersect_count

description

Syntax

BITMAP INTERSECT_COUNT(bitmap_column, column_to_filter, filter_values) Calculate the intersection of two or more bitmaps Usage: intersect_count(bitmap_column_to_count, filter_column, filter_values …) Example: intersect_count(user_id, event, ‘A’, ‘B’, ‘C’), meaning find the intersect count of user_id in all A/B/C 3 bitmaps

example

1. MySQL [test_query_qa]> select dt,bitmap_to_string(user_id) from pv_bitmap where dt in (3,4);
2. +------+-----------------------------+
3. | dt   | bitmap_to_string(`user_id`) |
4. +------+-----------------------------+
5. |    4 | 1,2,3                       |
6. |    3 | 1,2,3,4,5                   |
7. +------+-----------------------------+
8. 2 rows in set (0.012 sec)

10. MySQL [test_query_qa]> select intersect_count(user_id,dt,3,4) from pv_bitmap;
11. +----------------------------------------+
12. | intersect_count(`user_id`, `dt`, 3, 4) |
13. +----------------------------------------+
14. |                                      3 |
15. +----------------------------------------+
16. 1 row in set (0.014 sec)

keywords

1. INTERSECT_COUNT,BITMAP