メインコンテンツまでスキップ
バージョン: 4.x

BITMAP_OR_COUNT

デスクリプション

2つ以上の入力Bitmapの和集合を計算し、和集合内の要素数を返します。

Syntax

BITMAP_OR_COUNT(<bitmap1>, <bitmap2>, ..., <bitmapN>)

パラメータ

Parameterデスクリプション
<bitmap1>最初のBitmap
<bitmap2>2番目のBitmap
......
<bitmapN>N番目のBitmap

Return Value

複数のBitmapの和集合における要素数。
いずれかのBitmapがNULLの場合、NULLを返します。

Examples

空でないBitmapと空のBitmapの和集合における要素数を計算するには:

select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty());

結果は以下のようになります:

+--------------------------------------------------------------+
| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty()) |
+--------------------------------------------------------------+
| 3 |
+--------------------------------------------------------------+

2つの同一のBitmapの和集合における要素数を計算するには:

select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3'));

結果は次のようになります:

+---------------------------------------------------------------------------+
| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3')) |
+---------------------------------------------------------------------------+
| 3 |
+---------------------------------------------------------------------------+

2つの異なるBitmapの和集合における要素数を計算するには:

select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'));

結果は次のようになります:

+---------------------------------------------------------------------------+
| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
+---------------------------------------------------------------------------+
| 5 |
+---------------------------------------------------------------------------+

複数のBitmapの和集合における要素数を計算するには、空のBitmapを含む場合:

select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'), to_bitmap(100), bitmap_empty());

結果は次のようになります:

+-----------------------------------------------------------------------------------------------------------+
| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'), to_bitmap(100), bitmap_empty()) |
+-----------------------------------------------------------------------------------------------------------+
| 6 |
+-----------------------------------------------------------------------------------------------------------+

複数のBitmapの和集合における要素数を計算するには、NULL値を含めて:

select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'), to_bitmap(100), NULL);

結果は以下のようになります:

+-------------------------------------------------------------------------------------------------+
| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'), to_bitmap(100), NULL) |
+-------------------------------------------------------------------------------------------------+
| NULL |
+-------------------------------------------------------------------------------------------------+