Skip to main content
Skip to main content

Bitmap Functions

Bitmaps can be constructed in two ways. The first way is constructed by aggregation function groupBitmap with -State, the other way is to constructed a bitmap from an Array object.

bitmapAnd

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap containing bits present in both input bitmaps AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapAndCardinality

Introduced in: v20.1

Syntax

Arguments

Returns the number of set bits in the intersection of the two bitmaps UInt64

Examples

Usage example

bitmapAndnot

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap containing set bits present in the first bitmap but not in the second AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapAndnotCardinality

Introduced in: v20.1

Syntax

Arguments

Returns the number of set bits in the result of bitmap1 AND-NOT bitmap2 UInt64

Examples

Usage example

bitmapBuild

Introduced in: v20.1

Syntax

Arguments

Returned value

Returns a bitmap from the provided array AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapCardinality

Introduced in: v20.1

Syntax

Arguments

Returns the number of bits set in the bitmap UInt64

Examples

Usage example

bitmapContains

Introduced in: v20.1

Syntax

Arguments

Returns 1 if the bitmap contains the specified value, otherwise 0 UInt8

Examples

Usage example

bitmapHasAll

Introduced in: v20.1

Syntax

Arguments

Returns 1 if all set bits of the second bitmap are present in the first bitmap, otherwise 0 UInt8

Examples

Usage example

bitmapHasAny

Introduced in: v20.1

Syntax

Arguments

Returns 1 if any bits of the second bitmap are present in the first bitmap, otherwise 0 UInt8

Examples

Usage example

bitmapMax

Introduced in: v20.1

Syntax

Arguments

Returns the position of the greatest bit set in the bitmap, otherwise 0 UInt64

Examples

Usage example

bitmapMin

Introduced in: v20.1

Syntax

Arguments

Returns the position of the smallest bit set in the bitmap, or UINT32_MAX/UINT64_MAX UInt64

Examples

Usage example

bitmapOr

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap containing set bits present in either input bitmap AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapOrCardinality

Introduced in: v20.1

Syntax

Arguments

Returns the number of set bits in the union of the two bitmaps UInt64

Examples

Usage example

bitmapSubsetInRange

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap containing only the set bits in the specified range AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapSubsetLimit

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap containing at most cardinality_limit set bits, starting from range_start AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapToArray

Introduced in: v20.1

Syntax

Arguments

Returns an array of unsigned integers contained in the bitmap Array(UInt*)

Examples

Usage example

bitmapTransform

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap with elements transformed according to the given mapping AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapXor

Introduced in: v20.1

Syntax

Arguments

Returns a bitmap containing set bits present in either input bitmap, but not in both AggregateFunction(groupBitmap, T)

Examples

Usage example

bitmapXorCardinality

Introduced in: v20.1

Syntax

Arguments

Returns the number of set bits in the symmetric difference of the two bitmaps UInt64

Examples

Usage example

subBitmap

Introduced in: v21.9

Syntax

Arguments

  • bitmap — Bitmap object. AggregateFunction(groupBitmap, T). - offset — Number of set bits to skip from the beginning (zero-based). UInt32 - cardinality_limit — Maximum number of set bits to include in the subset. UInt32 Returned value

Returns a bitmap containing at most limit set bits, starting after skipping offset set bits in ascending order AggregateFunction(groupBitmap, T)

Examples

Usage example