Skip to main content

BITMAP_AND_NOT,BITMAP_ANDNOT

Description​

Perform a NOT operation on two BITMAPs and return the result. The first input parameter is called base BITMAP and the second is called exclude BITMAP.

Alias​

  • BITMAP_ANDNOT

Syntax​

BITMAP_AND_NOT(<bitmap1>, <bitmap2>)

Parameters​

ParameterDescription
<bitmap1>Base BITMAP to be negated
<bitmap2>Exclusion BITMAP to be negated

Return Value​

Returns a BITMAP.

  • If the parameter has a NULL value, returns NULL

Examples​

select bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) cnt;
+------+
| cnt |
+------+
| 2 |
+------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) as cnt;
+------+
| cnt |
+------+
| 1,2 |
+------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty())) cnt;
+-------+
| cnt |
+-------+
| 1,2,3 |
+-------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL)) as res;
+------+
| res |
+------+
| NULL |
+------+