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

BITMAP_TO_ARRAY

説明

BitmapをArrayに変換します。

構文

BITMAP_TO_ARRAY(<bitmap>)

パラメータ

Parameterデスクリプション
<bitmap>Bitmap型の列または式

Return Value

Bitmap内のすべてのビット位置を含む配列。
BitmapがNULLの場合はNULLを返す。

Examples

NULLのBitmapを配列に変換するには:

select bitmap_to_array(null);

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

+------------------------+
| bitmap_to_array(NULL) |
+------------------------+
| NULL |
+------------------------+

空のBitmapを配列に変換するには:

select bitmap_to_array(bitmap_empty());

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

+---------------------------------+
| bitmap_to_array(bitmap_empty()) |
+---------------------------------+
| [] |
+---------------------------------+

単一の要素を持つBitmapを配列に変換するには:

select bitmap_to_array(to_bitmap(1));

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

+-------------------------------+
| bitmap_to_array(to_bitmap(1)) |
+-------------------------------+
| [1] |
+-------------------------------+

複数の要素を持つBitmapを配列に変換するには:

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

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

+--------------------------------------------------+
| bitmap_to_array(bitmap_from_string('1,2,3,4,5')) |
+--------------------------------------------------+
| [1, 2, 3, 4, 5] |
+--------------------------------------------------+