メインコンテンツまでスキップ
に最終更新

BITMAP_AND_COUNT

説明​

入力した二つ以上の BITMAP の積集合を計算し、その要素数を返します。

構文​

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

パラメータ​

パラメータ説明
<bitmap>積集合を求める対象の BITMAP の一つ

戻り値​

整数を返します

  • パラメータが NULL の場合は 0 を返します

例​

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 |
+------+