Skip to main content

Overview of bitmap functions

Bitmap functions are a set of specialized functions provided in the seekdb system for efficiently handling compressed bitmap data. These functions allow users to perform complex bitmap queries and analyses at the database level, enabling efficient storage, querying, and manipulation of bitmap data for applications such as user behavior analysis, user profiling, and audience targeting.

Here is an overview of the types of bitmap functions in seekdb and their purposes:

Types of bitmap functions

Bitmap Function TypeDescription
Bitmap Constructor FunctionsFunctions for constructing new bitmap data types.
Bitmap Cardinality Calculation FunctionsFunctions for calculating the cardinality of bitmap data.
Bitmap Operation FunctionsFunctions for performing basic operations on bitmap data, such as intersection, union, XOR, and AND NOT.
Bitmap Decision FunctionsFunctions for making decisions based on input bitmap data and returning boolean values.
Bitmap Output FunctionsFunctions for selecting the output format of bitmap data, such as outputting each element of the bitmap data as a string separated by commas.
Bitmap Aggregate FunctionsFunctions for aggregating numeric data into bitmap data, i.e., performing aggregate operations on bitmap data.

Full list of bitmap functions

The following table lists all the bitmap functions supported by seekdb:

Function TypeFunction NameDescription
Bitmap Constructor Functionrb_build_emptyConstructs an empty bitmap data.
Bitmap Constructor Functionrb_build_emptyConstructs an empty bitmap data.
Bitmap Constructor Functionrb_build_varbinaryConstructs bitmap data using varbinary.
Bitmap Constructor Functionrb_from_stringConstructs bitmap data using a string in a specific format.
Bitmap Constructor Functionrb_selectSelects a local range from bitmap data values based on specified conditions, saves it as new bitmap data, and returns its value.
Bitmap Cardinality Calculation Functionrb_cardinalityCalculates the cardinality of bitmap data.
Bitmap Cardinality Calculation Functionrb_and_cardinality and rb_and_null2empty_cardinalityReturns the cardinality of the new bitmap data obtained after performing an AND operation on two bitmap data sets.
Bitmap Cardinality Calculation Functionrb_or_cardinality and rb_or_null2empty_cardinalityReturns the cardinality of the new bitmap data obtained after performing an OR operation on two bitmap data sets.
Bitmap Cardinality Calculation Functionrb_xor_cardinalityReturns the cardinality of the new bitmap data obtained after performing an XOR operation on two bitmap data sets.
Bitmap Cardinality Calculation Functionrb_andnot_cardinality and rb_andnot_null2empty_cardinalityReturns the cardinality of the new bitmap data obtained after performing an AND NOT operation on two bitmap data sets.
Bitmap Cardinality Calculation Functionrb_or_cardinality_aggCalculates the cardinality of the union of a bitmap column.
Bitmap Cardinality Calculation Functionrb_and_cardinality_aggCalculates the cardinality of the intersection of a bitmap column.
Bitmap Operation Functionrb_and and rb_and_null2emptyCalculates the intersection of two bitmap data sets.
Bitmap Operation Functionrb_or and rb_or_null2emptyCalculates the union of two bitmap data sets.
Bitmap Operation Functionrb_xorPerforms an XOR operation on two bitmap data sets.
Bitmap Operation Functionrb_andnot and rb_andnot_null2emptyPerforms an AND NOT operation on two bitmap data sets.
Bitmap Decision Functionrb_is_emptyChecks whether the input bitmap data is empty.
Bitmap Decision Functionrb_containsTwo uses:
  • Checks whether the first input bitmap data set completely contains the second input bitmap data set.
  • Checks whether the input bitmap data set contains a specific offset.
Bitmap Output Functionrb_to_varbinaryOutputs bitmap data in varbinary format.
Bitmap Output Functionrb_to_stringOutputs each element of the bitmap data as a string, separated by commas.
Bitmap Output Functionrb_to_arrayOutputs bitmap data in array format.
Bitmap Aggregate Functionrb_build_aggAggregates a numeric column into bitmap data.
Bitmap Aggregate Functionrb_or_aggPerforms an OR operation on multiple rows of a bitmap column and aggregates the results into bitmap data.
Bitmap Aggregate Functionrb_and_aggPerforms an AND operation on multiple rows of a bitmap column and aggregates the results into bitmap data.