Skip to main content

BITMAP_AND_COUNT

Description​

Computes the intersection of two or more input BITMAPs and returns the number of intersections.

Syntax​

BITMAP_AND_COUNT(<bitmap>, <bitmap>,[, <bitmap>...])

Parameters​

ParameterDescription
<bitmap>One of the original BITMAPs whose intersection is being sought

Return Value​

Returns an integer

  • If the parameter has a NULL value, it returns 0

Examples​

select bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')) as res;
+------+
| res |
+------+
| 1 |
+------+
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5')) as res;
+------+
| res |
+------+
| 2 |
+------+
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),bitmap_empty()) as res;
+------+
| res |
+------+
| 0 |
+------+
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL) as res;
+------+
| res |
+------+
| 0 |
+------+