SelectDB Enterprise
参考手册
SQL 函数
标量函数
BITMAP 函数
BITMAP_AND_NOT,BITMAP_ANDNOT

BITMAP_AND_NOT,BITMAP_ANDNOT

描述

将两个 BITMAP 进行与非操作并返回计算结果,其中入参第一个叫 基准 BITMAP,第二个叫 排除 BITMAP

别名

  • BITMAP_ANDNOT

语法

BITMAP_AND_NOT(<bitmap1>, <bitmap2>)

参数

参数说明
<bitmap1>被求与非的基准 BITMAP
<bitmap2>被求与非的排除 BITMAP

返回值

返回一个 BITMAP。

  • 当参数存在空值时,返回 NULL

举例

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                                                                |
+---------------------------------------------------------------------+
© 2025 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标