RB32_TO_BITMAP Function
Overview
The RB32_TO_BITMAP function converts binary data in the standard Roaring Bitmap 32-bit serialization format to a Singdata internal BITMAP type. This function is primarily used for data interoperability with external systems (such as ClickHouse, Druid, and other systems using the standard Roaring Bitmap format).
Syntax
rb32_to_bitmap(expr)
Parameters
expr: An expression of typeBINARY, containing binary data in the Roaring Bitmap 32-bit serialization format.
Return Result
Returns BITMAP type. Returns NULL if the input data is not in valid Roaring Bitmap 32-bit format.
Examples
-
Convert Roaring Bitmap 32-bit binary data to BITMAP:
-
Round-trip conversion between BITMAP and Roaring Bitmap 32-bit format using
bitmap_to_rb32: -
Analyze the conversion result using bitmap functions:
Notes
- When the input parameter is NULL, the result is NULL.
- When the input binary data is not in valid Roaring Bitmap 32-bit serialization format, the function returns NULL instead of throwing an error.
- The Roaring Bitmap 32-bit format only supports values within the 32-bit unsigned integer range (0 ~ 4294967295). If the Singdata BITMAP contains values beyond this range,
bitmap_to_rb32will return NULL, making round-trip conversion via the 32-bit format impossible. For BITMAPs containing values beyond the 32-bit range, userb64_to_bitmap/bitmap_to_rb64for 64-bit format conversion. - The inverse operation of this function is
bitmap_to_rb32, which converts a Singdata BITMAP to the Roaring Bitmap 32-bit serialization format.
