BITMAP_COUNT Function
Description
The BITMAP_COUNT function returns the number of elements in a bitmap. It is equivalent to BITMAP_CARDINALITY.
Parameters
Return Type
Notes
- This function is an alias for
BITMAP_CARDINALITY, and both provide identical functionality.
Examples
- Count elements in a bitmap
SELECT bitmap_count(bitmap_build(array(1, 2, 3)));
+----------------------------------------------+
| bitmap_count(bitmap_build(array(1, 2, 3))) |
+----------------------------------------------+
| 3 |
+----------------------------------------------+
- Count elements in a larger bitmap
SELECT bitmap_count(bitmap_build(array(1, 2, 3, 4, 5)));
+----------------------------------------------------+
| bitmap_count(bitmap_build(array(1, 2, 3, 4, 5))) |
+----------------------------------------------------+
| 5 |
+----------------------------------------------------+