OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.5
    iconOceanBase Database
    SQL - V 4.3.5
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Roaring bitmap judgment functions

    Last Updated:2026-04-09 02:53:55  Updated
    share
    What is on this page
    rb_is_empty
    rb_contains
    Use case 1
    Use case 2

    folded

    share

    Roaring bitmap judgment functions perform judgment on the input Roaring bitmap data and return a Boolean value. OceanBase Database supports the rb_is_empty() and rb_contains() Roaring bitmap judgment functions.

    rb_is_empty

    rb_is_empty() judges whether the input Roaring bitmap data is empty. The syntax is as follows:

    rb_is_empty(rb)
    

    The returned value 1 indicates that the input bitmap data is empty, and 0 indicates that input bitmap data is not empty.

    Here are some examples:

    SELECT rb_is_empty(rb_from_string(''));
    +---------------------------------+
    | rb_is_empty(rb_from_string('')) |
    +---------------------------------+
    |                               1 |
    +---------------------------------+
    1 row in set
    
    SELECT rb_is_empty(rb_from_string('1,2,3'));
    +--------------------------------------+
    | rb_is_empty(rb_from_string('1,2,3')) |
    +--------------------------------------+
    |                                    0 |
    +--------------------------------------+
    1 row in set
    

    rb_contains

    The rb_contains() function has two use cases:

    • To check if the first input bitmap (rb1) fully contains the second input bitmap (rb2).
    • To check if the input bitmap contains a specific offset (offset).

    These two use cases are implemented using different syntax. Details are as follows:

    Use case 1

    The rb_contains() function can be used to determine whether the first input bitmap (rb1) fully contains the second input bitmap (rb2). The syntax is as follows:

    rb_contains(rb1, rb2)
    

    Specifically:

    • The parameter rb1 serves as the base for the calculation, while rb2 is the bitmap being checked. The function determines whether every element in rb2 is also present in rb1.
    • The order of the parameters rb1 and rb2 affects the result.
    • The function returns 1 if rb1 fully contains rb2, and 0 if it does not.

    Here is an example:

    SELECT rb_contains(rb_from_string('1,2,3,4,5'), rb_from_string('1,2,3,4'));
    +---------------------------------------------------------------------+
    | rb_contains(rb_from_string('1,2,3,4,5'), rb_from_string('1,2,3,4')) |
    +---------------------------------------------------------------------+
    |                                                                   1 |
    +---------------------------------------------------------------------+
    1 row in set
    

    Use case 2

    The rb_contains() function can be used to determine whether the input bitmap data contains a specific offset (offset). The syntax is as follows:

    rb_contains(rb, offset)
    

    Specifically:

    • The parameter rb serves as the basis for the calculation and is a bitmap dataset.
    • offset must be an integer, used to check whether this integer exists in the bitmap data rb.
    • The function returns 1 if the offset is contained within rb, and 0 if it is not.

    Here is an example:

    SELECT rb_contains(rb_from_string('1,2,3,4,5'), 1);
    +---------------------------------------------+
    | rb_contains(rb_from_string('1,2,3,4,5'), 1) |
    +---------------------------------------------+
    |                                           1 |
    +---------------------------------------------+
    1 row in set
    
    SELECT rb_contains(rb_from_string('1,2,3,4,6'), 5);
    +---------------------------------------------+
    | rb_contains(rb_from_string('1,2,3,4,6'), 5) |
    +---------------------------------------------+
    |                                           0 |
    +---------------------------------------------+
    1 row in set
    

    Previous topic

    Roaring bitmap operation functions
    Last

    Next topic

    Roaring bitmap output functions
    Next
    What is on this page
    rb_is_empty
    rb_contains
    Use case 1
    Use case 2