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β
Parameter | Description |
---|---|
<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')));
+--------------------------------------------------------------------------------------------+
| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'))) |
+--------------------------------------------------------------------------------------------+
| 1,2 |
+--------------------------------------------------------------------------------------------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()));
+-------------------------------------------------------------------------------+
| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_empty())) |
+-------------------------------------------------------------------------------+
| 1,2,3 |
+-------------------------------------------------------------------------------+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL));
+---------------------------------------------------------------------+
| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), NULL)) |
+---------------------------------------------------------------------+
| NULL |
+---------------------------------------------------------------------+