-State, the other way is to constructed a bitmap from an Array object.
bitmapAnd
Introduced in: v20.1.0 Computes the logical conjunction (AND) of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
bitmapAndCardinality
Introduced in: v20.1.0 Returns the cardinality of the logical conjunction (AND) of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
UInt64
Examples
Usage example
Query
Response
bitmapAndnot
Introduced in: v20.1.0 Computes the set difference A AND-NOT B of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
bitmapAndnotCardinality
Introduced in: v20.1.0 Returns the cardinality of the AND-NOT operation of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
bitmap1 AND-NOT bitmap2 UInt64
Examples
Usage example
Query
Response
bitmapBuild
Introduced in: v20.1.0 Builds a bitmap from an integer array. Supported element types are signed and unsigned integers of 8, 16, 32, or 64 bits. It is the opposite of functionbitmapToArray.
Syntax
array— Integer array.Array((U)Int*)
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
Query
Response
bitmapCardinality
Introduced in: v20.1.0 Returns the number of bits set (the cardinality) in the bitmap. Syntaxbitmap— Bitmap object.AggregateFunction(groupBitmap, T).
UInt64
Examples
Usage example
Query
Response
bitmapContains
Introduced in: v20.1.0 Checks if the bitmap contains a specific element. The value is compared as an unsigned integer of the bitmap element type. For signed bitmaps, a negative element matches its unsigned counterpart (for example,Int8 value -1 matches 255).
Syntax
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -value— Element to check for, interpreted as an unsigned integer of the bitmap element type. (U)Int8/16/32/64
1 if the bitmap contains the specified value, otherwise 0 UInt8
Examples
Usage example
Query
Response
Query
Response
bitmapHasAll
Introduced in: v20.1.0 Checks if the first bitmap contains all set bits of the second bitmap. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
1 if all set bits of the second bitmap are present in the first bitmap, otherwise 0 UInt8
Examples
Usage example
Query
Response
bitmapHasAny
Introduced in: v20.1.0 Checks if the first bitmap contains any set bits of the second bitmap. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
1 if any bits of the second bitmap are present in the first bitmap, otherwise 0 UInt8
Examples
Usage example
Query
Response
bitmapMax
Introduced in: v20.1.0 Returns the greatest element in a bitmap, interpreted as an unsigned integer of the bitmap element type. For signed bitmaps, negative values are treated as their unsigned counterparts (for example,Int8 value -1 is 255). Returns 0 if the bitmap is empty.
Syntax
bitmap— Bitmap object.AggregateFunction(groupBitmap, T).
0 if the bitmap is empty UInt64
Examples
Usage example
Query
Response
Query
Response
bitmapMin
Introduced in: v20.1.0 Returns the smallest element in a bitmap, interpreted as an unsigned integer of the bitmap element type. For signed bitmaps, negative values are treated as their unsigned counterparts (for example,Int8 value -128 is 128). If the bitmap is empty, returns UINT32_MAX (UINT64_MAX if the bitmap element type is wider than 32 bits).
Syntax
bitmap— Bitmap object.AggregateFunction(groupBitmap, T).
UINT32_MAX/UINT64_MAX if the bitmap is empty UInt64
Examples
Usage example
Query
Response
Query
Response
bitmapOr
Introduced in: v20.1.0 Computes the logical disjunction (OR) of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
bitmapOrCardinality
Introduced in: v20.1.0 Returns the cardinality of the logical disjunction (OR) of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
UInt64
Examples
Usage example
Query
Response
bitmapSubsetInRange
Introduced in: v20.1.0 Returns a subset of the bitmap containing elements in the value range[start, end). Element values are compared as unsigned integers of the bitmap element type.
Syntax
bitmap— Bitmap to extract the subset from.AggregateFunction(groupBitmap, T). -start— Start of the value range (inclusive).UInt*-end— End of the value range (exclusive).UInt*
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
bitmapSubsetLimit
Introduced in: v20.1.0 Returns a subset of at mostcardinality_limit elements whose values are greater than or equal to range_start, selecting the smallest such values in unsigned order.
Syntax
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -range_start— Minimum element value to include (inclusive).UInt*-cardinality_limit— Maximum cardinality of the subset.UInt*
cardinality_limit elements with unsigned value at least range_start AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
bitmapToArray
Introduced in: v20.1.0 Converts a bitmap to an array of its elements. The array element type matches the bitmap element typeT (signed or unsigned integer). It is the opposite of function bitmapBuild.
Syntax
bitmap— Bitmap to convert.AggregateFunction(groupBitmap, T).
Array(T)
Examples
Usage example
Query
Response
Query
Response
bitmapTransform
Introduced in: v20.1.0 Replaces elements in a bitmap according to a mapping fromfrom_array to to_array.
Values are interpreted as unsigned integers of the bitmap element type (same domain as bitmapContains).
For signed bitmaps, a negative element matches its unsigned counterpart (for example, Int8 value -1 matches 255).
A value in to_array that does not fit into the bitmap element type raises BAD_ARGUMENTS. A value in from_array
that does not fit is simply not found, so the corresponding replacement does not apply.
Syntax
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -from_array— Array of element values to replace, interpreted as unsigned integers of the bitmap element type.Array(UInt*). -to_array— Array of replacement values, interpreted as unsigned integers of the bitmap element type. Must have the same length asfrom_array.Array(UInt*).
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
Query
Response
bitmapXor
Introduced in: v20.1.0 Computes the symmetric difference (XOR) of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response
bitmapXorCardinality
Introduced in: v20.1.0 Returns the cardinality of the XOR (symmetric difference) of two bitmaps. Syntaxbitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T).
UInt64
Examples
Usage example
Query
Response
subBitmap
Introduced in: v21.9.0 Returns a subset of the bitmap after skippingoffset elements in ascending unsigned value order. The maximum cardinality of the returned bitmap is cardinality_limit.
Syntax
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -offset— Number of elements to skip in ascending unsigned value order (zero-based).UInt*-cardinality_limit— Maximum number of elements to include in the subset.UInt*
cardinality_limit elements after skipping offset elements in ascending unsigned value order AggregateFunction(groupBitmap, T)
Examples
Usage example
Query
Response