> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 符号なし整数カラムに対してビットマップまたは集計の計算を行い、UInt64 型のカーディナリティを返します。接尾辞 -State を付けると、ビットマップオブジェクトを返します

# groupBitmap

<div id="groupBitmap">
  ## groupBitmap
</div>

導入バージョン: v20.1.0

符号なし整数のカラムからビットマップ (ビット配列) を作成し、そのビットマップ内の一意な値の数 (カーディナリティ) を返します。
`-State` combinator 接尾辞を追加すると、件数ではなく、実際の[ビットマップオブジェクト](/ja/reference/functions/regular-functions/bitmap-functions)を返します。

**Syntax**

```sql theme={null}
groupBitmap(expr)
groupBitmapState(expr)
```

**引数**

* `expr` — `UInt*` 型になる式。[`UInt*`](/ja/reference/data-types/int-uint)

**戻り値**

`UInt64` 型のカウント、または `-State` を使用した場合はビットマップオブジェクトを返します。[`UInt64`](/ja/reference/data-types/int-uint)

**例**

**使用例**

```sql title=Query theme={null}
CREATE TABLE t (UserID UInt32) ENGINE = Memory;
INSERT INTO t VALUES (1), (1), (2), (3);

SELECT groupBitmap(UserID) AS num FROM t;
```

```response title=Response theme={null}
┌─num─┐
│   3 │
└─────┘
```
