BITMAP_AND_NOT,BITMAP_ANDNOT
更新时间:2025-10-16
描述
将两个 BITMAP 进行与非操作并返回计算结果,其中入参第一个叫 基准 BITMAP,第二个叫 排除 BITMAP。
别名
- BITMAP_ANDNOT
语法
SQL
1BITMAP_AND_NOT(<bitmap1>, <bitmap2>)
参数
| 参数 | 说明 |
|---|---|
<bitmap1> |
被求与非的基准 BITMAP |
<bitmap2> |
被求与非的排除 BITMAP |
返回值
返回一个 BITMAP。
- 当参数存在空值时,返回 NULL
举例
SQL
1select bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) cnt;
Text
1+------+
2| cnt |
3+------+
4| 2 |
5+------+
SQL
1select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')));
Text
1+--------------------------------------------------------------------------------------------+
2| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'))) |
3+--------------------------------------------------------------------------------------------+
4| 1,2 |
5+--------------------------------------------------------------------------------------------+
SQL
1select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()));
Text
1+-------------------------------------------------------------------------------+
2| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_empty())) |
3+-------------------------------------------------------------------------------+
4| 1,2,3 |
5+-------------------------------------------------------------------------------+
SQL
1select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL));
Text
1+---------------------------------------------------------------------+
2| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), NULL)) |
3+---------------------------------------------------------------------+
4| NULL |
5+---------------------------------------------------------------------+
