Skip to main content

BITMAP_COUNT

Counts the number of bits set to 1 in the bitmap.

Syntax

BITMAP_COUNT( <bitmap> )

Aliases

Examples

SELECT BITMAP_COUNT(BUILD_BITMAP([1,4,5])), BITMAP_CARDINALITY(BUILD_BITMAP([1,4,5]));

┌─────────────────────────────────────────────────────────────────────────────────────┐
│ bitmap_count(build_bitmap([1, 4, 5])) │ bitmap_cardinality(build_bitmap([1, 4, 5]))
├───────────────────────────────────────┼─────────────────────────────────────────────┤
33
└─────────────────────────────────────────────────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today