Syntax
Scalar
Arguments
Returns
- Type: BIGINT
- Possible values: The total population count across every byte; zero for an empty bitmap.
- NULL behavior: Returns NULL for NULL input.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Counts the set bits in binary bitmap data.
bitmap_count(value)
| Name | Type | Required | Description |
|---|---|---|---|
| value | BINARY | Yes | The bitmap bytes. |
| Property | Value |
|---|---|
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |
SELECT bitmap_count(X'0F00FF') AS bits, bitmap_count(X'') AS empty_bitmap;
| bits | empty_bitmap |
|---|---|
| 12 | 0 |
SELECT bitmap_count(X'0000') AS all_zero_bits, bitmap_count(X'FFFF') AS all_one_bits;
| all_zero_bits | all_one_bits |
|---|---|
| 0 | 16 |