diff --git a/deps/init/oceanbase.el7.aarch64.deps b/deps/init/oceanbase.el7.aarch64.deps index 3466e69e1..ea49e7f8d 100644 --- a/deps/init/oceanbase.el7.aarch64.deps +++ b/deps/init/oceanbase.el7.aarch64.deps @@ -31,6 +31,7 @@ devdeps-icu-69.1-72022112416.el7.aarch64.rpm devdeps-cos-c-sdk-5.0.16-52023070517.el7.aarch64.rpm devdeps-s3-cpp-sdk-1.11.156-102023122011.el7.aarch64.rpm devdeps-protobuf-c-1.4.1-100000072023102410.el7.aarch64.rpm +devdeps-roaringbitmap-croaring-3.0.0-42024042816.el7.aarch64.rpm [tools] obdevtools-binutils-2.30-12022100413.el7.aarch64.rpm diff --git a/deps/init/oceanbase.el7.x86_64.deps b/deps/init/oceanbase.el7.x86_64.deps index ab771e092..619266d95 100644 --- a/deps/init/oceanbase.el7.x86_64.deps +++ b/deps/init/oceanbase.el7.x86_64.deps @@ -34,6 +34,7 @@ devdeps-cos-c-sdk-5.0.16-52023070517.el7.x86_64.rpm devdeps-cloud-qpl-1.1.0-272023061419.el7.x86_64.rpm devdeps-s3-cpp-sdk-1.11.156-102023122011.el7.x86_64.rpm devdeps-protobuf-c-1.4.1-100000062023102016.el7.x86_64.rpm +devdeps-roaringbitmap-croaring-3.0.0-42024042816.el7.x86_64.rpm [tools] obdevtools-binutils-2.30-12022100413.el7.x86_64.rpm diff --git a/deps/init/oceanbase.el8.aarch64.deps b/deps/init/oceanbase.el8.aarch64.deps index 39fafdace..6600a57e3 100644 --- a/deps/init/oceanbase.el8.aarch64.deps +++ b/deps/init/oceanbase.el8.aarch64.deps @@ -31,6 +31,7 @@ devdeps-icu-69.1-72022112416.el8.aarch64.rpm devdeps-cos-c-sdk-5.0.16-52023070517.el8.aarch64.rpm devdeps-s3-cpp-sdk-1.11.156-102023122011.el8.aarch64.rpm devdeps-protobuf-c-1.4.1-100000072023102410.el8.aarch64.rpm +devdeps-roaringbitmap-croaring-3.0.0-42024042816.el8.aarch64.rpm [tools] obdevtools-binutils-2.30-12022100413.el8.aarch64.rpm diff --git a/deps/init/oceanbase.el8.x86_64.deps b/deps/init/oceanbase.el8.x86_64.deps index 04bc7749e..9a231238b 100644 --- a/deps/init/oceanbase.el8.x86_64.deps +++ b/deps/init/oceanbase.el8.x86_64.deps @@ -33,6 +33,7 @@ devdeps-cos-c-sdk-5.0.16-52023070517.el8.x86_64.rpm devdeps-cloud-qpl-1.1.0-272023061419.el8.x86_64.rpm devdeps-s3-cpp-sdk-1.11.156-102023122011.el8.x86_64.rpm devdeps-protobuf-c-1.4.1-100000062023102016.el8.x86_64.rpm +devdeps-roaringbitmap-croaring-3.0.0-42024042816.el8.x86_64.rpm [tools] obdevtools-binutils-2.30-12022100413.el8.x86_64.rpm diff --git a/deps/oblib/src/CMakeLists.txt b/deps/oblib/src/CMakeLists.txt index b1da4c18e..8af7aa6fb 100644 --- a/deps/oblib/src/CMakeLists.txt +++ b/deps/oblib/src/CMakeLists.txt @@ -190,10 +190,12 @@ target_link_libraries(oblib_base_base_base ${DEP_DIR}/lib/libssl.a ${DEP_DIR}/lib/libcrypto.a ${DEP_DIR}/lib/libs2.a + ${DEP_DIR}/lib/libroaring.a ${LGPL_DEPS} $<$:${DEP_DIR}/lib/libunwind.a> ${DEP_DIR}/lib/libz.a ${DEP_DIR}/lib/libs2.a + ${DEP_DIR}/lib/libroaring.a ${DEP_DIR}/lib/libicui18n.a ${DEP_DIR}/lib/libicustubdata.a ${DEP_DIR}/lib/libicuuc.a @@ -218,6 +220,7 @@ target_link_libraries(oblib_base_base_base ${DEP_3RD_DIR}/usr/local/babassl-ob/lib/libcrypto.a ${DEP_3RD_DIR}/u01/obclient/lib/libobclnt.a ${DEP_DIR}/lib/libs2.a + ${DEP_DIR}/lib/libroaring.a ${DEP_DIR}/lib/libz.a ${DEP_DIR}/lib/libicui18n.a ${DEP_DIR}/lib/libicustubdata.a diff --git a/deps/oblib/src/common/ob_accuracy.cpp b/deps/oblib/src/common/ob_accuracy.cpp index 18cc5b220..419b529bb 100644 --- a/deps/oblib/src/common/ob_accuracy.cpp +++ b/deps/oblib/src/common/ob_accuracy.cpp @@ -75,6 +75,8 @@ const ObAccuracy ObAccuracy::DDL_DEFAULT_ACCURACY[ObMaxType] = { ObAccuracy(), // collection type in sql ObAccuracy(10, 0), // mysql date. ObAccuracy(19, 6), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap, roaringbitmap serialized size is possibly to exceed 512M. + }; const ObAccuracy ObAccuracy::DDL_DEFAULT_ACCURACY2[ORACLE_MODE + 1][ObMaxType] = { @@ -133,6 +135,7 @@ const ObAccuracy ObAccuracy::DDL_DEFAULT_ACCURACY2[ORACLE_MODE + 1][ObMaxType] = ObAccuracy(), // collection type in sql ObAccuracy(10, 0), // mysql date. ObAccuracy(19, 6), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap }, { ObAccuracy(), // null. @@ -189,6 +192,7 @@ const ObAccuracy ObAccuracy::DDL_DEFAULT_ACCURACY2[ORACLE_MODE + 1][ObMaxType] = ObAccuracy(), // collection type in sql ObAccuracy(10, 0), // mysql date. ObAccuracy(19, 6), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap } }; @@ -247,6 +251,7 @@ const ObAccuracy ObAccuracy::MAX_ACCURACY[ObMaxType] = { ObAccuracy(), // collection type in sql ObAccuracy(10, 0), // mysql date. ObAccuracy(19, 6), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap }; const ObAccuracy ObAccuracy::MAX_ACCURACY2[ORACLE_MODE + 1][ObMaxType] = { @@ -305,6 +310,7 @@ const ObAccuracy ObAccuracy::MAX_ACCURACY2[ORACLE_MODE + 1][ObMaxType] = { ObAccuracy(), // collection type in sql ObAccuracy(10, 0), // mysql date. ObAccuracy(19, 6), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap }, { /* Oracle */ ObAccuracy(), // null. @@ -361,6 +367,7 @@ const ObAccuracy ObAccuracy::MAX_ACCURACY2[ORACLE_MODE + 1][ObMaxType] = { ObAccuracy(), // collection type in sql ObAccuracy(10, 0), // mysql date. ObAccuracy(19, 6), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap } }; @@ -419,6 +426,7 @@ const ObAccuracy ObAccuracy::DML_DEFAULT_ACCURACY[ObMaxType] = { ObAccuracy(), // collection type in sql ObAccuracy(0, 6), // mysql date. ObAccuracy(0, 0), // mysql datetime. + ObAccuracy(OB_MAX_LONGTEXT_LENGTH), // roaringbitmap }; const ObAccuracy ObAccuracy::MAX_ACCURACY_OLD[ObMaxType] = { diff --git a/deps/oblib/src/common/ob_field.cpp b/deps/oblib/src/common/ob_field.cpp index 93bbbadf6..263319382 100644 --- a/deps/oblib/src/common/ob_field.cpp +++ b/deps/oblib/src/common/ob_field.cpp @@ -278,6 +278,7 @@ int ObField::update_field_mb_length() case ObNullTC: case ObJsonTC: case ObGeometryTC: + case ObRoaringBitmapTC: break; // do nothing default: ret = OB_ERR_UNEXPECTED; @@ -346,6 +347,7 @@ int ObField::get_field_mb_length(const ObObjType type, case ObLobTC: case ObJsonTC: case ObGeometryTC: + case ObRoaringBitmapTC: case ObStringTC: { // This if branch is a patch because the generation process of Operators such as CAST and CONV is not standardized. // As a result, length, collation, etc. are not set correctly diff --git a/deps/oblib/src/common/object/ob_obj_compare.cpp b/deps/oblib/src/common/object/ob_obj_compare.cpp index 5c942a574..026fa615b 100644 --- a/deps/oblib/src/common/object/ob_obj_compare.cpp +++ b/deps/oblib/src/common/object/ob_obj_compare.cpp @@ -3056,6 +3056,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // int DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3087,6 +3088,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // uint DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3118,6 +3120,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // float DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3149,6 +3152,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // double DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3180,6 +3184,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // number DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3211,6 +3216,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // datetime DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3242,6 +3248,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // date DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3273,6 +3280,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // time DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3304,6 +3312,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // year DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3335,6 +3344,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // string DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3366,6 +3376,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // extend DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObExtendTC), @@ -3397,6 +3408,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // unknown DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3428,6 +3440,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // text DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3459,6 +3472,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // bit DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3490,6 +3504,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { //enumset DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3521,6 +3536,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { //enumsetInner DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3552,6 +3568,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // otimestamp DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3583,6 +3600,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // raw DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3614,6 +3632,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // interval DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3645,6 +3664,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // rowid DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3676,6 +3696,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // lob DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3707,6 +3728,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // json DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3738,6 +3760,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // geometry DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3769,6 +3792,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // udt DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), @@ -3800,6 +3824,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // decimal int DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), // null @@ -3831,8 +3856,8 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime - } - , + NULL, // roaringbitmap + }, { // collection DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), NULL, // int @@ -3863,7 +3888,8 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] DECLARE_CMP_FUNCS_NULLSAFE_ENTRY(ObCollectionSQLTC, ObCollectionSQLTC, ObMaxTC, ObMaxTC), // collection NULL, // mysql date NULL, // mysql datetime -}, + NULL, // roaringbitmap + }, { // mysql date DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), // null NULL, // int @@ -3894,6 +3920,7 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap }, { // mysql datetime DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), // null @@ -3925,6 +3952,39 @@ const obj_cmp_func_nullsafe ObObjCmpFuncs::cmp_funcs_nullsafe[ObMaxTC][ObMaxTC] NULL, // collection NULL, // mysql date NULL, // mysql datetime + NULL, // roaringbitmap + }, + { // roaringbitmap + DECLARE_CMP_FUNCS_NULLSAFE_RIGHTNULL_ENTRY(ObMaxTC), + NULL, // int + NULL, // uint + NULL, // float + NULL, // double + NULL, // number + NULL, // datetime + NULL, // date + NULL, // time + NULL, // year + NULL, // string + NULL, // extend + NULL, // unknown + NULL, // text + NULL, // bit + NULL, // enumset + NULL, //enumsetInner will not go here + NULL, // otimestamp + NULL, // raw + NULL, // interval + NULL, // rowid + NULL, // lob + NULL, // json + NULL, // geometry + NULL, // udt + NULL, // decimalint + NULL, // collection + NULL, // mysql date + NULL, // mysql datetime + NULL, // roaringbitmap }, }; @@ -3960,6 +4020,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY(ObNullTC, ObMaxTC), // roaringbitmap }, { // int DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -3991,6 +4052,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // uint DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4022,6 +4084,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // float DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4053,6 +4116,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // double DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4084,6 +4148,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // number DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4115,6 +4180,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // datetime DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4146,6 +4212,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // date DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4177,6 +4244,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // time DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4208,6 +4276,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // year DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4239,6 +4308,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // string DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4270,6 +4340,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // extend DEFINE_CMP_FUNCS_ENTRY(ObExtendTC, ObNullTC), @@ -4301,6 +4372,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // unknown DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4332,6 +4404,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // text DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4363,6 +4436,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // bit DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4394,6 +4468,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { //enumset DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4425,6 +4500,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { //enumsetInner DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4456,6 +4532,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // otimestamp DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4487,6 +4564,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // raw DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), @@ -4518,6 +4596,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // interval DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4549,6 +4628,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // rowid DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4580,6 +4660,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // lob DEFINE_CMP_FUNCS_ENTRY_NULL, //null @@ -4611,6 +4692,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // json DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4642,6 +4724,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // geometry DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4673,6 +4756,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // udt DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4704,6 +4788,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // decimalint DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4735,6 +4820,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // collection DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4766,6 +4852,7 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY(ObCollectionSQLTC, ObCollectionSQLTC), // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // mysql date DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4779,24 +4866,25 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // time DEFINE_CMP_FUNCS_ENTRY_NULL, // year DEFINE_CMP_FUNCS_ENTRY_NULL, // string - DEFINE_CMP_FUNCS_ENTRY_NULL, // extend + DEFINE_CMP_FUNCS_ENTRY_NULL, //extend DEFINE_CMP_FUNCS_ENTRY_NULL, // unknown DEFINE_CMP_FUNCS_ENTRY_NULL, // text DEFINE_CMP_FUNCS_ENTRY_NULL, // bit - DEFINE_CMP_FUNCS_ENTRY_NULL, // enumset + DEFINE_CMP_FUNCS_ENTRY_NULL, // enumset DEFINE_CMP_FUNCS_ENTRY_NULL, // enumsetInner will not go here DEFINE_CMP_FUNCS_ENTRY_NULL, // otimestamp DEFINE_CMP_FUNCS_ENTRY_NULL, // raw DEFINE_CMP_FUNCS_ENTRY_NULL, // interval DEFINE_CMP_FUNCS_ENTRY_NULL, //rowid DEFINE_CMP_FUNCS_ENTRY_NULL, //lob - DEFINE_CMP_FUNCS_ENTRY_NULL, // json + DEFINE_CMP_FUNCS_ENTRY_NULL, //json DEFINE_CMP_FUNCS_ENTRY_NULL, //geometry - DEFINE_CMP_FUNCS_ENTRY_NULL, // udt + DEFINE_CMP_FUNCS_ENTRY_NULL, //udt DEFINE_CMP_FUNCS_ENTRY_NULL, // decimal int - DEFINE_CMP_FUNCS_ENTRY_NULL, // collection + DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, { // mysql datetime DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null @@ -4828,6 +4916,39 @@ const obj_cmp_func ObObjCmpFuncs::cmp_funcs[ObMaxTC][ObMaxTC][CO_MAX] = DEFINE_CMP_FUNCS_ENTRY_NULL, // collection DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap + }, + { // roaringbitmap + DEFINE_CMP_FUNCS_ENTRY(ObMaxTC, ObNullTC), //null + DEFINE_CMP_FUNCS_ENTRY_NULL, // int + DEFINE_CMP_FUNCS_ENTRY_NULL, // uint + DEFINE_CMP_FUNCS_ENTRY_NULL, // float + DEFINE_CMP_FUNCS_ENTRY_NULL, // double + DEFINE_CMP_FUNCS_ENTRY_NULL, // number + DEFINE_CMP_FUNCS_ENTRY_NULL, // datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // date + DEFINE_CMP_FUNCS_ENTRY_NULL, // time + DEFINE_CMP_FUNCS_ENTRY_NULL, // year + DEFINE_CMP_FUNCS_ENTRY_NULL, // string + DEFINE_CMP_FUNCS_ENTRY_NULL, //extend + DEFINE_CMP_FUNCS_ENTRY_NULL, // unknown + DEFINE_CMP_FUNCS_ENTRY_NULL, // text + DEFINE_CMP_FUNCS_ENTRY_NULL, // bit + DEFINE_CMP_FUNCS_ENTRY_NULL, // enumset + DEFINE_CMP_FUNCS_ENTRY_NULL, // enumsetInner will not go here + DEFINE_CMP_FUNCS_ENTRY_NULL, // otimestamp + DEFINE_CMP_FUNCS_ENTRY_NULL, // raw + DEFINE_CMP_FUNCS_ENTRY_NULL, // interval + DEFINE_CMP_FUNCS_ENTRY_NULL, //rowid + DEFINE_CMP_FUNCS_ENTRY_NULL, //lob + DEFINE_CMP_FUNCS_ENTRY_NULL, //json + DEFINE_CMP_FUNCS_ENTRY_NULL, //geometry + DEFINE_CMP_FUNCS_ENTRY_NULL, //udt + DEFINE_CMP_FUNCS_ENTRY_NULL, // decimal int + DEFINE_CMP_FUNCS_ENTRY_NULL, // collection + DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql date + DEFINE_CMP_FUNCS_ENTRY_NULL, // mysql datetime + DEFINE_CMP_FUNCS_ENTRY_NULL, // roaringbitmap }, }; diff --git a/deps/oblib/src/common/object/ob_obj_funcs.h b/deps/oblib/src/common/object/ob_obj_funcs.h index ea0ef5e6d..c2f7cbbe2 100644 --- a/deps/oblib/src/common/object/ob_obj_funcs.h +++ b/deps/oblib/src/common/object/ob_obj_funcs.h @@ -195,6 +195,7 @@ template <> case ObGeometryType: case ObUserDefinedSQLType: case ObCollectionSQLType: + case ObRoaringBitmapType: default: break; } @@ -1595,6 +1596,10 @@ DEF_ENUMSET_INNER_FUNCS(ObSetInnerType, set_inner, ObString); // and lob locators are removed in table apis. Error may occur if used in other scenes. // 2. CS_FUNCS: lob with same content and different lobids will have different crc & hash, // but error occur in farm, not used? + +// Todo: @xiyu +// Check CS_FUNCS of roaringbitmap may not be used? + #define DEF_TEXT_FUNCS(OBJTYPE, TYPE, VTYPE) \ DEF_TEXT_PRINT_FUNCS(OBJTYPE); \ DEF_STRING_CS_FUNCS(OBJTYPE); \ @@ -1604,6 +1609,7 @@ DEF_TEXT_FUNCS(ObTinyTextType, string, ObString); DEF_TEXT_FUNCS(ObTextType, string, ObString); DEF_TEXT_FUNCS(ObMediumTextType, string, ObString); DEF_TEXT_FUNCS(ObLongTextType, string, ObString); +DEF_TEXT_FUNCS(ObRoaringBitmapType, string, ObString); #define DEF_GEO_CS_FUNCS(OBJTYPE) \ @@ -3569,6 +3575,7 @@ inline int64_t obj_val_get_serialize_size(const ObObj &obj) } DEF_UDT_CS_FUNCS(ObCollectionSQLType); + } } diff --git a/deps/oblib/src/common/object/ob_obj_type.cpp b/deps/oblib/src/common/object/ob_obj_type.cpp index 92ef655a5..6a32e0615 100644 --- a/deps/oblib/src/common/object/ob_obj_type.cpp +++ b/deps/oblib/src/common/object/ob_obj_type.cpp @@ -108,6 +108,7 @@ const char *ob_sql_type_str(ObObjType type) "COLLECTION", "MYSQL_DATE", "MYSQL_DATETIME", + "ROARINGBITMAP", "" }, { @@ -167,6 +168,7 @@ const char *ob_sql_type_str(ObObjType type) "COLLECTION", "MYSQL_DATE", "MYSQL_DATETIME", + "ROARINGBITMAP", "" } }; @@ -402,6 +404,7 @@ DEF_TYPE_TEXT_FUNCS_LENGTH(lob, (lib::is_oracle_mode() ? "clob" : "longtext"), ( DEF_TYPE_TEXT_FUNCS_LENGTH(json, "json", "json"); DEF_TYPE_STR_FUNCS_PRECISION_SCALE(decimal_int, "decimal", "", "number"); DEF_TYPE_TEXT_FUNCS_LENGTH(geometry, (lib::is_oracle_mode() ? "sdo_geometry" : "geometry"), (lib::is_oracle_mode() ? "sdo_geometry" : "geometry")); +DEF_TYPE_TEXT_FUNCS_LENGTH(roaringbitmap, "roaringbitmap", "roaringbitmap"); /////////////////////////////////////////////////////////// DEF_TYPE_STR_FUNCS_WITHOUT_ACCURACY_FOR_NON_STRING(null, "null", ""); @@ -452,6 +455,7 @@ DEF_TYPE_STR_FUNCS_WITHOUT_ACCURACY_FOR_STRING(lob, (lib::is_oracle_mode() ? "cl DEF_TYPE_STR_FUNCS_WITHOUT_ACCURACY_FOR_STRING(json, "json", "json"); DEF_TYPE_STR_FUNCS_WITHOUT_ACCURACY_FOR_NON_STRING(decimal_int, "decimal", ""); DEF_TYPE_STR_FUNCS_WITHOUT_ACCURACY_FOR_STRING(geometry, (lib::is_oracle_mode() ? "sdo_geometry" : "geometry"), (lib::is_oracle_mode() ? "sdo_geometry" : "geometry")); +DEF_TYPE_STR_FUNCS_WITHOUT_ACCURACY_FOR_STRING(roaringbitmap, "roaringbitmap", "roaringbitmap"); int ob_empty_str(char *buff, int64_t buff_length, ObCollationType coll_type) @@ -769,6 +773,7 @@ int ob_sql_type_str(char *buff, nullptr, // collection nullptr, // mysql date nullptr, // mysql datetime + ob_roaringbitmap_str,//roaringbitmap ob_empty_str // MAX }; static_assert(sizeof(sql_type_name) / sizeof(ObSqlTypeStrFunc) == ObMaxType + 1, "Not enough initializer"); @@ -858,6 +863,7 @@ int ob_sql_type_str(char *buff, nullptr,//collection nullptr,//mysql date nullptr,//mysql datetime + ob_roaringbitmap_str_without_accuracy,//roaringbitmap ob_empty_str // MAX }; static_assert(sizeof(sql_type_name) / sizeof(obSqlTypeStrWithoutAccuracyFunc) == ObMaxType + 1, "Not enough initializer"); @@ -960,6 +966,7 @@ const char *ob_sql_tc_str(ObObjTypeClass tc) "COLLECTION", "MYSQL_DATE", "MYSQL_DATETIME", + "ROARINGBITMAP", "" }; static_assert(sizeof(sql_tc_name) / sizeof(const char *) == ObMaxTC + 1, "Not enough initializer"); diff --git a/deps/oblib/src/common/object/ob_obj_type.h b/deps/oblib/src/common/object/ob_obj_type.h index c16a9a34d..22dfd50d0 100644 --- a/deps/oblib/src/common/object/ob_obj_type.h +++ b/deps/oblib/src/common/object/ob_obj_type.h @@ -95,6 +95,7 @@ enum ObObjType ObCollectionSQLType = 51, // collection(varray and nested table) in SQL ObMySQLDateType = 52, // date type which is compatible with MySQL. ObMySQLDateTimeType = 53, // datetime type which is compatible with MySQL. + ObRoaringBitmapType = 54, // Roaring Bitmap Type ObMaxType // invalid type, or count of obj type }; @@ -129,6 +130,7 @@ enum ObObjOType ObOGeometryType = 25, ObOUDTSqlType = 26, ObOCollectionSqlType = 27, + ObORoaringBitmapType = 28, ObOMaxType //invalid type, or count of ObObjOType }; @@ -218,6 +220,7 @@ static ObObjOType OBJ_TYPE_TO_O_TYPE[ObMaxType+1] = { ObOCollectionSqlType, //ObCollectionSQLType = 51, ObONotSupport, //ObMySQLDateType = 52, ObONotSupport, //ObMySQLDateTimeType = 53, + ObORoaringBitmapType, //Roaring Bitmap Type = 54, ObONotSupport //ObMaxType, }; @@ -253,6 +256,7 @@ enum ObObjTypeClass ObCollectionSQLTC = 26, // collection type class in SQL ObMySQLDateTC = 27, // mysql date type class ObMySQLDateTimeTC = 28, // mysql date time type class + ObRoaringBitmapTC = 29, // Roaringbitmap type class ObMaxTC, // invalid type classes are below, only used as the result of XXXX_type_promotion() // to indicate that the two obj can't be promoted to the same type. @@ -314,10 +318,11 @@ enum ObObjTypeClass (ObJsonType, ObJsonTC), \ (ObGeometryType, ObGeometryTC), \ (ObUserDefinedSQLType, ObUserDefinedSQLTC),\ - (ObDecimalIntType, ObDecimalIntTC),\ - (ObCollectionSQLType, ObCollectionSQLTC), \ - (ObMySQLDateType, ObMySQLDateTC), \ - (ObMySQLDateTimeType, ObMySQLDateTimeTC) + (ObDecimalIntType, ObDecimalIntTC), \ + (ObCollectionSQLType, ObCollectionSQLTC), \ + (ObMySQLDateType, ObMySQLDateTC), \ + (ObMySQLDateTimeType, ObMySQLDateTimeTC), \ + (ObRoaringBitmapType, ObRoaringBitmapTC) #define SELECT_SECOND(x, y) y #define SELECT_TC(arg) SELECT_SECOND arg @@ -361,6 +366,7 @@ const ObObjType OBJ_DEFAULT_TYPE[ObActualMaxTC] = ObCollectionSQLType, // collection type in sql ObMySQLDateType, // mysql date ObMySQLDateTimeType, // mysql datetime + ObRoaringBitmapType, // roaringbitmap ObMaxType, // maxtype ObUInt64Type, // int&uint ObMaxType, // lefttype @@ -398,6 +404,7 @@ static ObObjTypeClass OBJ_O_TYPE_TO_CLASS[ObOMaxType + 1] = ObGeometryTC, // ObOGeometryType ObUserDefinedSQLTC, // ObOUDTSqlType ObCollectionSQLTC, // ObCollectionSqlType + ObRoaringBitmapTC, // ObRoaringBitmapType ObMaxTC }; @@ -1197,6 +1204,7 @@ enum VecValueTypeClass: uint16_t { VEC_TC_DEC_INT256, VEC_TC_DEC_INT512, VEC_TC_COLLECTION, + VEC_TC_ROARINGBITMAP, MAX_VEC_TC }; @@ -1257,9 +1265,12 @@ OB_INLINE VecValueTypeClass get_vec_value_tc(const ObObjType type, const int16_t VEC_TC_LOB, // ObLobType VEC_TC_JSON, // ObJsonType VEC_TC_GEO, // ObGeometryType - VEC_TC_UDT, // ObUserDefinedSQLType + VEC_TC_UDT, // ObUserDefinedSQLType MAX_VEC_TC, // invalid for ObDecimalIntType - VEC_TC_COLLECTION // ObCollectionSQLType + VEC_TC_COLLECTION, // ObCollectionSQLType + MAX_VEC_TC, // reserved for ObMySQLDateType + MAX_VEC_TC, // reserved for ObMySQLDateTimeType + VEC_TC_ROARINGBITMAP // ObRoaringBitmapType }; VecValueTypeClass t = MAX_VEC_TC; if (type < 0 || type >= ObMaxType) { @@ -1300,7 +1311,8 @@ OB_INLINE bool ob_is_castable_type_class(ObObjTypeClass tc) || ObBitTC == tc || ObEnumSetTC == tc || ObEnumSetInnerTC == tc || ObTextTC == tc || ObOTimestampTC == tc || ObRawTC == tc || ObIntervalTC == tc || ObRowIDTC == tc || ObLobTC == tc || ObJsonTC == tc || ObGeometryTC == tc - || ObUserDefinedSQLTC == tc || ObDecimalIntTC == tc || ObCollectionSQLTC == tc; + || ObUserDefinedSQLTC == tc || ObDecimalIntTC == tc || ObCollectionSQLTC == tc + || ObRoaringBitmapTC == tc; } //used for arithmetic @@ -1388,6 +1400,7 @@ inline bool ob_is_lob_tc(ObObjType type) { return ObLobTC == ob_obj_type_class(t inline bool ob_is_json_tc(ObObjType type) { return ObJsonTC == ob_obj_type_class(type); } inline bool ob_is_geometry_tc(ObObjType type) { return ObGeometryTC == ob_obj_type_class(type); } inline bool ob_is_decimal_int_tc(ObObjType type) { return ObDecimalIntTC == ob_obj_type_class(type); } +inline bool ob_is_roaringbitmap_tc(ObObjType type) { return ObRoaringBitmapTC == ob_obj_type_class(type); } inline bool is_lob(ObObjType type) { return ob_is_text_tc(type); } inline bool is_lob_locator(ObObjType type) { return ObLobType == type; } @@ -1542,7 +1555,8 @@ inline bool ob_is_accuracy_length_valid_tc(ObObjType type) { return ob_is_string ob_is_rowid_tc(type) || ob_is_lob_tc(type) || ob_is_json_tc(type) || - ob_is_geometry_tc(type); } + ob_is_geometry_tc(type) || + ob_is_roaringbitmap_tc(type); } inline bool ob_is_string_or_enumset_tc(ObObjType type) { return ObStringTC == ob_obj_type_class(type) || ob_is_enumset_tc(type); } inline bool ob_is_large_text(ObObjType type) { return ObTextType <= type && ObLongTextType >= type; } inline bool ob_is_datetime(const ObObjType type) { return ObDateTimeType == type; } @@ -1567,9 +1581,11 @@ inline bool ob_is_collection_sql_type(const ObObjType type) { return ObCollectio inline bool is_lob_storage(const ObObjType type) { return ob_is_large_text(type) || ob_is_json_tc(type) || ob_is_geometry_tc(type) - || ob_is_collection_sql_type(type); } + || ob_is_collection_sql_type(type) + || ob_is_roaringbitmap_tc(type); } inline bool ob_is_geometry(const ObObjType type) { return ObGeometryType == type; } -inline bool ob_is_lob_group(const ObObjType type) { return ob_is_json(type) || ob_is_geometry(type) || ob_is_large_text(type); } +inline bool ob_is_roaringbitmap(const ObObjType type) { return ObRoaringBitmapType == type; } + inline bool ob_is_decimal_int(const ObObjType type) { return ObDecimalIntType == type; } inline bool is_decimal_int_accuracy_valid(const int16_t precision, const int16_t scale) { diff --git a/deps/oblib/src/common/object/ob_object.cpp b/deps/oblib/src/common/object/ob_object.cpp index 5f13214a1..ef926a914 100644 --- a/deps/oblib/src/common/object/ob_object.cpp +++ b/deps/oblib/src/common/object/ob_object.cpp @@ -1311,7 +1311,8 @@ int ObObj::build_not_strict_default_value(int16_t precision) case ObTextType: case ObMediumTextType: case ObLongTextType: - case ObGeometryType: { + case ObGeometryType: + case ObRoaringBitmapType:{ ObString null_str; set_string(data_type, null_str); meta_.set_inrow(); @@ -1383,7 +1384,7 @@ int ObObj::build_not_strict_default_value(int16_t precision) int ObObj::deep_copy(const ObObj &src, char *buf, const int64_t size, int64_t &pos) { int ret = OB_SUCCESS; - if (ob_is_string_type(src.get_type()) || ob_is_json(src.get_type()) || ob_is_geometry(src.get_type())) { + if (ob_is_string_type(src.get_type()) || ob_is_json(src.get_type()) || ob_is_geometry(src.get_type()) || ob_is_roaringbitmap(src.get_type())) { ObString src_str = src.get_string(); if (OB_UNLIKELY(size < (pos + src_str.length()))) { ret = OB_BUF_NOT_ENOUGH; @@ -1470,6 +1471,7 @@ void* ObObj::get_deep_copy_obj_ptr() if (ob_is_string_type(this->get_type()) || ob_is_json(this->get_type()) || ob_is_geometry(this->get_type()) + || ob_is_roaringbitmap(this->get_type()) || ob_is_user_defined_sql_type(this->get_type()) || ob_is_collection_sql_type(this->get_type())) { // val_len_ == 0 is empty string, and it may point to unexpected address @@ -1782,7 +1784,8 @@ int ObObj::apply(const ObObj &mutation) && org_type != mut_type && !(ObLongTextType == org_type && ObLobType == mut_type) && !(ObJsonType == org_type && ObLobType == mut_type) - && !(ObGeometryType == org_type && ObLobType == mut_type)))) { + && !(ObGeometryType == org_type && ObLobType == mut_type) + && !(ObRoaringBitmapType == org_type && ObLobType == mut_type)))) { _OB_LOG(WARN, "type not coincident or invalid type[this->type:%d,mutation.type:%d]", org_type, mut_type); ret = OB_INVALID_ARGUMENT; @@ -1899,10 +1902,12 @@ ObObjTypeFuncs OBJ_FUNCS[ObMaxType] = DEF_FUNC_ENTRY(ObJsonType), // 47, json DEF_FUNC_ENTRY(ObGeometryType), // 48, geometry TODO!!!!! DEF_FUNC_ENTRY(ObUserDefinedSQLType),// 49, udt - DEF_FUNC_ENTRY(ObDecimalIntType), // 50, decimal int + DEF_FUNC_ENTRY(ObDecimalIntType), // 50, decimal int DEF_FUNC_ENTRY(ObCollectionSQLType), // 51, collection - DEF_FUNC_ENTRY(ObNullType), // 52, mysql date - DEF_FUNC_ENTRY(ObNullType), // 53, mysql datetime + DEF_FUNC_ENTRY(ObNullType), // 52, mysql date + DEF_FUNC_ENTRY(ObNullType), // 53, mysql datetime + DEF_FUNC_ENTRY(ObRoaringBitmapType), // 54, roaringbitmap + }; ob_obj_hash ObObjUtil::get_murmurhash_v3(ObObjType type) @@ -2016,7 +2021,7 @@ int ObObj::print_smart(char *buf, int64_t buf_len, int64_t &pos) const if (OB_ISNULL(buf) || OB_UNLIKELY(buf_len <=0)) { ret = OB_INVALID_ARGUMENT; } else if (!(meta_.is_string_or_lob_locator_type() && ObHexStringType != meta_.get_type()) - && (!meta_.is_json()) && (!meta_.is_geometry())) { + && (!meta_.is_json()) && (!meta_.is_geometry()) && (!meta_.is_roaringbitmap())) { ret = OBJ_FUNCS[meta_.get_type()].print_json(*this, buf, buf_len, pos, params); } else if (OB_FAIL(is_printable(get_string_ptr(), get_string_len(), can_print))) { } else if (can_print) { diff --git a/deps/oblib/src/common/object/ob_object.h b/deps/oblib/src/common/object/ob_object.h index ef3ce3325..5aa41f0ad 100644 --- a/deps/oblib/src/common/object/ob_object.h +++ b/deps/oblib/src/common/object/ob_object.h @@ -138,7 +138,8 @@ public: && !ob_is_lob_locator(static_cast(type_)) && !ob_is_raw(static_cast(type_)) && !ob_is_enum_or_set_type(static_cast(type_)) - && !ob_is_geometry(static_cast(type_))) { + && !ob_is_geometry(static_cast(type_)) + && !ob_is_roaringbitmap(static_cast(type_))) { set_collation_level(CS_LEVEL_NUMERIC); set_collation_type(CS_TYPE_BINARY); } else if (ObUserDefinedSQLType == type_ || @@ -234,6 +235,14 @@ public: set_collation_level(CS_LEVEL_IMPLICIT); set_collation_type(CS_TYPE_BINARY); } + + OB_INLINE void set_roaringbitmap() + { + type_ = static_cast(ObRoaringBitmapType); + lob_scale_.set_in_row(); + set_collation_level(CS_LEVEL_IMPLICIT); + set_collation_type(CS_TYPE_BINARY); + } OB_INLINE void set_otimestamp_type(const ObObjType type) { type_ = static_cast(type); set_collation_level(CS_LEVEL_NUMERIC);set_collation_type(CS_TYPE_BINARY); } OB_INLINE void set_timestamp_tz() { set_otimestamp_type(ObTimestampTZType); } OB_INLINE void set_timestamp_ltz() { set_otimestamp_type(ObTimestampLTZType); } @@ -350,6 +359,7 @@ public: { return ob_is_large_text(get_type()) || ob_is_json_tc(get_type()) || ob_is_geometry_tc(get_type()) + || ob_is_roaringbitmap_tc(get_type()) || ob_is_collection_sql_type(get_type()); } OB_INLINE bool is_lob() const { return ob_is_text_tc(get_type()); } OB_INLINE bool is_inrow() const { return is_lob() && lob_scale_.is_in_row(); } @@ -364,6 +374,10 @@ public: OB_INLINE bool is_geometry_inrow() const { return is_geometry() && lob_scale_.is_in_row(); } OB_INLINE bool is_geometry_outrow() const { return is_geometry() && lob_scale_.is_out_row(); } + OB_INLINE bool is_roaringbitmap() const { return type_ == static_cast(ObRoaringBitmapType); } + OB_INLINE bool is_roaringbitmap_inrow() const { return is_roaringbitmap() && lob_scale_.is_in_row(); } + OB_INLINE bool is_roaringbitmap_outrow() const { return is_roaringbitmap() && lob_scale_.is_out_row(); } + // combination of above functions. OB_INLINE bool is_varbinary_or_binary() const { return is_varbinary() || is_binary(); } OB_INLINE bool is_varchar_or_char() const { return is_varchar() || is_char(); } @@ -1307,7 +1321,7 @@ public: meta_.set_type_simple(meta.get_type()); meta_.set_collation_type(meta.get_collation_type()); if (ObCharType == get_type() || ObVarcharType == get_type() || ob_is_text_tc(get_type()) - || ob_is_lob_locator(get_type()) || ob_is_json(get_type()) || ob_is_geometry(get_type())) { + || ob_is_lob_locator(get_type()) || ob_is_json(get_type()) || ob_is_geometry(get_type()) || ob_is_roaringbitmap(get_type())) { meta_.set_collation_level(ObCollationLevel::CS_LEVEL_IMPLICIT); } else { meta_.set_collation_level(meta.get_collation_level()); @@ -1336,6 +1350,7 @@ public: case ObLobType: case ObJsonType: case ObGeometryType: + case ObRoaringBitmapType: case ObRawType: { obj.meta_.set_collation_level(meta_.get_collation_level()); obj.meta_.set_scale(meta_.get_scale()); @@ -1485,6 +1500,9 @@ public: void set_json_value(const ObObjType type, const char *ptr, const int32_t length); void set_geometry_value(const ObObjType type, const ObLobCommon *value, const int32_t length); void set_geometry_value(const ObObjType type, const char *ptr, const int32_t length); + void set_roaringbitmap_value(const ObObjType type, const ObLobCommon *value, const int32_t length); + void set_roaringbitmap_value(const ObObjType type, const char *ptr, const int32_t length); + void set_lob_locator(const ObLobLocator &value); void set_lob_locator(const ObObjType type, const ObLobLocator &value); inline void set_inrow() { meta_.set_inrow(); } @@ -1863,6 +1881,9 @@ public: OB_INLINE bool is_geometry() const { return meta_.is_geometry(); } OB_INLINE bool is_geometry_inrow() const { return meta_.is_geometry_inrow(); } OB_INLINE bool is_geometry_outrow() const { return meta_.is_geometry_outrow(); } + OB_INLINE bool is_roaringbitmap() const { return meta_.is_roaringbitmap(); } + OB_INLINE bool is_roaringbitmap_inrow() const { return meta_.is_roaringbitmap_inrow(); } + OB_INLINE bool is_roaringbitmap_outrow() const { return meta_.is_roaringbitmap_outrow(); } OB_INLINE bool is_user_defined_sql_type() const { return meta_.is_user_defined_sql_type(); } OB_INLINE bool is_xml_sql_type() const { return meta_.is_user_defined_sql_type() && meta_.get_subschema_id() == ObXMLSqlType; @@ -2793,7 +2814,17 @@ inline void ObObj::set_geometry_value(const ObObjType type, const char *ptr, con set_lob_value(type, ptr, length); meta_.set_collation_type(CS_TYPE_BINARY); } +inline void ObObj::set_roaringbitmap_value(const ObObjType type, const ObLobCommon *value, const int32_t length) +{ + set_lob_value(type, value, length); + meta_.set_collation_type(CS_TYPE_BINARY); +} +inline void ObObj::set_roaringbitmap_value(const ObObjType type, const char *ptr, const int32_t length) +{ + set_lob_value(type, ptr, length); + meta_.set_collation_type(CS_TYPE_BINARY); +} inline void ObObj::set_lob_locator(const ObLobLocator &value) { meta_.set_type(ObLobType); @@ -3003,6 +3034,7 @@ inline bool ObObj::need_deep_copy()const || ob_is_lob_locator(meta_.get_type()) || ob_is_json(meta_.get_type()) || ob_is_geometry(meta_.get_type()) + || ob_is_roaringbitmap(meta_.get_type()) || ob_is_raw(meta_.get_type()) || ob_is_user_defined_sql_type(meta_.get_type()) || ob_is_collection_sql_type(meta_.get_type()) @@ -3636,7 +3668,8 @@ inline const void *ObObj::get_data_ptr() const { const void *ret = NULL; if (ob_is_string_type(get_type()) || ob_is_raw(get_type()) || ob_is_rowid_tc(get_type()) || ob_is_json(get_type()) - || ob_is_geometry(get_type()) || ob_is_user_defined_sql_type(get_type()) || ob_is_collection_sql_type(get_type())) { + || ob_is_geometry(get_type()) || ob_is_user_defined_sql_type(get_type()) || ob_is_collection_sql_type(get_type()) + || ob_is_roaringbitmap(get_type())) { ret = const_cast(v_.string_); } else if (ob_is_number_tc(get_type())) { ret = const_cast(v_.nmb_digits_); @@ -3653,7 +3686,8 @@ inline const void *ObObj::get_data_ptr() const inline void ObObj::set_data_ptr(void *data_ptr) { if (ob_is_string_type(get_type()) || ob_is_raw(get_type()) || ob_is_rowid_tc(get_type()) || ob_is_json(get_type()) - || ob_is_geometry(get_type()) || ob_is_user_defined_sql_type(get_type()) || ob_is_collection_sql_type(get_type())) { + || ob_is_geometry(get_type()) || ob_is_user_defined_sql_type(get_type()) || ob_is_collection_sql_type(get_type()) + || ob_is_roaringbitmap(get_type())) { v_.string_ = static_cast(data_ptr); } else if (ob_is_number_tc(get_type())) { v_.nmb_digits_ = static_cast(data_ptr); @@ -3713,6 +3747,7 @@ inline int64_t ObObj::get_data_length() const ob_is_lob_locator(get_type()) || ob_is_json(get_type()) || ob_is_geometry(get_type()) || + ob_is_roaringbitmap(get_type()) || ob_is_user_defined_sql_type(get_type()) || ob_is_collection_sql_type(get_type())) { ret = val_len_; @@ -4265,7 +4300,8 @@ OB_INLINE int64_t ObObj::get_deep_copy_size() const { int64_t ret = 0; if (is_string_type() || is_raw() || ob_is_rowid_tc(get_type()) || is_lob_locator() || is_json() - || is_geometry() || is_user_defined_sql_type() || ob_is_decimal_int(get_type())|| is_collection_sql_type()) { + || is_geometry() || is_user_defined_sql_type() || ob_is_decimal_int(get_type())|| is_collection_sql_type() + || is_roaringbitmap()) { ret += val_len_; } else if (ob_is_number_tc(get_type())) { ret += (sizeof(uint32_t) * nmb_desc_.len_); diff --git a/deps/oblib/src/lib/CMakeLists.txt b/deps/oblib/src/lib/CMakeLists.txt index f929f6ab9..120a98ddf 100644 --- a/deps/oblib/src/lib/CMakeLists.txt +++ b/deps/oblib/src/lib/CMakeLists.txt @@ -115,6 +115,12 @@ ob_set_subtarget(oblib_lib geo geo/ob_geo_point_location_visitor.cpp ) +ob_set_subtarget(oblib_lib roaringbitmap + roaringbitmap/ob_roaringbitmap.cpp + roaringbitmap/ob_rb_utils.cpp + roaringbitmap/ob_rb_bin.cpp +) + ob_set_subtarget(oblib_lib encode encode/ob_base64_encode.cpp encode/ob_quoted_printable_encode.cpp diff --git a/deps/oblib/src/lib/json_type/ob_json_base.cpp b/deps/oblib/src/lib/json_type/ob_json_base.cpp index 8a535432c..7c458e0c0 100644 --- a/deps/oblib/src/lib/json_type/ob_json_base.cpp +++ b/deps/oblib/src/lib/json_type/ob_json_base.cpp @@ -3792,9 +3792,12 @@ static const obmysql::EMySQLFieldType opaque_ob_type_to_mysql_type[ObMaxType] = obmysql::EMySQLFieldType::MYSQL_TYPE_ORA_BLOB, /* ObLobType */ obmysql::EMySQLFieldType::MYSQL_TYPE_JSON, /* ObJsonType */ obmysql::EMySQLFieldType::MYSQL_TYPE_GEOMETRY, /* ObGeometryType */ - obmysql::EMySQLFieldType::MYSQL_TYPE_COMPLEX, /* ObUserDefinedSQLType, buf for xml we use long_blob type currently? */ - obmysql::EMySQLFieldType::MYSQL_TYPE_NEWDECIMAL, /* ObDecimalIntType */ - obmysql::EMySQLFieldType::MYSQL_TYPE_COMPLEX, /* ObCollectionSQLType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_COMPLEX, /* ObUserDefinedSQLType, buf for xml we use long_blob type currently? */ + obmysql::EMySQLFieldType::MYSQL_TYPE_NEWDECIMAL, /* ObDecimalIntType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_COMPLEX, /* ObCollectionSQLType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_NOT_DEFINED, /* reserved for ObMySQLDateType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_NOT_DEFINED, /* reserved for ObMySQLDateTimeType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_BLOB, /* ObRoaringBitmapType */ /* ObMaxType */ }; diff --git a/deps/oblib/src/lib/mysqlclient/ob_mysql_prepared_statement.cpp b/deps/oblib/src/lib/mysqlclient/ob_mysql_prepared_statement.cpp index fa803c846..dd9241b36 100644 --- a/deps/oblib/src/lib/mysqlclient/ob_mysql_prepared_statement.cpp +++ b/deps/oblib/src/lib/mysqlclient/ob_mysql_prepared_statement.cpp @@ -78,6 +78,10 @@ static const obmysql::EMySQLFieldType ob_type_to_mysql_type[ObMaxType] = obmysql::EMySQLFieldType::MYSQL_TYPE_ORA_BLOB, /* ObLobType */ obmysql::EMySQLFieldType::MYSQL_TYPE_JSON, /* ObJsonType */ obmysql::EMySQLFieldType::MYSQL_TYPE_GEOMETRY, /* ObGeometryType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_COMPLEX, /* ObUserDefinedSQLType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_NEWDECIMAL, /* ObDecimalIntType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_COMPLEX, /* ObCollectionSQLType */ + obmysql::EMySQLFieldType::MYSQL_TYPE_BLOB, /* ObRoaringBitmapType */ /* ObMaxType */ }; diff --git a/deps/oblib/src/lib/mysqlclient/ob_mysql_result.h b/deps/oblib/src/lib/mysqlclient/ob_mysql_result.h index fd133e285..0150246c2 100644 --- a/deps/oblib/src/lib/mysqlclient/ob_mysql_result.h +++ b/deps/oblib/src/lib/mysqlclient/ob_mysql_result.h @@ -1063,7 +1063,7 @@ res_obj.meta_.set_collation_level(CS_LEVEL_IMPLICIT); \ ret = (class_obj).set_##column_name(res_obj); \ } \ - else if (column.is_identity_column() || ob_is_string_type(data_type) || ob_is_geometry(data_type) || ob_is_collection_sql_type(data_type)) \ + else if (column.is_identity_column() || ob_is_string_type(data_type) || ob_is_geometry(data_type)|| ob_is_roaringbitmap(data_type) || ob_is_collection_sql_type(data_type)) \ { \ res_obj.set_string(data_type, str_value); \ res_obj.meta_.set_collation_type(column.get_collation_type()); \ @@ -1075,7 +1075,7 @@ SQL_LOG(WARN, "outrow lob unsupported", "column_name", #column_name); \ } \ else { \ - if (ob_is_text_tc(data_type) || ob_is_geometry(data_type) || ob_is_collection_sql_type(data_type)) { res_obj.set_inrow(); } \ + if (ob_is_text_tc(data_type) || ob_is_geometry(data_type) || ob_is_roaringbitmap(data_type) || ob_is_collection_sql_type(data_type)) { res_obj.set_inrow(); } \ ret = (class_obj).set_##column_name(res_obj); \ } \ } \ diff --git a/deps/oblib/src/lib/ob_name_def.h b/deps/oblib/src/lib/ob_name_def.h index d01cdc970..e4359c341 100644 --- a/deps/oblib/src/lib/ob_name_def.h +++ b/deps/oblib/src/lib/ob_name_def.h @@ -1124,4 +1124,28 @@ #define N_SDO_RELATE "sdo_relate" #define N_INNER_TABLE_OPTION_PRINTER "inner_table_option_printer" #define N_INNER_TABLE_SEQUENCE_GETTER "inner_table_sequence_getter" +#define N_RB_BUILD_EMPTY "rb_build_empty" +#define N_RB_IS_EMPTY "rb_is_empty" +#define N_RB_BUILD_VARBINARY "rb_build_varbinary" +#define N_RB_TO_VARBINARY "rb_to_varbinary" +#define N_RB_BUILD_AGG "rb_build_agg" +#define N_RB_OR_AGG "rb_or_agg" +#define N_RB_AND_AGG "rb_and_agg" +#define N_RB_CARDINALITY "rb_cardinality" +#define N_RB_AND_CARDINALITY "rb_and_cardinality" +#define N_RB_OR_CARDINALITY "rb_or_cardinality" +#define N_RB_XOR_CARDINALITY "rb_xor_cardinality" +#define N_RB_ANDNOT_CARDINALITY "rb_andnot_cardinality" +#define N_RB_AND_NULL2EMPTY_CARDINALITY "rb_and_null2empty_cardinality" +#define N_RB_OR_NULL2EMPTY_CARDINALITY "rb_or_null2empty_cardinality" +#define N_RB_ANDNOT_NULL2EMPTY_CARDINALITY "rb_andnot_null2empty_cardinality" +#define N_RB_AND "rb_and" +#define N_RB_OR "rb_or" +#define N_RB_XOR "rb_xor" +#define N_RB_ANDNOT "rb_andnot" +#define N_RB_AND_NULL2EMPTY "rb_and_null2empty" +#define N_RB_OR_NULL2EMPTY "rb_or_null2empty" +#define N_RB_ANDNOT_NULL2EMPTY "rb_andnot_null2empty" +#define N_RB_TO_STRING "rb_to_string" +#define N_RB_FROM_STRING "rb_from_string" #endif //OCEANBASE_LIB_OB_NAME_DEF_H_ diff --git a/deps/oblib/src/lib/roaringbitmap/ob_rb_bin.cpp b/deps/oblib/src/lib/roaringbitmap/ob_rb_bin.cpp new file mode 100644 index 000000000..05ed3c76e --- /dev/null +++ b/deps/oblib/src/lib/roaringbitmap/ob_rb_bin.cpp @@ -0,0 +1,322 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + */ + +#define USING_LOG_PREFIX LIB +#include "lib/ob_errno.h" +#include "lib/roaringbitmap/ob_rb_bin.h" + +namespace oceanbase { +namespace common { + +static const uint32_t ROARING_SERIAL_COOKIE_NO_RUNCONTAINER = 12346; +static const uint32_t ROARING_SERIAL_COOKIE = 12347; +static const uint32_t ROARING_NO_OFFSET_THRESHOLD = 4; +static const uint32_t ROARING_DEFAULT_MAX_SIZE = 4096; +static const uint32_t ROARING_BITSET_CONTAINER_SIZE_IN_WORDS = (1 << 16) / 64; + +int ObRoaringBin::init() +{ + int ret = OB_SUCCESS; + size_t read_bytes = 0; + char * buf = roaring_bin_.ptr(); + uint32_t cookie = 0; + + if (roaring_bin_ == nullptr || roaring_bin_.empty()) { + ret = OB_INVALID_DATA; + LOG_WARN("roaringbitmap binary is empty", K(ret)); + } + + /* roaring_bitmap binary format + * | cookie | size | keyscards[0] | ... | keyscards[size - 1] | offset[0] | ... | offset[size - 1] | container_data[0] | ... | container_data[size - 1] | + * | 4Byte | 4Byte | 8Byte | ... | 8Byte | 8Byte | ... | 8Byte | not fixed | ... | not fixed | + * + * This is the typical format of roaring_bitmap without run containers (starts with '3A30'). + * - size: number of containers in the bitmaps + * - keyscards[i]: keys and cardinality for each container. The keys refer to the high 16 bits of the value. + * The cardinality is the real cardinality - 1, because the maximum cardinality is 65536(2^16) + * - offset[i]: offsets for each container, the offsets are relative to the beginning of the binary + * - container_data[i]: for cardinality less than 4096, the data is stored as a uint16 array, + * for else, the data stored as in a 2^16 bits bitset. + */ + + // read cookies + if (OB_FAIL(ret)) { + } else if (OB_FALSE_IT(read_bytes += sizeof(int32_t))) { + } else if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading cookies", K(ret), K(read_bytes)); + } else { + cookie = *reinterpret_cast(buf); + buf += sizeof(int32_t); + if ((cookie & 0xFFFF) != ROARING_SERIAL_COOKIE && cookie != ROARING_SERIAL_COOKIE_NO_RUNCONTAINER) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid cookie from roaring binary", K(ret), K(cookie)); + } else if ((cookie & 0xFFFF) == ROARING_SERIAL_COOKIE) { + size_ = (cookie >> 16) + 1; + } else if (OB_FALSE_IT(read_bytes += sizeof(int32_t))){ + } else if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading second part of the cookie", K(ret), K(read_bytes)); + } else { + size_ = *reinterpret_cast(buf); + buf += sizeof(int32_t); + } + } + // check size (contaniner count) + if (OB_FAIL(ret)) { + } else if (size_ < 0 || size_ > UINT16_MAX + 1) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid size get from roaring binary", K(ret), K(size_)); + } + // get run container bitmap + if (OB_FAIL(ret)) { + } else { + bool hasrun = (cookie & 0xFFFF) == ROARING_SERIAL_COOKIE; + if (hasrun) { + int32_t s = (size_ + 7) / 8; + read_bytes += s; + if(read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading run bitmap", K(ret), K(read_bytes)); + } else { + bitmapOfRunContainers_ = buf; + buf += s; + } + } + } + // get keyscards + if (OB_FAIL(ret) || size_ == 0) { + } else if (OB_FALSE_IT(read_bytes += size_ * 2 * sizeof(uint16_t))) { + } else if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading keycards", K(ret), K(read_bytes)); + } else if (OB_ISNULL(keyscards_ = static_cast(allocator_->alloc(size_ * 2 * sizeof(uint16_t))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for keyscards", K(ret), K(size_ * 2 * sizeof(uint16_t))); + } else { + MEMCPY(keyscards_, buf, size_ * 2 * sizeof(uint16_t)); + buf += size_ * 2 * sizeof(uint16_t); + } + // get offsets + if (OB_FAIL(ret) || size_ == 0) { + } else if ((!hasrun_) || (size_ >= ROARING_NO_OFFSET_THRESHOLD)) { + // has offsets + read_bytes += size_ * sizeof(uint32_t); + if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading offsets", K(ret), K(read_bytes)); + } else if ((uintptr_t)buf % sizeof(uint32_t) == 0) { + // use buffer directly + offsets_ = (uint32_t *)buf; + buf += size_ * sizeof(uint32_t); + } else if (OB_ISNULL(offsets_ = static_cast(allocator_->alloc(size_ * sizeof(uint32_t))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for offsets_", K(ret), K(size_ * sizeof(uint32_t))); + } else { + MEMCPY(offsets_, buf, size_ * sizeof(uint32_t)); + buf += size_ * sizeof(uint32_t); + } + // check binary length + if (OB_FAIL(ret)) { + } else { + // the last container + size_t offset = offsets_[size_ - 1]; + size_t container_size = 0; + if (OB_FAIL(get_container_size(size_ - 1, container_size))) { + LOG_WARN("failed to get container size", K(ret), K(size_)); + } else if (offset + container_size > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while checking the last container", K(ret), K(size_), K(offset), K(container_size)); + } else { + bin_length_ = offset + container_size; + } + } + } else if (OB_ISNULL(offsets_ = static_cast(allocator_->alloc(size_ * sizeof(uint32_t))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for offsets", K(ret), K(size_ * sizeof(uint32_t))); + } else { + // Reading the containers to fill offsets + for (int32_t k = 0; OB_SUCC(ret) && k < size_; ++k) { + offsets_[k] = read_bytes; + size_t container_size = 0; + if (OB_FAIL(get_container_size(k, container_size))) { + LOG_WARN("failed to get container size", K(ret), K(k)); + } else { + read_bytes += container_size; + } + } + if (OB_FAIL(ret)) { + } else if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading offsets", K(ret), K(read_bytes)); + } else { + // set the bin_length + bin_length_ = read_bytes; + } + } + + return ret; +} + +int ObRoaringBin::get_cardinality(uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + cardinality = 0; + if (size_ == 0) { + // do nothing + } else if (OB_ISNULL(keyscards_)) { + ret = OB_NOT_INIT; + LOG_WARN("ObRoaringBin is not init", K(ret)); + } else { + for (int i = 0; i < size_; ++i) + { + cardinality += keyscards_[2 * i + 1] + 1; + } + } + return ret; +} + +int ObRoaringBin::get_container_size(uint32_t n, size_t &container_size) +{ + int ret = OB_SUCCESS; + uint32_t this_card = keyscards_[2 * n + 1] + 1; + size_t offset = offsets_[n]; + bool is_bitmap = (this_card > ROARING_DEFAULT_MAX_SIZE); + bool is_run = false; + if (hasrun_ && (bitmapOfRunContainers_[n / 8] & (1 << (n % 8))) != 0) { + is_bitmap = false; + is_run = true; + } + if (is_bitmap) { + // bitmap container + container_size = ROARING_BITSET_CONTAINER_SIZE_IN_WORDS * sizeof(uint64_t); + } else if (is_run) { + // run container + if (offset + sizeof(uint16_t) > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading a run container (header)", K(ret), K(offset), K(n)); + } else { + int32_t n_runs = *reinterpret_cast(roaring_bin_.ptr() + offset); + container_size = sizeof(int32_t) + n_runs * 2 * sizeof(uint16_t); + } + } else { + // array container + container_size = this_card * sizeof(uint16_t); + } + return ret; +} + + +int ObRoaring64Bin::init() +{ + int ret = OB_SUCCESS; + size_t read_bytes = 0; + char * buf = roaring_bin_.ptr(); + + if (roaring_bin_ == nullptr || roaring_bin_.empty()) { + ret = OB_INVALID_DATA; + LOG_WARN("roaringbitmap binary is empty", K(ret)); + } + + /* roaring64_bitmap binary format + * | buckets | high32[0] | roaring_bitmap[0] | ... | high32[buckets-1] | roaring_bitmap[buckets-1] | + * | 8Byte | 4Byte | not fixed | ... | 4Byte | not fixed | + * + * A roaring64_bitmap contains several roaring_bitmap. + * - buckets: number of roaring_bitmap contained in this roaring64_bitmap + * - high32[i]: high 32 bits of the value, also used to distinguish the roaring_bitmap + * - roaring_bitmap[i]: the format of roaring_bitmap tells above + */ + + // get buckets + if (OB_FAIL(ret)) { + } else { + read_bytes += sizeof(buckets_); + if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading buckets", K(ret), K(read_bytes)); + } else { + buckets_ = *reinterpret_cast(buf); + buf += sizeof(buckets_); + if (buckets_ > UINT32_MAX) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid buckets get from roaring binary", K(ret), K(buckets_)); + } + } + } + // get roaring_buf + if (OB_FAIL(ret) || buckets_ == 0) { + } else if (OB_ISNULL(high32_ = static_cast(allocator_->alloc(buckets_ * sizeof(uint32_t))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for high32", K(ret), K(buckets_ * sizeof(uint32_t))); + } else if (OB_ISNULL(roaring_bufs_ = static_cast(allocator_->alloc(buckets_ * sizeof(ObRoaringBin *))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for roaring_bufs", K(ret), K(buckets_ * sizeof(ObRoaringBin *))); + } else if (OB_ISNULL(offsets_ = static_cast(allocator_->alloc(buckets_ * sizeof(uint32_t))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for offsets", K(ret), K(buckets_ * sizeof(uint32_t))); + } else { + for (uint64_t bucket = 0; OB_SUCC(ret) && bucket < buckets_; ++bucket) { + ObString roaring_bin; + // get high32 + read_bytes += sizeof(uint32_t); + if (read_bytes > roaring_bin_.length()) { + ret = OB_INVALID_DATA; + LOG_WARN("ran out of bytes while reading high32", K(ret), K(read_bytes), K(bucket)); + } else { + high32_[bucket] = *reinterpret_cast(buf); + buf += sizeof(uint32_t); + offsets_[bucket] = read_bytes; + } + // get roaring_buf (32bits) + if (OB_FAIL(ret)) { + } else if (OB_FALSE_IT(roaring_bin.assign_ptr(buf, roaring_bin_.length() - read_bytes))) { + } else if (OB_ISNULL(roaring_bufs_[bucket] = OB_NEWx(ObRoaringBin, allocator_, allocator_, roaring_bin))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for roaring_bufs_", K(ret), K(bucket)); + } else if (OB_FAIL(roaring_bufs_[bucket]->init())) { + LOG_WARN("failed to init roaring_buf", K(ret), K(bucket)); + } else { + buf += roaring_bufs_[bucket]->get_bin_length(); + read_bytes += roaring_bufs_[bucket]->get_bin_length(); + } + } + } + + return ret; +} + +int ObRoaring64Bin::get_cardinality(uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + cardinality = 0; + if (buckets_ == 0) { + // do nothing + } else if (OB_ISNULL(roaring_bufs_)) { + ret = OB_NOT_INIT; + LOG_WARN("ObRoaringBin is not init", K(ret)); + } else { + for (int i = 0; OB_SUCC(ret) && i < buckets_; ++i) + { + uint64_t this_card = 0; + if (OB_FAIL(roaring_bufs_[i]->get_cardinality(this_card))) { + LOG_WARN("fail to get cardinality from roaring_buf", K(ret), K(i), K(roaring_bufs_[i])); + } else { + cardinality += this_card; + } + } + } + return ret; +} + +} // namespace common +} // namespace oceanbase \ No newline at end of file diff --git a/deps/oblib/src/lib/roaringbitmap/ob_rb_bin.h b/deps/oblib/src/lib/roaringbitmap/ob_rb_bin.h new file mode 100644 index 000000000..871ccb6ca --- /dev/null +++ b/deps/oblib/src/lib/roaringbitmap/ob_rb_bin.h @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + */ + +#ifndef OCEANBASE_LIB_ROARINGBITMAP_OB_RB_BIN_ +#define OCEANBASE_LIB_ROARINGBITMAP_OB_RB_BIN_ + +#include "ob_roaringbitmap.h" + +namespace oceanbase { +namespace common { + +class ObRoaringBin +{ +public: + ObRoaringBin(ObIAllocator *allocator, ObString &roaring_bin) + : allocator_(allocator), + roaring_bin_(roaring_bin), + bin_length_(0), + size_(0), + hasrun_(false), + bitmapOfRunContainers_(nullptr) {} + virtual ~ObRoaringBin() = default; + + int init(); + + int get_cardinality(uint64_t &cardinality); + size_t get_bin_length() {return bin_length_;} + int get_container_size(uint32_t n, size_t &container_size); + +private: + ObIAllocator* allocator_; + ObString roaring_bin_; + size_t bin_length_; + int32_t size_; // container count + uint16_t *keyscards_; + uint32_t *offsets_; + bool hasrun_; + char *bitmapOfRunContainers_; + +}; + +class ObRoaring64Bin +{ +public: + ObRoaring64Bin(ObIAllocator *allocator, ObString &roaring_bin) + : allocator_(allocator), + roaring_bin_(roaring_bin), + roaring_bufs_(nullptr) {} + virtual ~ObRoaring64Bin() = default; + + int init(); + int get_cardinality(uint64_t &cardinality); + +private: + ObIAllocator* allocator_; + ObString roaring_bin_; + uint64_t buckets_; + uint32_t *high32_; + uint32_t *offsets_; + ObRoaringBin **roaring_bufs_; +}; + +} // namespace common +} // namespace oceanbase + +#endif // OCEANBASE_LIB_ROARINGBITMAP_OB_ROARINGBITMAP_ \ No newline at end of file diff --git a/deps/oblib/src/lib/roaringbitmap/ob_rb_utils.cpp b/deps/oblib/src/lib/roaringbitmap/ob_rb_utils.cpp new file mode 100644 index 000000000..71b88a510 --- /dev/null +++ b/deps/oblib/src/lib/roaringbitmap/ob_rb_utils.cpp @@ -0,0 +1,559 @@ + +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation support for the roaringbitmap utils abstraction. + */ + +#define USING_LOG_PREFIX LIB +#include "lib/ob_errno.h" +#include "lib/utility/ob_macro_utils.h" +#include "lib/utility/ob_fast_convert.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "lib/roaringbitmap/ob_rb_bin.h" + + +namespace oceanbase +{ +namespace common +{ + +const uint64_t max_rb_to_string_cardinality = 1000000; + +int ObRbUtils::check_get_bin_type(const ObString &rb_bin, ObRbBinType &bin_type) +{ + int ret = OB_SUCCESS; + uint32_t offset = RB_VERSION_SIZE + RB_TYPE_SIZE; + // get_bin_type + if (rb_bin == nullptr) { + ret = OB_INVALID_DATA; + LOG_WARN("roaringbitmap binary is empty", K(ret), K(rb_bin)); + } else if (rb_bin.length() < RB_VERSION_SIZE + RB_TYPE_SIZE) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(rb_bin.length())); + } else if (!IS_VALID_RB_VERSION(static_cast(*(rb_bin.ptr())))) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid version from roaringbitmap binary", K(ret), K(*(rb_bin.ptr()))); + } else if (*(rb_bin.ptr() + RB_VERSION_SIZE) >= static_cast(ObRbBinType::MAX_TYPE) + || *(rb_bin.ptr() + RB_VERSION_SIZE) < 0) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid binary type from roaringbitmap binary", K(ret), K(*(rb_bin.ptr() + RB_VERSION_SIZE))); + } else { + bin_type = static_cast(*(rb_bin.ptr() + RB_VERSION_SIZE)); + // check binary + switch (bin_type) { + case ObRbBinType::EMPTY: { + if (rb_bin.length() != offset) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(rb_bin.length())); + } + break; + } + case ObRbBinType::SINGLE_32: { + if (rb_bin.length() != offset + sizeof(uint32_t)) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(rb_bin.length())); + } + break; + } + case ObRbBinType::SINGLE_64: { + if (rb_bin.length() != offset + sizeof(uint64_t)) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(rb_bin.length())); + } + break; + } + case ObRbBinType::SET_32: { + uint8_t value_count = 0; + if (rb_bin.length() < offset + RB_VALUE_COUNT_SIZE) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(rb_bin.length()), K(bin_type)); + } else if (OB_FALSE_IT(value_count = *(rb_bin.ptr() + offset))) { + } else if (OB_FALSE_IT(offset += RB_VALUE_COUNT_SIZE)) { + } else if (value_count < 0 || value_count > MAX_BITMAP_SET_VALUES) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap value_count", K(ret), K(bin_type), K(value_count)); + } else if (rb_bin.length() != offset + value_count * sizeof(uint32_t)) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(value_count), K(rb_bin.length())); + } + break; + } + case ObRbBinType::SET_64: { + uint8_t value_count = 0; + if (rb_bin.length() < offset + RB_VALUE_COUNT_SIZE) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(rb_bin.length()), K(bin_type)); + } else if (OB_FALSE_IT(value_count = *(rb_bin.ptr() + offset))) { + } else if (OB_FALSE_IT(offset += RB_VALUE_COUNT_SIZE)) { + } else if (value_count < 0 || value_count > MAX_BITMAP_SET_VALUES) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap value_count", K(ret), K(bin_type), K(value_count)); + } else if (rb_bin.length() != offset + value_count * sizeof(uint64_t)) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(value_count), K(rb_bin.length())); + } + break; + } + case ObRbBinType::BITMAP_32: { + size_t deserialize_size = roaring::api::roaring_bitmap_portable_deserialize_size(rb_bin.ptr() + offset, rb_bin.length() - offset); + if (deserialize_size == 0 || deserialize_size != rb_bin.length() - offset) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(deserialize_size), K(rb_bin.length())); + } + break; + } + case ObRbBinType::BITMAP_64: { + size_t deserialize_size = roaring::api::roaring64_bitmap_portable_deserialize_size(rb_bin.ptr() + offset, rb_bin.length() - offset); + if (deserialize_size == 0 || deserialize_size != rb_bin.length() - offset) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap binary length", K(ret), K(bin_type), K(deserialize_size), K(rb_bin.length())); + } + break; + } + default: { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("unknown RbType", K(ret), K(bin_type)); + break; + } + } // end switch + } + return ret; +} + +int ObRbUtils::get_cardinality(ObIAllocator &allocator, ObString &rb_bin, uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + ObRbBinType bin_type; + uint32_t offset = RB_VERSION_SIZE + RB_BIN_TYPE_SIZE; + if (OB_FAIL(ObRbUtils::check_get_bin_type(rb_bin, bin_type))) { + LOG_WARN("invalid roaringbitmap binary string", K(ret)); + } else if (bin_type == ObRbBinType::EMPTY) { + cardinality = 0; + } else if (bin_type == ObRbBinType::SINGLE_32 || bin_type == ObRbBinType::SINGLE_64) { + cardinality = 1; + } else if (bin_type == ObRbBinType::SET_32 || bin_type == ObRbBinType::SET_64) { + uint8_t value_count = static_cast(*(rb_bin.ptr() + offset)); + cardinality = static_cast(value_count); + } else { + ObString binary_str; + binary_str.assign_ptr(rb_bin.ptr() + offset, rb_bin.length() - offset); + if (bin_type == ObRbBinType::BITMAP_32) { + ObRoaringBin *roaring_bin = NULL; + if (OB_ISNULL(roaring_bin = OB_NEWx(ObRoaringBin, &allocator, &allocator, binary_str))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for ObRoaringBin", K(ret)); + } else if (OB_FAIL(roaring_bin->init())) { + LOG_WARN("failed to get roaring card", K(ret), K(binary_str)); + } else if (OB_FAIL(roaring_bin->get_cardinality(cardinality))) { + LOG_WARN("failed to get roaring card", K(ret), K(binary_str)); + } + } else if (bin_type == ObRbBinType::BITMAP_64) { + ObRoaring64Bin *roaring64_bin = NULL; + if (OB_ISNULL(roaring64_bin = OB_NEWx(ObRoaring64Bin, &allocator, &allocator, binary_str))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to alloc memory for ObRoaring64Bin", K(ret)); + } else if (OB_FAIL(roaring64_bin->init())) { + LOG_WARN("failed to get roaring card", K(ret), K(binary_str)); + } else if (OB_FAIL(roaring64_bin->get_cardinality(cardinality))) { + LOG_WARN("failed to get roaring card", K(ret), K(binary_str)); + } + } + } + return ret; +} + +void ObRbUtils::rb_destroy(ObRoaringBitmap *&rb) +{ + if (OB_NOT_NULL(rb)) { + rb->set_empty(); + } + return; +} +int ObRbUtils::rb_deserialize(ObIAllocator &allocator, const ObString &rb_bin, ObRoaringBitmap *&rb) +{ + int ret = OB_SUCCESS; + ObRbBinType bin_type; + if (OB_FAIL(check_get_bin_type(rb_bin, bin_type))) { + LOG_WARN("invalid roaringbitmap binary string", K(ret)); + } else if (OB_ISNULL(rb = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(rb->deserialize(rb_bin))) { + LOG_WARN("failed to deserialize roaringbitmap", K(ret)); + } + return ret; +} + +int ObRbUtils::rb_serialize(ObIAllocator &allocator, ObString &res_rb_bin, ObRoaringBitmap *&rb) +{ + int ret = OB_SUCCESS; + ObStringBuffer res_buf(&allocator); + if (OB_FAIL(rb->optimize())) { + LOG_WARN("failed to optimize the roaringbitmap", K(ret)); + } else if (OB_FAIL(rb->serialize(res_buf))) { + LOG_WARN("failed to serialize the roaringbitmap"); + } else { + res_rb_bin.assign_ptr(res_buf.ptr(), res_buf.length()); + } + return ret; +} + +int ObRbUtils::binary_format_convert(ObIAllocator &allocator, const ObString &rb_bin, ObString &binary_str) +{ + int ret = OB_SUCCESS; + ObRbBinType bin_type; + if (OB_FAIL(check_get_bin_type(rb_bin, bin_type))) { + LOG_WARN("invalid roaringbitmap binary string", K(ret)); + } else if (bin_type == ObRbBinType::BITMAP_32 || bin_type == ObRbBinType::BITMAP_64) { + binary_str.assign_ptr(rb_bin.ptr(),rb_bin.length()); + } else { + ObRoaringBitmap *rb = NULL; + ObStringBuffer res_buf(&allocator); + if (OB_ISNULL(rb = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(rb->deserialize(rb_bin))) { + LOG_WARN("failed to deserialize roaringbitmap", K(ret)); + } else if (OB_FAIL(rb->convert_to_bitmap())) { + LOG_WARN("failed to convert roaringbitmap to bitmap type", K(ret)); + } else if (OB_FAIL(rb->serialize(res_buf))) { + LOG_WARN("failed to serialize the roaringbitmap"); + } else { + binary_str.assign_ptr(res_buf.ptr(), res_buf.length()); + } + rb_destroy(rb); + } + return ret; +} + +int ObRbUtils::rb_from_string(ObIAllocator &allocator, ObString &rb_str, ObRoaringBitmap *&rb) +{ + int ret = OB_SUCCESS; + const char *str = rb_str.ptr(); + char *str_end = rb_str.ptr() + rb_str.length(); + char *value_end = nullptr; + uint64_t value = 0; + bool is_first = true; + + if (OB_ISNULL(rb = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else { + // parse roaringbitmap string + str_skip_space_(str, str_end); + while (str < str_end && OB_SUCC(ret)) { + if (is_first) { + is_first = false; + } else if (*str == ',') { + str++; + str_skip_space_(str, str_end); + } else { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap string", K(ret), K(*str)); + } + // pares uint64 value + if (OB_FAIL(ret)) { + } else if (str == str_end) { + ret = OB_INVALID_DATA; + LOG_WARN("no value string after the comma", K(ret)); + } else if (OB_FAIL(str_read_value_(str, str_end - str, value_end, value))) { + LOG_WARN("failed to transfer value string", K(ret), K(str)); + } else if (str == value_end) { + ret = OB_INVALID_DATA; + LOG_WARN("invalid roaringbitmap string", K(ret), K(*str)); + } else if (OB_FAIL(rb->value_add(value))) { + LOG_WARN("failed to add value to roaringbtimap", K(ret), K(value)); + } else { + str = value_end; + str_skip_space_(str, str_end); + } + } + } + return ret; +} + +int ObRbUtils::rb_to_string(ObIAllocator &allocator, ObString &rb_bin, ObString &res_rb_str) +{ + int ret = OB_SUCCESS; + ObRbBinType bin_type; + uint32_t offset = RB_VERSION_SIZE + RB_BIN_TYPE_SIZE; + ObStringBuffer res_buf(&allocator); + if (OB_FAIL(check_get_bin_type(rb_bin, bin_type))) { + LOG_WARN("invalid roaringbitmap binary string", K(ret)); + } else { + switch(bin_type) { + case ObRbBinType::EMPTY: { + // do nothing + break; + } + case ObRbBinType::SINGLE_32: { + uint32_t value_32 = *reinterpret_cast(rb_bin.ptr() + offset); + ObFastFormatInt ffi(value_32); + if (OB_FAIL(res_buf.append(ffi.ptr(), ffi.length(), 0))) { + LOG_WARN("failed to append res_buf", K(ret), K(value_32), K(ffi.ptr()), K(ffi.length())); + } + break; + } + case ObRbBinType::SINGLE_64: { + uint64_t value_64 = *reinterpret_cast(rb_bin.ptr() + offset); + ObFastFormatInt ffi(value_64); + if (OB_FAIL(res_buf.append(ffi.ptr(), ffi.length(), 0))) { + LOG_WARN("failed to append res_buf", K(ret), K(value_64), K(ffi.ptr()), K(ffi.length())); + } + break; + } + case ObRbBinType::SET_32: { + bool is_first = true; + uint8_t value_count = static_cast(*(rb_bin.ptr() + offset)); + offset += RB_VALUE_COUNT_SIZE; + if (value_count > 0) { + uint32_t *value_ptr = reinterpret_cast(rb_bin.ptr() + offset); + std::sort(value_ptr, value_ptr + value_count); + for (int i = 0; OB_SUCC(ret) && i < value_count; i++) { + uint32_t value_32 = *reinterpret_cast(rb_bin.ptr() + offset); + offset += sizeof(uint32_t); + ObFastFormatInt ffi(value_32); + if (!is_first && OB_FAIL(res_buf.append(","))) { + LOG_WARN("failed to append res_buf", K(ret)); + } else if (is_first && OB_FALSE_IT(is_first = false)) { + } else if (OB_FAIL(res_buf.append(ffi.ptr(), ffi.length(), 0))) { + LOG_WARN("failed to append res_buf", K(ret), K(value_32), K(ffi.ptr()), K(ffi.length())); + } + } + } + break; + } + case ObRbBinType::SET_64: { + bool is_first = true; + uint8_t value_count = static_cast(*(rb_bin.ptr() + offset)); + offset += RB_VALUE_COUNT_SIZE; + if (value_count > 0) { + uint64_t *value_ptr = reinterpret_cast(rb_bin.ptr() + offset); + std::sort(value_ptr, value_ptr + value_count); + for (int i = 0; OB_SUCC(ret) && i < value_count; i++) { + uint64_t value_64 = *reinterpret_cast(rb_bin.ptr() + offset); + offset += sizeof(uint64_t); + ObFastFormatInt ffi(value_64); + if (!is_first && OB_FAIL(res_buf.append(","))) { + LOG_WARN("failed to append res_buf", K(ret)); + } else if (is_first && OB_FALSE_IT(is_first = false)) { + } else if (OB_FAIL(res_buf.append(ffi.ptr(), ffi.length(), 0))) { + LOG_WARN("failed to append res_buf", K(ret), K(value_64), K(ffi.ptr()), K(ffi.length())); + } + } + } + break; + } + case ObRbBinType::BITMAP_32: { + bool is_first = true; + roaring::api::roaring_bitmap_t *bitmap = nullptr; + roaring::api::roaring_uint32_iterator_t *iter = nullptr; + if (OB_ISNULL(bitmap = roaring::api::roaring_bitmap_portable_deserialize_safe(rb_bin.ptr() + offset, rb_bin.length() - offset))) { + ret = OB_DESERIALIZE_ERROR; + LOG_WARN("failed to deserialize the bitmap", K(ret)); + } else if (roaring::api::roaring_bitmap_get_cardinality(bitmap) > max_rb_to_string_cardinality) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("cardinality of roaringbitmap is over 1000000", K(ret), K(roaring::api::roaring_bitmap_get_cardinality(bitmap))); + } else if (OB_ISNULL(iter = roaring_iterator_create(bitmap))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("failed to get iterate from bitmap", K(ret)); + } else if (iter->has_value) { + do { + ObFastFormatInt ffi(iter->current_value); + if (!is_first && OB_FAIL(res_buf.append(","))) { + LOG_WARN("failed to append res_buf", K(ret)); + } else if (is_first && OB_FALSE_IT(is_first = false)) { + } else if (OB_FAIL(res_buf.append(ffi.ptr(), ffi.length(), 0))) { + LOG_WARN("failed to append res_buf", K(ret), K(iter->current_value), K(ffi.ptr()), K(ffi.length())); + } + } while (OB_SUCC(ret) && roaring::api::roaring_uint32_iterator_advance(iter)); + } + if (OB_NOT_NULL(iter)) { + roaring::api::roaring_uint32_iterator_free(iter); + } + if (OB_NOT_NULL(bitmap)) { + roaring::api::roaring_bitmap_free(bitmap); + } + break; + } + case ObRbBinType::BITMAP_64: { + bool is_first = true; + roaring::api::roaring64_bitmap_t *bitmap = nullptr; + roaring::api::roaring64_iterator_t *iter = nullptr; + if (OB_ISNULL(bitmap = roaring::api::roaring64_bitmap_portable_deserialize_safe( + rb_bin.ptr() + offset, + rb_bin.length() - offset))) { + ret = OB_DESERIALIZE_ERROR; + LOG_WARN("failed to deserialize the bitmap", K(ret)); + } else if (roaring::api::roaring64_bitmap_get_cardinality(bitmap) > max_rb_to_string_cardinality) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("cardinality of roaringbitmap is over 1000000", K(ret), K(roaring::api::roaring64_bitmap_get_cardinality(bitmap))); + } else if (OB_ISNULL(iter = roaring::api::roaring64_iterator_create(bitmap))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("failed to get iterate from bitmap", K(ret)); + } else if (roaring::api::roaring64_iterator_has_value(iter)) { + do { + ObFastFormatInt ffi(roaring::api::roaring64_iterator_value(iter)); + if (!is_first && OB_FAIL(res_buf.append(","))) { + LOG_WARN("failed to append res_buf", K(ret)); + } else if (is_first && OB_FALSE_IT(is_first = false)) { + } else if (OB_FAIL(res_buf.append(ffi.ptr(), ffi.length(), 0))) { + LOG_WARN("failed to append res_buf", K(ret), K(roaring::api::roaring64_iterator_value(iter)), K(ffi.ptr()), K(ffi.length())); + } + } while (OB_SUCC(ret) && roaring::api::roaring64_iterator_advance(iter)); + } + if (OB_NOT_NULL(iter)) { + roaring::api::roaring64_iterator_free(iter); + } + if (OB_NOT_NULL(bitmap)) { + roaring::api::roaring64_bitmap_free(bitmap); + } + break; + } + default: { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("unknown RbBinType", K(ret), K(bin_type)); + break; + } + } // end switch + } + + if (OB_SUCC(ret)) { + res_rb_str.assign_ptr(res_buf.ptr(), res_buf.length()); + } + return ret; +} + +int ObRbUtils::and_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + cardinality = 0; + if (rb2->is_bitmap_type() && !rb1->is_bitmap_type()) { + ret = and_cardinality(rb2, rb1, cardinality); + } else if (rb2->is_empty_type()) { + // do noting + } else if (rb2->is_single_type()) { + if (rb1->is_contains(rb2->get_single_value())) { + cardinality += 1; + } + } else if (rb2->is_set_type()) { + hash::ObHashSet *set = rb2->get_set(); + hash::ObHashSet::const_iterator iter; + for (iter = set->begin(); iter != set->end(); iter++) { + if (rb1->is_contains(iter->first)) { + cardinality += 1; + } + } + } else { // both rb1 and rb2 is bitmap type + cardinality = roaring::api::roaring64_bitmap_and_cardinality(rb1->get_bitmap(), rb2->get_bitmap()); + } + return ret; +} + +int ObRbUtils::or_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + uint64_t c1 = rb1->get_cardinality(); + uint64_t c2 = rb2->get_cardinality(); + uint64_t inter = 0; + if (OB_FAIL(and_cardinality(rb1, rb2, inter))) { + LOG_WARN("failed to get and_cardinality", K(ret)); + } else { + cardinality = c1 + c2 - inter; + } + return ret; +} + +int ObRbUtils::xor_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + uint64_t c1 = rb1->get_cardinality(); + uint64_t c2 = rb2->get_cardinality(); + uint64_t inter = 0; + if (OB_FAIL(and_cardinality(rb1, rb2, inter))) { + LOG_WARN("failed to get and_cardinality", K(ret)); + } else { + cardinality = c1 + c2 - 2 * inter; + } + return ret; +} + +int ObRbUtils::andnot_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality) +{ + int ret = OB_SUCCESS; + uint64_t c1 = rb1->get_cardinality(); + uint64_t inter = 0; + if (OB_FAIL(and_cardinality(rb1, rb2, inter))) { + LOG_WARN("failed to get and_cardinality", K(ret)); + } else { + cardinality = c1 - inter; + } + return ret; +} + +int ObRbUtils::calc_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality, ObRbOperation op) +{ + int ret = OB_SUCCESS; + if (op == ObRbOperation::AND) { + if (OB_FAIL(and_cardinality(rb1, rb2, cardinality))) { + LOG_WARN("failed to calculate cardinality", K(ret), K(op)); + } + } else if (op == ObRbOperation::OR) { + if (OB_FAIL(or_cardinality(rb1, rb2, cardinality))) { + LOG_WARN("failed to calculate cardinality", K(ret), K(op)); + } + } else if (op == ObRbOperation::XOR) { + if (OB_FAIL(xor_cardinality(rb1, rb2, cardinality))) { + LOG_WARN("failed to calculate cardinality", K(ret), K(op)); + } + } else if (op == ObRbOperation::ANDNOT) { + if (OB_FAIL(andnot_cardinality(rb1, rb2, cardinality))) { + LOG_WARN("failed to calculate cardinality", K(ret), K(op)); + } + } else { + ret = OB_NOT_SUPPORTED; + LOG_WARN("roaringbitmap operation not supported", K(ret), K(op)); + } + return ret; +} + +int ObRbUtils::str_read_value_(const char *str, size_t len, char *&value_end, uint64_t &value) +{ + int ret = OB_SUCCESS; + int err = 0; + if (*str == '-') { + int64_t get_int64 = ObCharset::strntoll(str, len, 10, &value_end, &err); + if (err == 0) { + value = static_cast(get_int64); + } else if (err == ERANGE) { + ret = OB_SIZE_OVERFLOW; + LOG_WARN("int64 value out of range", K(ret), K(str)); + } else { + ret = OB_INVALID_DATA; + LOG_WARN("invalid int64 value", K(ret), K(str)); + } + } else { + uint64_t get_uint64 = ObCharset::strntoull(str, len, 10, &value_end, &err); + if (err == 0) { + value = get_uint64; + } else if (err == ERANGE) { + ret = OB_SIZE_OVERFLOW; + LOG_WARN("uint64 value out of range", K(ret), K(str)); + } else { + ret = OB_INVALID_DATA; + LOG_WARN("invalid uint64 value", K(ret), K(str)); + } + } + return ret; +} + +} // namespace common +} // namespace oceanbase diff --git a/deps/oblib/src/lib/roaringbitmap/ob_rb_utils.h b/deps/oblib/src/lib/roaringbitmap/ob_rb_utils.h new file mode 100644 index 000000000..1a51b896b --- /dev/null +++ b/deps/oblib/src/lib/roaringbitmap/ob_rb_utils.h @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + */ + +#ifndef OCEANBASE_LIB_ROARINGBITMAP_OB_RB_UTILS_ +#define OCEANBASE_LIB_ROARINGBITMAP_OB_RB_UTILS_ + +#include "ob_roaringbitmap.h" +#include "lib/string/ob_string.h" +#include "lib/string/ob_string_buffer.h" + +namespace oceanbase { +namespace common { +class ObRbUtils +{ +public: + // constructor + ObRbUtils(); + virtual ~ObRbUtils() = default; + + // binary operation + static int check_get_bin_type(const ObString &rb_bin, ObRbBinType &bin_type); + static int get_cardinality(ObIAllocator &allocator, ObString &rb_bin, uint64_t &cardinality); + + // common + static void rb_destroy(ObRoaringBitmap *&rb); + static int rb_deserialize(ObIAllocator &allocator, const ObString &rb_bin, ObRoaringBitmap *&rb); + static int rb_serialize(ObIAllocator &allocator, ObString &res_rb_bin, ObRoaringBitmap *&rb); + static int binary_format_convert(ObIAllocator &allocator, const ObString &rb_bin, ObString &roaring_bin); + static int rb_from_string(ObIAllocator &allocator, ObString &rb_str, ObRoaringBitmap *&rb); + static int rb_to_string(ObIAllocator &allocator, ObString &rb_bin, ObString &res_rb_str); + + // calculate + static int and_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality); + static int or_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality); + static int xor_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality); + static int andnot_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality); + static int calc_cardinality(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, uint64_t &cardinality, ObRbOperation op); + static int rb_calc_equals(ObRoaringBitmap *&rb1, ObRoaringBitmap *&rb2, bool &result); //not impl + +private: + inline static void str_skip_space_(const char *&str, const char *end) { + while (str < end && (*str == ' ' || *str == '\0')) { + str++; + } + return; + } + static int str_read_value_(const char *str, size_t len, char *&value_end, uint64_t &value); + +}; + +} // namespace common +} // namespace oceanbase + +#endif // OCEANBASE_LIB_ROARINGBITMAP_OB_ROARINGBITMAP_ \ No newline at end of file diff --git a/deps/oblib/src/lib/roaringbitmap/ob_roaringbitmap.cpp b/deps/oblib/src/lib/roaringbitmap/ob_roaringbitmap.cpp new file mode 100644 index 000000000..27bfc5842 --- /dev/null +++ b/deps/oblib/src/lib/roaringbitmap/ob_roaringbitmap.cpp @@ -0,0 +1,645 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + */ + +#define USING_LOG_PREFIX LIB +#include "ob_roaringbitmap.h" +#include "lib/string/ob_string.h" +#include "lib/ob_define.h" +#include "lib/ob_errno.h" +#include "lib/oblog/ob_log.h" + +namespace oceanbase { +namespace common { + +uint64_t ObRoaringBitmap::get_cardinality() +{ + uint64_t cardinality = 0; + if (is_empty_type()) { + //do nonting + } else if (is_single_type()) { + cardinality = 1; + } else if (is_set_type()) { + cardinality = static_cast(set_.size()); + } else if (is_bitmap_type()) { + cardinality = roaring::api::roaring64_bitmap_get_cardinality(bitmap_); + } + return cardinality; +} + +uint64_t ObRoaringBitmap::get_max() +{ + uint64_t max_val = 0; + if (is_empty_type()) { + //do nonting + } else if (is_single_type()) { + max_val = single_value_; + } else if (is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = set_.begin(); iter != set_.end(); iter++) { + max_val = iter->first > max_val? iter->first : max_val; + } + } else if (is_bitmap_type()) { + max_val = roaring::api::roaring64_bitmap_maximum(bitmap_); + } + return max_val; +} + +bool ObRoaringBitmap::is_contains(uint64_t value) +{ + bool res = false; + if (is_empty_type()) { + //do nonting + } else if (is_single_type()) { + res = single_value_ == value; + } else if (is_set_type()) { + res = set_.exist_refactored(value) == OB_HASH_EXIST ? true : false; + } else if (is_bitmap_type()) { + res = roaring::api::roaring64_bitmap_contains(bitmap_, value); + } + return res; +} +int ObRoaringBitmap::value_add(uint64_t value) { + int ret = OB_SUCCESS; + switch (type_) { + case ObRbType::EMPTY: { + set_single(value); + break; + } + case ObRbType::SINGLE: { + if (single_value_ == value) { + //do nothing + } else { + if (OB_FAIL(set_.create(MAX_BITMAP_SET_VALUES))) { + LOG_WARN("failed to create set", K(ret)); + } else if (OB_FAIL(set_.set_refactored(single_value_))) { + LOG_WARN("failed to set value to the set", K(ret), K(single_value_)); + } else if (OB_FAIL(set_.set_refactored(value))) { + LOG_WARN("failed to set value to the set", K(ret), K(value)); + } else { + type_ = ObRbType::SET; + } + } + break; + } + case ObRbType::SET: { + if (set_.size() < MAX_BITMAP_SET_VALUES) { + if (OB_FAIL(set_.set_refactored(value))) { + LOG_WARN("failed to set value to the set", K(ret), K(value)); + } + } else if (set_.exist_refactored(value) != OB_HASH_EXIST) { // convert bitmap + if (OB_FAIL(convert_to_bitmap())) { + LOG_WARN("failed to convert roaringbitmap to bitmap type", K(ret)); + } else if (OB_FAIL(value_add(value))) { + LOG_WARN("failed to add value"); + } + } + break; + } + case ObRbType::BITMAP: { + roaring::api::roaring64_bitmap_add(bitmap_, value); + break; + } + default: { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("unknown RbType", K(ret), K(type_)); + break; + } + } // end switch + return ret; +} + +int ObRoaringBitmap::value_remove(uint64_t value) { + int ret = OB_SUCCESS; + switch (type_) { + case ObRbType::EMPTY: { + // do nothing + break; + } + case ObRbType::SINGLE: { + if (single_value_ == value) { + set_empty(); + } + break; + } + case ObRbType::SET: { + if (OB_FAIL(set_.erase_refactored(value))) { + LOG_WARN("failed to erase value from the set", K(ret), K(value)); + } + break; + } + case ObRbType::BITMAP: { + roaring::api::roaring64_bitmap_remove(bitmap_, value); + break; + } + default: { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("unknown RbType", K(ret), K(type_)); + break; + } + } // end switch + return ret; +} + +int ObRoaringBitmap::value_and(ObRoaringBitmap *rb) +{ + int ret = OB_SUCCESS; + if (is_empty_type()) { + //do nothing + } else if (is_single_type()) { + if (rb->is_contains(single_value_)) { + // do nothing + } else { + set_empty(); + } + } else if (is_set_type()) { + hash::ObHashSet::const_iterator iter = set_.begin(); + int set_size = set_.size(); + for (int i = 0; OB_SUCC(ret) && i < set_size; i++) { + if (i != 0) { + iter++; + } + if (!rb->is_contains(iter->first) && OB_FAIL(value_remove(iter->first))) { + LOG_WARN("failed to remove value", K(ret), K(iter->first)); + } + } + } else if (is_bitmap_type()) { + if (rb->is_empty_type()) { + set_empty(); + } else if (rb->is_single_type()) { + if (is_contains(rb->single_value_)) { + set_single(rb->single_value_); + } else { + set_empty(); + } + } else if (rb->is_set_type()) { + if (OB_FAIL(set_.create(MAX_BITMAP_SET_VALUES))) { + LOG_WARN("failed to create set", K(ret)); + } else { + hash::ObHashSet::const_iterator iter; + for (iter = rb->set_.begin(); OB_SUCC(ret) && iter != rb->set_.end(); iter++) { + if (is_contains(iter->first) && OB_FAIL(set_.set_refactored(iter->first))) { + LOG_WARN("failed to set_refactored to ObHashSet", K(ret), K(iter->first)); + } + } + } + if (OB_FAIL(ret)) { + } else { + roaring::api::roaring64_bitmap_free(bitmap_); + bitmap_ = NULL; + type_ = ObRbType::SET; + } + } else if (rb->is_bitmap_type()) { + roaring::api::roaring64_bitmap_and_inplace(bitmap_, rb->bitmap_); + } + } + return ret; +} + +int ObRoaringBitmap::value_or(ObRoaringBitmap *rb) +{ + int ret = OB_SUCCESS; + if (rb->is_empty_type()) { + // do nothing + } else if (rb->is_single_type()) { + if (OB_FAIL(value_add(rb->single_value_))) { + LOG_WARN("failed to add value", K(ret), K(rb->single_value_)); + } + } else if (rb->is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = rb->set_.begin(); OB_SUCC(ret) && iter != rb->set_.end(); iter++) { + if (OB_FAIL(value_add(iter->first))) { + LOG_WARN("failed to add value", K(ret), K(iter->first)); + } + } + } else if (rb->is_bitmap_type()) { + if (is_bitmap_type()) { + roaring::api::roaring64_bitmap_or_inplace(bitmap_, rb->bitmap_); + } else if(OB_ISNULL(bitmap_ = roaring::api::roaring64_bitmap_copy(rb->bitmap_))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to copy bitmap", K(ret)); + } else if (is_empty_type()) { + type_ = ObRbType::BITMAP; + } else if (is_single_type()) { + roaring::api::roaring64_bitmap_add(bitmap_, single_value_); + single_value_ = 0; + type_ = ObRbType::BITMAP; + } else if (is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = set_.begin(); iter != set_.end(); iter++) { + roaring::api::roaring64_bitmap_add(bitmap_, iter->first); + } + set_.destroy(); + type_ = ObRbType::BITMAP; + } + } + return ret; +} + +int ObRoaringBitmap::value_xor(ObRoaringBitmap *rb) +{ + int ret = OB_SUCCESS; + if (rb->is_empty_type()) { + // do nothing + } else if (rb->is_single_type()) { + if (is_contains(rb->single_value_)) { + if (OB_FAIL(value_remove(rb->single_value_))) { + LOG_WARN("failed to remove value", K(ret), K(rb->single_value_)); + } + } else { + if (OB_FAIL(value_add(rb->single_value_))) { + LOG_WARN("failed to add value", K(ret), K(rb->single_value_)); + } + } + } else if (rb->is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = rb->set_.begin(); OB_SUCC(ret) && iter != rb->set_.end(); iter++) { + if (is_contains(iter->first)) { + if (OB_FAIL(value_remove(iter->first))) { + LOG_WARN("failed to remove value", K(ret), K(iter->first)); + } + } else { + if (OB_FAIL(value_add(iter->first))) { + LOG_WARN("failed to add value", K(ret), K(iter->first)); + } + } + } + } else if (rb->is_bitmap_type()) { + if (is_bitmap_type()) { + roaring::api::roaring64_bitmap_xor_inplace(bitmap_, rb->bitmap_); + } else if(OB_ISNULL(bitmap_ = roaring::api::roaring64_bitmap_copy(rb->bitmap_))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to copy bitmap", K(ret)); + } else if (is_empty_type()) { + type_ = ObRbType::BITMAP; + } else if (is_single_type()) { + if (roaring::api::roaring64_bitmap_contains(bitmap_, single_value_)) { + roaring::api::roaring64_bitmap_remove(bitmap_, single_value_); + } else { + roaring::api::roaring64_bitmap_add(bitmap_, single_value_); + } + single_value_ = 0; + type_ = ObRbType::BITMAP; + } else if (is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = set_.begin(); iter != set_.end(); iter++) { + if (roaring::api::roaring64_bitmap_contains(bitmap_, iter->first)) { + roaring::api::roaring64_bitmap_remove(bitmap_, iter->first); + } else { + roaring::api::roaring64_bitmap_add(bitmap_, iter->first); + } + } + set_.destroy(); + type_ = ObRbType::BITMAP; + } + } + return ret; +} + +int ObRoaringBitmap::value_andnot(ObRoaringBitmap *rb) +{ + int ret = OB_SUCCESS; + if (rb->is_empty_type()) { + // do nothing + } else if (rb->is_single_type()) { + if (is_contains(rb->single_value_) && OB_FAIL(value_remove(rb->single_value_))) { + LOG_WARN("failed to remove value", K(ret), K(rb->single_value_)); + } + } else if (rb->is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = rb->set_.begin(); OB_SUCC(ret) && iter != rb->set_.end(); iter++) { + if (is_contains(iter->first) && OB_FAIL(value_remove(iter->first))) { + LOG_WARN("failed to remove value", K(ret), K(iter->first)); + } + } + } else if (rb->is_bitmap_type()) { + if (is_empty_type()) { + // do nothing + } else if (is_single_type()) { + if (roaring::api::roaring64_bitmap_contains(rb->bitmap_, single_value_)) { + set_empty(); + } + } else if (is_set_type()) { + hash::ObHashSet::const_iterator iter = set_.begin(); + int set_size = set_.size(); + for (int i = 0; OB_SUCC(ret) && i < set_size; i++) { + if (i != 0) { + iter++; + } + if (rb->is_contains(iter->first) && OB_FAIL(value_remove(iter->first))) { + LOG_WARN("failed to remove value", K(ret), K(iter->first)); + } + } + } else if (is_bitmap_type()) { + roaring::api::roaring64_bitmap_andnot_inplace(bitmap_, rb->bitmap_); + } + } + return ret; +} + +int ObRoaringBitmap::value_calc(ObRoaringBitmap *rb, ObRbOperation op) +{ + int ret = OB_SUCCESS; + if (op == ObRbOperation::AND) { + if (OB_FAIL(value_and(rb))) { + LOG_WARN("failed to calculate value and", K(ret), K(op)); + } + } else if (op == ObRbOperation::OR) { + if (OB_FAIL(value_or(rb))) { + LOG_WARN("failed to calculate value or", K(ret), K(op)); + } + } else if (op == ObRbOperation::XOR) { + if (OB_FAIL(value_xor(rb))) { + LOG_WARN("failed to calculate value xor", K(ret), K(op)); + } + } else if (op == ObRbOperation::ANDNOT) { + if (OB_FAIL(value_andnot(rb))) { + LOG_WARN("failed to calculate value andnot", K(ret), K(op)); + } + } else { + ret = OB_NOT_SUPPORTED; + LOG_WARN("roaringbitmap operation not supported", K(ret), K(op)); + } + return ret; +} + +int ObRoaringBitmap::optimize() +{ + int ret = OB_SUCCESS; + if (is_bitmap_type() && OB_FAIL(convert_bitmap_to_smaller_type())) { + LOG_WARN("failed to convert bitmap to smaller type"); + } else if (is_set_type()){ + uint64_t cardinality = static_cast(set_.size()); + if (cardinality == 0) { + set_empty(); + } else if (cardinality == 1) { + set_single (set_.begin()->first); + } + } + return ret; +} + +int ObRoaringBitmap::deserialize(const ObString &rb_bin) +{ + int ret = OB_SUCCESS; + uint32_t offset = RB_VERSION_SIZE + RB_BIN_TYPE_SIZE; + version_ = *(rb_bin.ptr()); + ObRbBinType bin_type = static_cast(*(rb_bin.ptr() + RB_VERSION_SIZE)); + switch (bin_type) { + case ObRbBinType::EMPTY: { + set_empty(); + break; + } + case ObRbBinType::SINGLE_32: { + uint32_t value_32 = *reinterpret_cast(rb_bin.ptr() + offset); + set_single(static_cast(value_32)); + break; + } + case ObRbBinType::SINGLE_64: { + set_single(*reinterpret_cast(rb_bin.ptr() + offset)); + break; + } + case ObRbBinType::SET_32: { + uint32_t value_32 = 0; + uint8_t value_count = static_cast(*(rb_bin.ptr() + offset)); + offset += RB_VALUE_COUNT_SIZE; + for (int i = 0; OB_SUCC(ret) && i < value_count; i++) { + value_32 = *reinterpret_cast(rb_bin.ptr() + offset); + offset += sizeof(uint32_t); + if (OB_FAIL(value_add(static_cast(value_32)))) { + LOG_WARN("failed to add value to roaringbtimap", K(ret), K(value_32)); + } + } + break; + } + case ObRbBinType::SET_64: { + uint64_t value_64 = 0; + uint8_t value_count = static_cast(*(rb_bin.ptr() + offset)); + offset += RB_VALUE_COUNT_SIZE; + for (int i = 0; OB_SUCC(ret) && i < value_count; i++) { + value_64 = *reinterpret_cast(rb_bin.ptr() + offset); + offset += sizeof(uint64_t); + if (OB_FAIL(value_add(value_64))) { + LOG_WARN("failed to add value to rb", K(ret), K(value_64)); + } + } + break; + } + case ObRbBinType::BITMAP_32: { + uint64_t serial_size = sizeof(uint64_t) + sizeof(uint32_t) + rb_bin.length() - offset; + uint64_t map_size = 1; + uint32_t map_prefix = 0; + ObStringBuffer tmp_buf(allocator_); + if (OB_FAIL(tmp_buf.append(reinterpret_cast(&map_size), sizeof(uint64_t)))) { + LOG_WARN("failed to append map size", K(ret)); + } else if (OB_FAIL(tmp_buf.append(reinterpret_cast(&map_prefix), sizeof(uint32_t)))) { + LOG_WARN("failed to append map prefix", K(ret)); + } else if (OB_FAIL(tmp_buf.append(rb_bin.ptr() + offset, rb_bin.length() - offset))) { + LOG_WARN("failed to append serialized string", K(ret), K(rb_bin)); + } else if (OB_ISNULL(bitmap_ = roaring::api::roaring64_bitmap_portable_deserialize_safe( + tmp_buf.ptr(), + tmp_buf.length()))) { + ret = OB_DESERIALIZE_ERROR; + LOG_WARN("failed to deserialize the bitmap", K(ret)); + } else if (!roaring::api::roaring64_bitmap_internal_validate(bitmap_, NULL)) { + ret = OB_DESERIALIZE_ERROR; + LOG_WARN("bitmap internal consistency checks failed", K(ret)); + } else { + type_ = ObRbType::BITMAP; + } + break; + } + case ObRbBinType::BITMAP_64: { + if (OB_ISNULL(bitmap_ = roaring::api::roaring64_bitmap_portable_deserialize_safe( + rb_bin.ptr() + offset, + rb_bin.length() - offset))) { + ret = OB_DESERIALIZE_ERROR; + LOG_WARN("failed to deserialize the bitmap", K(ret)); + } else if (!roaring::api::roaring64_bitmap_internal_validate(bitmap_, NULL)) { + ret = OB_DESERIALIZE_ERROR; + LOG_WARN("bitmap internal consistency checks failed", K(ret)); + } else { + type_ = ObRbType::BITMAP; + } + break; + } + default: { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("unknown RbBinType", K(ret), K(bin_type)); + break; + } + } // end switch + return ret; +} + +int ObRoaringBitmap::serialize(ObStringBuffer &res_buf) +{ + int ret = OB_SUCCESS; + ObRbBinType bin_type; + bool is_32bits_enough = (get_max() <= UINT32_MAX); + + if (OB_FAIL(res_buf.append(reinterpret_cast(&version_), RB_VERSION_SIZE))) { + LOG_WARN("failed to append version", K(ret)); + } else { + switch (type_) { + case ObRbType::EMPTY: { + bin_type = ObRbBinType::EMPTY; + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } + break; + } + case ObRbType::SINGLE: { + if (is_32bits_enough) { + bin_type = ObRbBinType::SINGLE_32; + uint32_t single_value_32 = static_cast(single_value_); + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(reinterpret_cast(&single_value_32), sizeof(uint32_t)))) { + LOG_WARN("failed to append single_value", K(ret)); + } + } else { + bin_type = ObRbBinType::SINGLE_64; + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(reinterpret_cast(&single_value_), sizeof(uint64_t)))) { + LOG_WARN("failed to append single_value", K(ret)); + } + } + break; + } + case ObRbType::SET: { + int8_t set_size = static_cast(set_.size()); + if (is_32bits_enough) { + bin_type = ObRbBinType::SET_32; + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(reinterpret_cast(&set_size), RB_VALUE_COUNT_SIZE))) { + LOG_WARN("failed to append single_value", K(ret)); + } else { + uint32_t value_32 = 0; + hash::ObHashSet::const_iterator iter; + for (iter = set_.begin(); iter != set_.end(); iter++) { + value_32 = static_cast(iter->first); + if (OB_FAIL(res_buf.append(reinterpret_cast(&value_32), sizeof(uint32_t)))) { + LOG_WARN("failed to append value", K(ret)); + } + } + } + } else { + bin_type = ObRbBinType::SET_64; + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(reinterpret_cast(&set_size), RB_VALUE_COUNT_SIZE))) { + LOG_WARN("failed to append single_value", K(ret)); + } else { + hash::ObHashSet::const_iterator iter; + for (iter = set_.begin(); iter != set_.end(); iter++) { + if (OB_FAIL(res_buf.append(reinterpret_cast(&(iter->first)), sizeof(uint64_t)))) { + LOG_WARN("failed to append value", K(ret)); + } + } + } + } + break; + } + case ObRbType::BITMAP: { + ObStringBuffer tmp_buf(allocator_); + if (roaring::api::roaring64_bitmap_is_empty(bitmap_)) { + bin_type = ObRbBinType::BITMAP_32; + uint32_t roaring32_cookie = 12346; + uint32_t container_num = 0; + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(reinterpret_cast(&roaring32_cookie), sizeof(uint32_t)))) { + LOG_WARN("failed to append roaring32_cookie", K(ret)); + } else if (OB_FAIL(res_buf.append(reinterpret_cast(&container_num), sizeof(uint32_t)))) { + LOG_WARN("failed to append container_num", K(ret)); + } + } else { + uint64_t header_size = RB_VERSION_SIZE + RB_BIN_TYPE_SIZE; + uint64_t serial_size = static_cast(roaring::api::roaring64_bitmap_portable_size_in_bytes(bitmap_)); + if (OB_FAIL(tmp_buf.reserve(serial_size))) { + LOG_WARN("failed to reserve buffer", K(ret), K(serial_size)); + } else if (serial_size != roaring::api::roaring64_bitmap_portable_serialize(bitmap_, tmp_buf.ptr())) { + ret = OB_SERIALIZE_ERROR; + LOG_WARN("serialize size not match", K(ret), K(serial_size)); + } else if (OB_FAIL(tmp_buf.set_length(serial_size))) { + LOG_WARN("failed to set buffer length", K(ret)); + } else if (is_32bits_enough) { + bin_type = ObRbBinType::BITMAP_32; + uint64_t roaring64_header_size = sizeof(uint64_t) + sizeof(uint32_t); + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(tmp_buf.ptr() + roaring64_header_size, tmp_buf.length() - roaring64_header_size))) { + LOG_WARN("failed to append serialized string", K(ret), K(tmp_buf)); + } + } else { + bin_type = ObRbBinType::BITMAP_64; + if (OB_FAIL(res_buf.append(reinterpret_cast(&bin_type), RB_BIN_TYPE_SIZE))) { + LOG_WARN("failed to append bin_type", K(ret)); + } else if (OB_FAIL(res_buf.append(tmp_buf.ptr(), tmp_buf.length()))) { + LOG_WARN("failed to append serialized string", K(ret), K(tmp_buf)); + } + } + } + break; + } + default: { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("unknown RbType", K(ret), K(type_)); + break; + } + } //end switch + } + return ret; +} + +int ObRoaringBitmap::convert_to_bitmap() { + int ret = OB_SUCCESS; + if (is_bitmap_type()) { + // do nothing + } else if (OB_ISNULL(bitmap_ = roaring::api::roaring64_bitmap_create())) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create bitmap", K(ret)); + } else { + if (is_single_type()) { + roaring::api::roaring64_bitmap_add(bitmap_, single_value_); + single_value_ = 0; + } else if (is_set_type()) { + hash::ObHashSet::const_iterator iter; + for (iter = set_.begin(); iter != set_.end(); iter++) { + roaring::api::roaring64_bitmap_add(bitmap_, iter->first); + } + set_.destroy(); + } + type_ = ObRbType::BITMAP; + } + return ret; +} + +int ObRoaringBitmap::convert_bitmap_to_smaller_type() { + int ret = OB_SUCCESS; + if (is_bitmap_type()) { + uint64_t cardinality = roaring::api::roaring64_bitmap_get_cardinality(bitmap_); + if (cardinality > 1) { + //do nothing + } else if (cardinality == 1) { + set_single(roaring64_bitmap_minimum(bitmap_)); + } else if (cardinality == 0) { + set_empty(); + } + } + return ret; +} + +} // namespace common +} // namespace oceanbase \ No newline at end of file diff --git a/deps/oblib/src/lib/roaringbitmap/ob_roaringbitmap.h b/deps/oblib/src/lib/roaringbitmap/ob_roaringbitmap.h new file mode 100644 index 000000000..7ddf862ef --- /dev/null +++ b/deps/oblib/src/lib/roaringbitmap/ob_roaringbitmap.h @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + */ + +#ifndef OCEANBASE_LIB_ROARINGBITMAP_OB_ROARINGBITMAP_ +#define OCEANBASE_LIB_ROARINGBITMAP_OB_ROARINGBITMAP_ + +#include +#include +#include "roaring/roaring.h" +#include "roaring/roaring64.h" +#include "lib/string/ob_string.h" +#include "lib/string/ob_string_buffer.h" +#include "lib/oblog/ob_log_module.h" +#include "lib/hash/ob_hashset.h" +#include "lib/allocator/page_arena.h" + + +namespace oceanbase { +namespace common { + +#define MAX_BITMAP_SET_VALUES 32 +#define IS_VALID_RB_VERSION(ver) (ver == BITMAP_VESION_1) + +static const uint32_t RB_VERSION_SIZE = sizeof(uint8_t); +static const uint32_t RB_TYPE_SIZE = sizeof(uint8_t); +static const uint32_t RB_BIN_TYPE_SIZE = sizeof(uint8_t); +static const uint32_t RB_VALUE_COUNT_SIZE = sizeof(uint8_t); + +static const uint8_t BITMAP_VESION_1 = 1; + +enum class ObRbBinType +{ + EMPTY = 0, // empty bitmap + SINGLE_32 = 1, // single uint32_t element + SINGLE_64 = 2, // single uint64_t element + SET_32 = 3, // cardinality <= 32 && max element <= MAX_UINT32 + SET_64 = 4, // cardinality <= 32 + BITMAP_32 = 5, // cardinality > 32 && max element <= MAX_UINT32, RoaringBitmap + BITMAP_64 = 6, // cardinality > 32, RoaringBitmap + MAX_TYPE = 7 +}; + +enum class ObRbType +{ + EMPTY = 0, // empty bitmap + SINGLE = 1, // single element + SET = 2, // cardinality <= 32 + BITMAP = 3, // cardinality > 32, RoaringBitmap +}; + +enum class ObRbOperation +{ + OR = 0, + AND = 1, + XOR = 2, + ANDNOT = 3, +}; +class ObRoaringBitmap +{ +public: + ObRoaringBitmap(ObIAllocator *allocator) + : allocator_(allocator), + version_(BITMAP_VESION_1), + type_(ObRbType::EMPTY), + bitmap_(nullptr) {} + virtual ~ObRoaringBitmap() = default; + + inline uint8_t get_version() { return version_; } + inline ObRbType get_type() { return type_; } + inline uint64_t get_single_value() { return single_value_; } + inline hash::ObHashSet* get_set() { return &set_; } + inline roaring::api::roaring64_bitmap_t * get_bitmap() { return bitmap_; } + inline bool is_empty_type() { return ObRbType::EMPTY == type_; } + inline bool is_single_type() { return ObRbType::SINGLE == type_; } + inline bool is_set_type() { return ObRbType::SET == type_; } + inline bool is_bitmap_type() { return ObRbType::BITMAP == type_; } + + uint64_t get_cardinality(); + uint64_t get_max(); + bool is_contains(uint64_t value); + + int value_add(uint64_t value); + int value_remove(uint64_t value); + int value_and(ObRoaringBitmap *rb); + int value_or(ObRoaringBitmap *rb); + int value_xor(ObRoaringBitmap *rb); + int value_andnot(ObRoaringBitmap *rb); + int value_calc(ObRoaringBitmap *rb, ObRbOperation op); + + int optimize(); + int deserialize(const ObString &rb_bin); + int serialize(ObStringBuffer &res_rb_bin); + + inline void set_empty() { + single_value_ = 0; + if (set_.created()) { + set_.destroy(); + } + if (OB_NOT_NULL(bitmap_)) { + roaring::api::roaring64_bitmap_free(bitmap_); + bitmap_ = NULL; + } + type_ = ObRbType::EMPTY; + } + inline void set_single(uint64_t val) { + single_value_ = val; + if (set_.created()) { + set_.destroy(); + } + if (OB_NOT_NULL(bitmap_)) { + roaring::api::roaring64_bitmap_free(bitmap_); + bitmap_ = NULL; + } + type_ = ObRbType::SINGLE; + } + + int convert_bitmap_to_smaller_type(); + int convert_to_bitmap(); + +private: + ObIAllocator* allocator_; + uint8_t version_; + ObRbType type_; + uint64_t single_value_; + hash::ObHashSet set_; + roaring::api::roaring64_bitmap_t *bitmap_; + +}; + +} // namespace common +} // namespace oceanbase + +#endif // OCEANBASE_LIB_ROARINGBITMAP_OB_ROARINGBITMAP_ \ No newline at end of file diff --git a/deps/oblib/src/lib/rowid/ob_urowid.cpp b/deps/oblib/src/lib/rowid/ob_urowid.cpp index b4e5f0e37..c5912597a 100644 --- a/deps/oblib/src/lib/rowid/ob_urowid.cpp +++ b/deps/oblib/src/lib/rowid/ob_urowid.cpp @@ -358,7 +358,10 @@ DEF_GET_OTIME_PK_VALUE(ObTimestampNanoType, timestamp_nano, uint16_t); ObGeometryType, \ ObUserDefinedSQLType, \ ObDecimalIntType, \ - ObCollectionSQLType + ObCollectionSQLType, \ + ObMySQLDateType, \ + ObMySQLDateTimeType, \ + ObRoaringBitmapType #define DEF_GET_PK_FUNC(obj_type) ObURowIDData::inner_get_pk_value diff --git a/deps/oblib/src/rpc/obmysql/ob_mysql_global.h b/deps/oblib/src/rpc/obmysql/ob_mysql_global.h index 701813b61..a50f66d96 100644 --- a/deps/oblib/src/rpc/obmysql/ob_mysql_global.h +++ b/deps/oblib/src/rpc/obmysql/ob_mysql_global.h @@ -260,6 +260,7 @@ enum EMySQLFieldType MYSQL_TYPE_OB_UROWID = 209, MYSQL_TYPE_ORA_BLOB = 210, MYSQL_TYPE_ORA_CLOB = 211, + MYSQL_TYPE_ROARINGBITMAP = 215, MYSQL_TYPE_JSON = 245, MYSQL_TYPE_NEWDECIMAL = 246, MYSQL_TYPE_ENUM = 247, @@ -355,6 +356,9 @@ inline const char *get_emysql_field_type_str(const obmysql::EMySQLFieldType &typ case obmysql::MYSQL_TYPE_OB_RAW: str = "MYSQL_TYPE_OB_RAW"; break; + case obmysql::MYSQL_TYPE_ROARINGBITMAP: + str = "MYSQL_TYPE_ROARINGBITMAP"; + break; case obmysql::MYSQL_TYPE_NEWDECIMAL: str = "MYSQL_TYPE_NEWDECIMAL"; break; diff --git a/deps/oblib/src/rpc/obmysql/ob_mysql_util.h b/deps/oblib/src/rpc/obmysql/ob_mysql_util.h index 226340845..08544608e 100644 --- a/deps/oblib/src/rpc/obmysql/ob_mysql_util.h +++ b/deps/oblib/src/rpc/obmysql/ob_mysql_util.h @@ -436,6 +436,7 @@ public: const ObDecimalInt *decint, const int32_t int_bytes, int16_t scale, int64_t &pos, bool zerofill, int32_t zflength); static int geometry_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos); + static int roaringbitmap_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos); static inline int16_t float_length(const int16_t scale); public: diff --git a/src/logservice/libobcdc/src/ob_log_formatter.cpp b/src/logservice/libobcdc/src/ob_log_formatter.cpp index 4a7cd8fde..eeaaa1f79 100644 --- a/src/logservice/libobcdc/src/ob_log_formatter.cpp +++ b/src/logservice/libobcdc/src/ob_log_formatter.cpp @@ -1322,7 +1322,7 @@ int ObLogFormatter::fill_normal_cols_( ret = OB_ERR_UNEXPECTED; LOG_ERROR("not support ext info log type", KR(ret), K(is_new_value), KPC(lob_data_get_ctx), KPC(cv)); } - } else if (cv->is_json() || cv->is_geometry()) { + } else if (cv->is_json() || cv->is_geometry() || cv->is_roaringbitmap()) { const common::ObObjType obj_type = cv->get_obj_type(); cv->value_.set_string(obj_type, *new_col_str); @@ -1375,7 +1375,7 @@ int ObLogFormatter::fill_normal_cols_( ret = OB_ERR_UNEXPECTED; LOG_ERROR("not support ext info log type", KR(ret), K(is_new_value), KPC(lob_data_get_ctx), KPC(cv)); } - } else if (cv->is_json() || cv->is_geometry()) { + } else if (cv->is_json() || cv->is_geometry() || cv->is_roaringbitmap()) { const common::ObObjType obj_type = cv->get_obj_type(); cv->value_.set_string(obj_type, *old_col_str); diff --git a/src/logservice/libobcdc/src/ob_log_meta_manager.cpp b/src/logservice/libobcdc/src/ob_log_meta_manager.cpp index 8429abfcf..e1403d9f4 100644 --- a/src/logservice/libobcdc/src/ob_log_meta_manager.cpp +++ b/src/logservice/libobcdc/src/ob_log_meta_manager.cpp @@ -1178,6 +1178,8 @@ int ObLogMetaManager::set_column_meta_( col_meta->setPrecision(column_schema.get_data_precision()); } else if (column_schema.is_xmltype()) { mysql_type = obmysql::MYSQL_TYPE_ORA_XML; + } else if (ObRoaringBitmapType == col_type) { + mysql_type = obmysql::MYSQL_TYPE_ROARINGBITMAP; } col_meta->setScale(column_schema.get_data_scale()); diff --git a/src/logservice/libobcdc/src/ob_log_part_trans_task.cpp b/src/logservice/libobcdc/src/ob_log_part_trans_task.cpp index 2a08d74fa..c387795e7 100644 --- a/src/logservice/libobcdc/src/ob_log_part_trans_task.cpp +++ b/src/logservice/libobcdc/src/ob_log_part_trans_task.cpp @@ -398,6 +398,11 @@ int MutatorRow::add_column_( "old_obj_len", value->get_string_len(), "new_obj_ptr", (void *)cv_node->value_.get_string_ptr(), "new_obj_len", cv_node->value_.get_string_len()); + } else if (value->is_roaringbitmap() && value->get_string_len() > 2 * _M_) { // RoaringBitmap may exceed 2M + OBLOG_FORMATTER_LOG(DEBUG, "column_cast: ", "old_obj_ptr", (void *)value->get_string_ptr(), + "old_obj_len", value->get_string_len(), + "new_obj_ptr", (void *)cv_node->value_.get_string_ptr(), + "new_obj_len", cv_node->value_.get_string_len()); } else { OBLOG_FORMATTER_LOG(DEBUG, "column_cast: ", "old_obj", *value, "new_obj", cv_node->value_); diff --git a/src/logservice/libobcdc/src/ob_log_part_trans_task.h b/src/logservice/libobcdc/src/ob_log_part_trans_task.h index 11919a3e1..6c30f4553 100644 --- a/src/logservice/libobcdc/src/ob_log_part_trans_task.h +++ b/src/logservice/libobcdc/src/ob_log_part_trans_task.h @@ -192,6 +192,7 @@ struct ColValue bool is_json() const { return value_.is_json(); } bool is_geometry() const { return value_.is_geometry(); } + bool is_roaringbitmap() const { return value_.is_roaringbitmap(); } common::ObObjType get_obj_type() const { return value_.get_type(); } int add_child(ColValue *child) {return children_.add(child);} diff --git a/src/logservice/libobcdc/src/ob_log_utils.cpp b/src/logservice/libobcdc/src/ob_log_utils.cpp index d2863967c..70b656bfd 100644 --- a/src/logservice/libobcdc/src/ob_log_utils.cpp +++ b/src/logservice/libobcdc/src/ob_log_utils.cpp @@ -487,6 +487,10 @@ const char *get_ctype_string(int ctype) sc_type = "MYSQL_TYPE_OB_RAW"; break; + case oceanbase::obmysql::MYSQL_TYPE_ROARINGBITMAP: + sc_type = "MYSQL_TYPE_ROARINGBITMAP"; + break; + case oceanbase::obmysql::MYSQL_TYPE_NEWDECIMAL: sc_type = "MYSQL_TYPE_NEWDECIMAL"; break; @@ -621,6 +625,11 @@ bool is_xml_type(const int ctype) return (ctype == drcmsg_field_types::DRCMSG_TYPE_ORA_XML); } +bool is_roaringbitmap_type(const int ctype) +{ + return (ctype == oceanbase::obmysql::MYSQL_TYPE_ROARINGBITMAP); +} + double get_delay_sec(const int64_t tstamp_ns) { int64_t delta = (ObTimeUtility::current_time() - tstamp_ns / NS_CONVERSION); diff --git a/src/logservice/libobcdc/src/ob_log_utils.h b/src/logservice/libobcdc/src/ob_log_utils.h index 9c61b253f..3f19a3166 100644 --- a/src/logservice/libobcdc/src/ob_log_utils.h +++ b/src/logservice/libobcdc/src/ob_log_utils.h @@ -250,6 +250,7 @@ bool is_string_type(const int ctype); bool is_json_type(const int ctype); bool is_geometry_type(const int ctype); bool is_xml_type(const int ctype); +bool is_roaringbitmap_type(const int ctype); int64_t get_non_hidden_column_count(const oceanbase::share::schema::ObTableSchema &table_schema); double get_delay_sec(const int64_t tstamp); diff --git a/src/logservice/libobcdc/src/ob_obj2str_helper.cpp b/src/logservice/libobcdc/src/ob_obj2str_helper.cpp index 4e29d21f9..7b2f9697e 100644 --- a/src/logservice/libobcdc/src/ob_obj2str_helper.cpp +++ b/src/logservice/libobcdc/src/ob_obj2str_helper.cpp @@ -21,6 +21,7 @@ #include "sql/engine/expr/ob_datum_cast.h" // padding_char_for_cast #include "lib/alloc/ob_malloc_allocator.h" #include "lib/geo/ob_geo_utils.h" +#include "lib/roaringbitmap/ob_rb_utils.h" #include "lib/xml/ob_xml_util.h" #include "sql/engine/expr/ob_expr_uuid.h" #include "sql/engine/expr/ob_expr_operator.h" @@ -165,6 +166,11 @@ int ObObj2strHelper::obj2str(const uint64_t tenant_id, OBLOG_LOG(ERROR, "convert_ob_geometry_to_ewkt_ fail", KR(ret), K(table_id), K(column_id), K(obj), K(obj_type), K(str)); } + } else if (ObRoaringBitmapType == obj_type) { + if (OB_FAIL(ObRbUtils::binary_format_convert(allocator, obj.get_string(), str))) { + OBLOG_LOG(ERROR, "binary_format_convert fail", KR(ret), K(table_id), K(column_id), + K(obj), K(obj_type), K(str)); + } // This should be before is_string_type, because for char/nchar it is also ObStringTC, so is_string_type=true } else if (need_padding_(compat_mode, obj)) { if (OB_FAIL(convert_char_obj_to_padding_obj_(compat_mode, obj, accuracy, collation_type, allocator, str))) { diff --git a/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp b/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp index 99369a10f..0be346832 100644 --- a/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp +++ b/src/logservice/libobcdc/tests/ob_binlog_record_printer.cpp @@ -553,9 +553,10 @@ int ObBinlogRecordPrinter::output_data_file_column_data(IBinlogRecord *br, ObStringBuffer enum_set_values_str(&str_allocator); bool is_geometry = is_geometry_type(ctype); bool is_xml = is_xml_type(ctype); + bool is_roaringbitmap = is_roaringbitmap_type(ctype); bool is_diff = (index < new_cols_count) && new_cols[index].m_diff_val; constexpr int64_t string_print_md5_threshold = 4L << 10; - const bool is_type_for_md5_printing = is_lob || is_json || is_geometry || is_xml || + const bool is_type_for_md5_printing = is_lob || is_json || is_geometry || is_xml || is_roaringbitmap || (is_string && col_data_length >= string_print_md5_threshold); // TODO 止尘 patch the code // bool is_json_diff = br->isJsonDiffColVal(cname); @@ -826,7 +827,8 @@ bool ObBinlogRecordPrinter::need_print_hex(int ctype) || obmysql::MYSQL_TYPE_OB_NVARCHAR2 == ctype || obmysql::MYSQL_TYPE_OB_NCHAR == ctype || obmysql::MYSQL_TYPE_JSON == ctype - || obmysql::MYSQL_TYPE_GEOMETRY == ctype); + || obmysql::MYSQL_TYPE_GEOMETRY == ctype + || obmysql::MYSQL_TYPE_ROARINGBITMAP == ctype); } int ObBinlogRecordPrinter::write_data_file(const int fd, diff --git a/src/objit/include/objit/common/ob_item_type.h b/src/objit/include/objit/common/ob_item_type.h index c7eaefa0d..9af6559c0 100755 --- a/src/objit/include/objit/common/ob_item_type.h +++ b/src/objit/include/objit/common/ob_item_type.h @@ -82,7 +82,7 @@ typedef enum ObItemType T_GEOMETRY = 48, T_UDT_SQL = 49, T_COLLECTION = 51, - T_ROARINGBITMAP = 52, + T_ROARINGBITMAP = 54, T_IEEE754_NAN = 61, T_IEEE754_INFINITE = 62, @@ -2691,6 +2691,9 @@ extern const char *get_type_name(int type); (op) == T_FUN_ORA_XMLAGG || \ (op) == T_FUN_SYS_ST_ASMVT || \ (op) == T_FUN_SUM_OPNSIZE ||\ + (op) == T_FUN_SYS_RB_BUILD_AGG ||\ + (op) == T_FUN_SYS_RB_OR_AGG ||\ + (op) == T_FUN_SYS_RB_AND_AGG ||\ ((op) >= T_FUN_SYS_BIT_AND && (op) <= T_FUN_SYS_BIT_XOR)) #define MAYBE_ROW_OP(op) ((op) >= T_OP_EQ && (op) <= T_OP_NE) #define IS_PSEUDO_COLUMN_TYPE(op) \ diff --git a/src/objit/src/ob_llvm_helper.cpp b/src/objit/src/ob_llvm_helper.cpp index e6d00b9b6..c122ab254 100644 --- a/src/objit/src/ob_llvm_helper.cpp +++ b/src/objit/src/ob_llvm_helper.cpp @@ -127,7 +127,8 @@ static ObGetIRType OB_IR_TYPE[common::ObMaxType + 1] = NULL, //51.ObCollectionSQLType reinterpret_cast(ObIRType::getInt32Ty), //52.ObMySQLDateType reinterpret_cast(ObIRType::getInt64Ty), //53.ObMySQLDateTimeType - NULL, //54.ObMaxType + NULL, //54.ObRoaringBitmapType + NULL, //55.ObMaxType }; template diff --git a/src/observer/mysql/ob_query_driver.cpp b/src/observer/mysql/ob_query_driver.cpp index 37b0faa2b..6b02b2174 100644 --- a/src/observer/mysql/ob_query_driver.cpp +++ b/src/observer/mysql/ob_query_driver.cpp @@ -256,7 +256,7 @@ int ObQueryDriver::response_query_result(ObResultSet &result, LOG_WARN("convert text value charset failed", K(ret)); } if (OB_FAIL(ret)){ - } else if ((value.is_lob() || value.is_lob_locator() || value.is_json() || value.is_geometry()) + } else if ((value.is_lob() || value.is_lob_locator() || value.is_json() || value.is_geometry() || value.is_roaringbitmap()) && OB_FAIL(process_lob_locator_results(value, result))) { LOG_WARN("convert lob locator to longtext failed", K(ret)); } else if ((value.is_user_defined_sql_type() || value.is_collection_sql_type() || value.is_geometry()) && @@ -634,8 +634,10 @@ int ObQueryDriver::process_lob_locator_results(ObObj& value, // 2. if client is_use_lob_locator, but not support outrow lob, return lob locator with inrow data // refer to sz/aibo1m // 3. if client does not support use_lob_locator ,,return full lob data without locator header - bool is_lob_type = value.is_lob() || value.is_json() || value.is_geometry() || value.is_lob_locator(); - bool is_actual_return_lob_locator = is_use_lob_locator && !value.is_json() && !value.is_geometry(); + bool is_lob_type = value.is_lob() || value.is_lob_locator() + || value.is_json() || value.is_geometry() || value.is_roaringbitmap() ; + bool is_actual_return_lob_locator = is_use_lob_locator && !value.is_json() + && !value.is_geometry() && !value.is_roaringbitmap(); if (!is_lob_type) { // not lob types, do nothing } else if (value.is_null() || value.is_nop_value()) { @@ -711,6 +713,8 @@ int ObQueryDriver::process_lob_locator_results(ObObj& value, dst_type = ObJsonType; } else if (value.is_geometry()) { dst_type = ObGeometryType; + } else if (value.is_roaringbitmap()) { + dst_type = ObRoaringBitmapType; } // remove has lob header flag value.set_lob_value(dst_type, data.ptr(), static_cast(data.length())); diff --git a/src/observer/mysql/ob_sync_cmd_driver.cpp b/src/observer/mysql/ob_sync_cmd_driver.cpp index 3e7683abf..92823e446 100644 --- a/src/observer/mysql/ob_sync_cmd_driver.cpp +++ b/src/observer/mysql/ob_sync_cmd_driver.cpp @@ -337,7 +337,7 @@ int ObSyncCmdDriver::response_query_result(ObMySQLResultSet &result) LOG_WARN("convert text value charset failed", K(ret)); } if (OB_FAIL(ret)) { - } else if ((value.is_lob() || value.is_lob_locator() || value.is_json() || value.is_geometry()) + } else if ((value.is_lob() || value.is_lob_locator() || value.is_json() || value.is_geometry() || value.is_roaringbitmap()) && OB_FAIL(process_lob_locator_results(value, result))) { LOG_WARN("convert lob locator to longtext failed", K(ret)); } else if ((value.is_user_defined_sql_type() || value.is_collection_sql_type() || value.is_geometry()) && diff --git a/src/observer/mysql/obmp_utils.cpp b/src/observer/mysql/obmp_utils.cpp index 4d1f0d21c..48fe7eabc 100644 --- a/src/observer/mysql/obmp_utils.cpp +++ b/src/observer/mysql/obmp_utils.cpp @@ -670,14 +670,15 @@ int ObMPUtils::get_literal_print_length(const ObObj &obj, bool is_plain, int64_t len = 0; int32_t len_of_string = 0; const ObLobLocator *locator = nullptr; - if (!obj.is_string_or_lob_locator_type() && !obj.is_json() && !obj.is_geometry()) { + if (!obj.is_string_or_lob_locator_type() && !obj.is_json() && !obj.is_geometry() && !obj.is_roaringbitmap()) { len = OB_MAX_SYS_VAR_NON_STRING_VAL_LENGTH; } else if (OB_UNLIKELY((len_of_string = obj.get_string_len()) < 0)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("string length invalid", K(obj), K(len_of_string)); } else if (obj.is_char() || obj.is_varchar() || obj.is_text() || ob_is_nstring_type(obj.get_type()) - || obj.is_json() || obj.is_geometry()) { + || obj.is_json() || obj.is_geometry() + || obj.is_roaringbitmap()) { //if is_plain is false, 'j' will be print as "j\0" (with Quotation Marks here) //otherwise. as j\0 (withOUT Quotation Marks here) ObHexEscapeSqlStr sql_str(obj.get_string()); diff --git a/src/observer/mysql/obsm_utils.cpp b/src/observer/mysql/obsm_utils.cpp index a19046e58..916c4ef22 100644 --- a/src/observer/mysql/obsm_utils.cpp +++ b/src/observer/mysql/obsm_utils.cpp @@ -94,6 +94,9 @@ static const ObMySQLTypeMap type_maps_[ObMaxType] = {EMySQLFieldType::MYSQL_TYPE_COMPLEX, 0, 0}, /* ObUserDefinedSQLType */ {EMySQLFieldType::MYSQL_TYPE_NEWDECIMAL, 0, 0}, /* ObDecimalIntType */ {EMySQLFieldType::MYSQL_TYPE_STRING, 0, 0}, /* ObCollectionSQLType, will cast to string */ + {EMySQLFieldType::MYSQL_TYPE_NOT_DEFINED, 0, 0}, /* reserved for ObMySQLDateType */ + {EMySQLFieldType::MYSQL_TYPE_NOT_DEFINED, 0, 0}, /* reserved for ObMySQLDateTimeType */ + {EMySQLFieldType::MYSQL_TYPE_BLOB, BLOB_FLAG, 0}, /* ObRoaringBitmapType */ /* ObMaxType */ }; @@ -192,7 +195,8 @@ int ObSMUtils::cell_str( case ObStringTC: // lob locator也会按varchar方式进行encode, 客户端往server端传输数据时, // 也是将lob locator按varchar传输, 先编码LobLocator length, 然后再编码整个lob Locator - case ObLobTC: { + case ObLobTC: + case ObRoaringBitmapTC: { ret = ObMySQLUtil::varchar_cell_str(buf, len, obj.get_string(), is_oracle_raw, pos); break; } diff --git a/src/rootserver/ob_index_builder.cpp b/src/rootserver/ob_index_builder.cpp index d9193549f..d33f2ed7e 100644 --- a/src/rootserver/ob_index_builder.cpp +++ b/src/rootserver/ob_index_builder.cpp @@ -950,6 +950,10 @@ int ObIndexBuilder::generate_schema( ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, sort_item.column_name_.length(), sort_item.column_name_.ptr()); LOG_WARN("index created direct on large text column should only be fulltext", K(arg.index_type_), K(ret)); + } else if (ob_is_roaringbitmap_tc(data_column->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, sort_item.column_name_.length(), sort_item.column_name_.ptr()); + LOG_WARN("index created on roaringbitmap column is not supported", K(arg.index_type_), K(ret)); } else if (ObTimestampTZType == data_column->get_data_type() && arg.is_unique_primary_index()) { ret = OB_ERR_WRONG_KEY_COLUMN; diff --git a/src/share/aggregate/iaggregate.cpp b/src/share/aggregate/iaggregate.cpp index 9e461c5c8..b2de7c47d 100644 --- a/src/share/aggregate/iaggregate.cpp +++ b/src/share/aggregate/iaggregate.cpp @@ -154,6 +154,7 @@ static int32_t reserved_agg_col_size(RuntimeContext &agg_ctx, int64_t agg_col_id RTSIZE(VEC_TC_DEC_INT256), // dec_int256 RTSIZE(VEC_TC_DEC_INT512), // dec_int512 string_reserved_size, // collection + string_reserved_size, // roaringbitmap }; static_assert(sizeof(reserved_sizes) / sizeof(reserved_sizes[0]) == MAX_VEC_TC, ""); OB_ASSERT(aggr_info.expr_ != NULL); diff --git a/src/share/aggregate/iaggregate.h b/src/share/aggregate/iaggregate.h index 6543fed11..4cabc7ca5 100644 --- a/src/share/aggregate/iaggregate.h +++ b/src/share/aggregate/iaggregate.h @@ -848,7 +848,8 @@ inline constexpr bool is_var_len_agg_cell(VecValueTypeClass vec_tc) || vec_tc == VEC_TC_RAW || vec_tc == VEC_TC_JSON || vec_tc == VEC_TC_GEO - || vec_tc == VEC_TC_UDT; + || vec_tc == VEC_TC_UDT + || vec_tc == VEC_TC_ROARINGBITMAP; } template diff --git a/src/share/aggregate/util.h b/src/share/aggregate/util.h index 55ca42aa8..196049c6d 100644 --- a/src/share/aggregate/util.h +++ b/src/share/aggregate/util.h @@ -615,7 +615,8 @@ inline bool supported_aggregate_function(const ObItemType agg_op) VEC_TC_DEC_INT64, \ VEC_TC_DEC_INT128, \ VEC_TC_DEC_INT256, \ - VEC_TC_DEC_INT512 + VEC_TC_DEC_INT512, \ + VEC_TC_ROARINGBITMAP } // end namespace aggregate } // end namespace share diff --git a/src/share/datum/ob_datum.cpp b/src/share/datum/ob_datum.cpp index 4e91227de..9e508f957 100644 --- a/src/share/datum/ob_datum.cpp +++ b/src/share/datum/ob_datum.cpp @@ -78,6 +78,7 @@ ObObjDatumMapType ObDatum::get_obj_datum_map_type(const ObObjType type) OBJ_DATUM_STRING, // ObCollectionSQLType OBJ_DATUM_4BYTE_DATA, // ObMySQLDateType OBJ_DATUM_8BYTE_DATA, // ObMySQLDateTimeType + OBJ_DATUM_STRING, // ObRoaringBitmapType }; static_assert(sizeof(maps) / sizeof(maps[0]) == ObMaxType, "new added type should extend this map"); diff --git a/src/share/datum/ob_datum.h b/src/share/datum/ob_datum.h index 96448075d..8162aaeb0 100644 --- a/src/share/datum/ob_datum.h +++ b/src/share/datum/ob_datum.h @@ -864,7 +864,8 @@ inline int ObDatum::from_obj(const ObObj &obj) case ObJsonType: case ObGeometryType: case ObUserDefinedSQLType: - case ObCollectionSQLType: { + case ObCollectionSQLType: + case ObRoaringBitmapType: { obj2datum(obj); break; } @@ -1012,7 +1013,8 @@ inline int ObDatum::to_obj(ObObj &obj, const ObObjMeta &meta) const case ObJsonType: case ObGeometryType: case ObUserDefinedSQLType: - case ObCollectionSQLType: { + case ObCollectionSQLType: + case ObRoaringBitmapType: { datum2obj(obj); break; } diff --git a/src/share/inner_table/ob_inner_table_schema.21151_21200.cpp b/src/share/inner_table/ob_inner_table_schema.21151_21200.cpp index 89c5a4243..41404a09f 100644 --- a/src/share/inner_table/ob_inner_table_schema.21151_21200.cpp +++ b/src/share/inner_table/ob_inner_table_schema.21151_21200.cpp @@ -2010,7 +2010,7 @@ int ObInnerTableSchema::cdb_tab_cols_v_schema(ObTableSchema &table_schema) table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT/*+leading(DB,TC,STAT)*/ CAST(DB.TENANT_ID AS SIGNED) AS CON_ID, CAST(DB.DATABASE_NAME AS CHAR(128)) AS OWNER, CAST(TC.TABLE_NAME AS CHAR(128)) AS TABLE_NAME, CAST(TC.COLUMN_NAME AS CHAR(128)) AS COLUMN_NAME, CAST(CASE TC.DATA_TYPE WHEN 0 THEN 'VARCHAR2' WHEN 1 THEN 'NUMBER' WHEN 2 THEN 'NUMBER' WHEN 3 THEN 'NUMBER' WHEN 4 THEN 'NUMBER' WHEN 5 THEN 'NUMBER' WHEN 6 THEN 'NUMBER' WHEN 7 THEN 'NUMBER' WHEN 8 THEN 'NUMBER' WHEN 9 THEN 'NUMBER' WHEN 10 THEN 'NUMBER' WHEN 11 THEN 'BINARY_FLOAT' WHEN 12 THEN 'BINARY_DOUBLE' WHEN 13 THEN 'NUMBER' WHEN 14 THEN 'NUMBER' WHEN 15 THEN 'NUMBER' WHEN 16 THEN 'NUMBER' WHEN 17 THEN 'DATE' WHEN 18 THEN 'TIMESTAMP' WHEN 19 THEN 'DATE' WHEN 20 THEN 'TIME' WHEN 21 THEN 'YEAR' WHEN 22 THEN 'VARCHAR2' WHEN 23 THEN 'CHAR' WHEN 24 THEN 'HEX_STRING' WHEN 25 THEN 'UNDEFINED' WHEN 26 THEN 'UNKNOWN' WHEN 27 THEN 'TINYTEXT' WHEN 28 THEN 'TEXT' WHEN 29 THEN 'MEDIUMTEXT' WHEN 30 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 'BLOB' ELSE 'CLOB' END) WHEN 31 THEN 'BIT' WHEN 32 THEN 'ENUM' WHEN 33 THEN 'SET' WHEN 34 THEN 'ENUM_INNER' WHEN 35 THEN 'SET_INNER' WHEN 36 THEN CONCAT('TIMESTAMP(', CONCAT(TC.DATA_SCALE, ') WITH TIME ZONE')) WHEN 37 THEN CONCAT('TIMESTAMP(', CONCAT(TC.DATA_SCALE, ') WITH LOCAL TIME ZONE')) WHEN 38 THEN CONCAT('TIMESTAMP(', CONCAT(TC.DATA_SCALE, ')')) WHEN 39 THEN 'RAW' WHEN 40 THEN CONCAT('INTERVAL YEAR(', CONCAT(TC.DATA_SCALE, ') TO MONTH')) WHEN 41 THEN CONCAT('INTERVAL DAY(', CONCAT(FLOOR(TC.DATA_SCALE/10), CONCAT(') TO SECOND(', CONCAT(MOD(TC.DATA_SCALE, 10), ')')))) WHEN 42 THEN 'FLOAT' WHEN 43 THEN 'NVARCHAR2' WHEN 44 THEN 'NCHAR' WHEN 45 THEN 'UROWID' WHEN 46 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 'BLOB' ELSE 'CLOB' END) WHEN 47 THEN 'JSON' WHEN 50 THEN 'NUMBER' ELSE 'UNDEFINED' END AS CHAR(128)) AS DATA_TYPE, CAST(NULL AS CHAR(3)) AS DATA_TYPE_MOD, CAST(NULL AS CHAR(128)) AS DATA_TYPE_OWNER, CAST(TC.DATA_LENGTH * CASE WHEN TC.DATA_TYPE IN (22,23,30,43,44,46) AND TC.DATA_PRECISION = 1 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 1 WHEN 249 THEN 4 WHEN 248 THEN 4 WHEN 87 THEN 2 WHEN 28 THEN 2 WHEN 55 THEN 4 WHEN 54 THEN 4 WHEN 101 THEN 2 WHEN 46 THEN 4 WHEN 45 THEN 4 WHEN 224 THEN 4 ELSE 1 END) ELSE 1 END AS SIGNED) AS DATA_LENGTH, CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN TC.DATA_PRECISION < 0 THEN NULL ELSE TC.DATA_PRECISION END END AS SIGNED) AS DATA_PRECISION, CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN TC.DATA_SCALE < -84 THEN NULL ELSE TC.DATA_SCALE END END AS SIGNED) AS DATA_SCALE, CAST((CASE WHEN TC.NULLABLE = 0 THEN 'N' WHEN (TC.COLUMN_FLAGS & (5 * POWER(2, 13))) = 5 * POWER(2, 13) THEN 'N' ELSE 'Y' END) AS CHAR(1)) AS NULLABLE, CAST(CASE WHEN (TC.COLUMN_FLAGS & 64) = 0 THEN TC.COLUMN_ID ELSE NULL END AS SIGNED) AS COLUMN_ID, CAST(LENGTH(TC.CUR_DEFAULT_VALUE_V2) AS SIGNED) AS DEFAULT_LENGTH, CAST(TC.CUR_DEFAULT_VALUE_V2 AS /* TODO: LONG() */ CHAR(262144)) AS DATA_DEFAULT, CAST(STAT.DISTINCT_CNT AS SIGNED) AS NUM_DISTINCT, CAST(STAT.MIN_VALUE AS /* TODO: RAW */ CHAR(128)) AS LOW_VALUE, CAST(STAT.MAX_VALUE AS /* TODO: RAW */ CHAR(128)) AS HIGH_VALUE, CAST(STAT.DENSITY AS SIGNED) AS DENSITY, CAST(STAT.NULL_CNT AS SIGNED) AS NUM_NULLS, CAST(STAT.BUCKET_CNT AS SIGNED) AS NUM_BUCKETS, CAST(STAT.LAST_ANALYZED AS DATE) AS LAST_ANALYZED, CAST(STAT.SAMPLE_SIZE AS SIGNED) AS SAMPLE_SIZE, CAST(CASE TC.DATA_TYPE WHEN 22 THEN 'CHAR_CS' WHEN 23 THEN 'CHAR_CS' WHEN 30 THEN (CASE WHEN TC.COLLATION_TYPE = 63 THEN 'NULL' ELSE 'CHAR_CS' END) WHEN 43 THEN 'NCHAR_CS' WHEN 44 THEN 'NCHAR_CS' ELSE '' END AS CHAR(44)) AS CHARACTER_SET_NAME, CAST(NULL AS SIGNED) AS CHAR_COL_DECL_LENGTH, CAST(CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END AS CHAR(3)) AS GLOBAL_STATS, CAST(CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END AS CHAR(3)) AS USER_STATS, CAST(NULL AS CHAR(80)) AS NOTES, CAST(STAT.AVG_LEN AS SIGNED) AS AVG_COL_LEN, CAST(CASE WHEN TC.DATA_TYPE IN (22,23,43,44) THEN TC.DATA_LENGTH ELSE 0 END AS SIGNED) AS CHAR_LENGTH, CAST(CASE TC.DATA_TYPE WHEN 22 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) WHEN 23 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) WHEN 43 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) WHEN 44 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) ELSE NULL END AS CHAR(1)) AS CHAR_USED, CAST(NULL AS CHAR(3)) AS V80_FMT_IMAGE, CAST(NULL AS CHAR(3)) AS DATA_UPGRADED, CAST(CASE WHEN (TC.COLUMN_FLAGS & 64) = 0 THEN 'NO' ELSE 'YES' END AS CHAR(3)) AS HIDDEN_COLUMN, CAST(CASE WHEN (TC.COLUMN_FLAGS & 1) = 1 THEN 'YES' ELSE 'NO' END AS CHAR(3)) AS VIRTUAL_COLUMN, CAST(NULL AS SIGNED) AS SEGMENT_COLUMN_ID, CAST(NULL AS SIGNED) AS INTERNAL_COLUMN_ID, CAST((CASE WHEN STAT.HISTOGRAM_TYPE = 1 THEN 'FREQUENCY' WHEN STAT.HISTOGRAM_TYPE = 3 THEN 'TOP-FREQUENCY' WHEN STAT.HISTOGRAM_TYPE = 4 THEN 'HYBRID' ELSE NULL END) AS CHAR(15)) AS HISTOGRAM, CAST(TC.COLUMN_NAME AS CHAR(4000)) AS QUALIFIED_COL_NAME, CAST('YES' AS CHAR(3)) AS USER_GENERATED, CAST(NULL AS CHAR(3)) AS DEFAULT_ON_NULL, CAST(NULL AS CHAR(3)) AS IDENTITY_COLUMN, CAST(NULL AS CHAR(128)) AS EVALUATION_EDITION, CAST(NULL AS CHAR(128)) AS UNUSABLE_BEFORE, CAST(NULL AS CHAR(128)) AS UNUSABLE_BEGINNING, CAST(NULL AS CHAR(100)) AS COLLATION, CAST(NULL AS SIGNED) AS COLLATED_COLUMN_ID FROM (SELECT T.TENANT_ID, T.TABLE_ID, T.DATABASE_ID, T.TABLE_NAME, T.TABLE_TYPE, C.COLUMN_ID, C.COLUMN_NAME, C.DATA_TYPE, C.COLLATION_TYPE, C.DATA_SCALE, C.DATA_LENGTH, C.DATA_PRECISION, C.NULLABLE, C.COLUMN_FLAGS, C.CUR_DEFAULT_VALUE_V2 FROM OCEANBASE.__ALL_VIRTUAL_CORE_ALL_TABLE T JOIN OCEANBASE.__ALL_VIRTUAL_CORE_COLUMN_TABLE C ON C.TENANT_ID = T.TENANT_ID AND C.TABLE_ID = T.TABLE_ID AND C.IS_HIDDEN = 0 UNION ALL SELECT T.TENANT_ID, T.TABLE_ID, T.DATABASE_ID, T.TABLE_NAME, T.TABLE_TYPE, C.COLUMN_ID, C.COLUMN_NAME, C.DATA_TYPE, C.COLLATION_TYPE, C.DATA_SCALE, C.DATA_LENGTH, C.DATA_PRECISION, C.NULLABLE, C.COLUMN_FLAGS, C.CUR_DEFAULT_VALUE_V2 FROM OCEANBASE.__ALL_VIRTUAL_TABLE T JOIN OCEANBASE.__ALL_VIRTUAL_COLUMN C ON C.TENANT_ID = T.TENANT_ID AND C.TABLE_ID = T.TABLE_ID WHERE TABLE_MODE >> 12 & 15 in (0,1) AND C.IS_HIDDEN = 0) TC JOIN OCEANBASE.__ALL_VIRTUAL_DATABASE DB ON DB.TENANT_ID = TC.TENANT_ID AND DB.DATABASE_ID = TC.DATABASE_ID LEFT JOIN OCEANBASE.__ALL_VIRTUAL_COLUMN_STAT STAT ON TC.TENANT_ID = STAT.TENANT_ID AND TC.TABLE_ID = STAT.TABLE_ID AND TC.COLUMN_ID = STAT.COLUMN_ID AND STAT.OBJECT_TYPE = 1 WHERE TC.TABLE_TYPE IN (0,1,3,4,6,7,8,9,14,15) )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT/*+leading(DB,TC,STAT)*/ CAST(DB.TENANT_ID AS SIGNED) AS CON_ID, CAST(DB.DATABASE_NAME AS CHAR(128)) AS OWNER, CAST(TC.TABLE_NAME AS CHAR(128)) AS TABLE_NAME, CAST(TC.COLUMN_NAME AS CHAR(128)) AS COLUMN_NAME, CAST(CASE TC.DATA_TYPE WHEN 0 THEN 'VARCHAR2' WHEN 1 THEN 'NUMBER' WHEN 2 THEN 'NUMBER' WHEN 3 THEN 'NUMBER' WHEN 4 THEN 'NUMBER' WHEN 5 THEN 'NUMBER' WHEN 6 THEN 'NUMBER' WHEN 7 THEN 'NUMBER' WHEN 8 THEN 'NUMBER' WHEN 9 THEN 'NUMBER' WHEN 10 THEN 'NUMBER' WHEN 11 THEN 'BINARY_FLOAT' WHEN 12 THEN 'BINARY_DOUBLE' WHEN 13 THEN 'NUMBER' WHEN 14 THEN 'NUMBER' WHEN 15 THEN 'NUMBER' WHEN 16 THEN 'NUMBER' WHEN 17 THEN 'DATE' WHEN 18 THEN 'TIMESTAMP' WHEN 19 THEN 'DATE' WHEN 20 THEN 'TIME' WHEN 21 THEN 'YEAR' WHEN 22 THEN 'VARCHAR2' WHEN 23 THEN 'CHAR' WHEN 24 THEN 'HEX_STRING' WHEN 25 THEN 'UNDEFINED' WHEN 26 THEN 'UNKNOWN' WHEN 27 THEN 'TINYTEXT' WHEN 28 THEN 'TEXT' WHEN 29 THEN 'MEDIUMTEXT' WHEN 30 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 'BLOB' ELSE 'CLOB' END) WHEN 31 THEN 'BIT' WHEN 32 THEN 'ENUM' WHEN 33 THEN 'SET' WHEN 34 THEN 'ENUM_INNER' WHEN 35 THEN 'SET_INNER' WHEN 36 THEN CONCAT('TIMESTAMP(', CONCAT(TC.DATA_SCALE, ') WITH TIME ZONE')) WHEN 37 THEN CONCAT('TIMESTAMP(', CONCAT(TC.DATA_SCALE, ') WITH LOCAL TIME ZONE')) WHEN 38 THEN CONCAT('TIMESTAMP(', CONCAT(TC.DATA_SCALE, ')')) WHEN 39 THEN 'RAW' WHEN 40 THEN CONCAT('INTERVAL YEAR(', CONCAT(TC.DATA_SCALE, ') TO MONTH')) WHEN 41 THEN CONCAT('INTERVAL DAY(', CONCAT(FLOOR(TC.DATA_SCALE/10), CONCAT(') TO SECOND(', CONCAT(MOD(TC.DATA_SCALE, 10), ')')))) WHEN 42 THEN 'FLOAT' WHEN 43 THEN 'NVARCHAR2' WHEN 44 THEN 'NCHAR' WHEN 45 THEN 'UROWID' WHEN 46 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 'BLOB' ELSE 'CLOB' END) WHEN 47 THEN 'JSON' WHEN 50 THEN 'NUMBER' WHEN 54 THEN 'ROARINGBITMAP' ELSE 'UNDEFINED' END AS CHAR(128)) AS DATA_TYPE, CAST(NULL AS CHAR(3)) AS DATA_TYPE_MOD, CAST(NULL AS CHAR(128)) AS DATA_TYPE_OWNER, CAST(TC.DATA_LENGTH * CASE WHEN TC.DATA_TYPE IN (22,23,30,43,44,46) AND TC.DATA_PRECISION = 1 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 1 WHEN 249 THEN 4 WHEN 248 THEN 4 WHEN 87 THEN 2 WHEN 28 THEN 2 WHEN 55 THEN 4 WHEN 54 THEN 4 WHEN 101 THEN 2 WHEN 46 THEN 4 WHEN 45 THEN 4 WHEN 224 THEN 4 ELSE 1 END) ELSE 1 END AS SIGNED) AS DATA_LENGTH, CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44,54) THEN NULL ELSE CASE WHEN TC.DATA_PRECISION < 0 THEN NULL ELSE TC.DATA_PRECISION END END AS SIGNED) AS DATA_PRECISION, CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,19,22,23,27,28,29,30,42,43,44,54) THEN NULL ELSE CASE WHEN TC.DATA_SCALE < -84 THEN NULL ELSE TC.DATA_SCALE END END AS SIGNED) AS DATA_SCALE, CAST((CASE WHEN TC.NULLABLE = 0 THEN 'N' WHEN (TC.COLUMN_FLAGS & (5 * POWER(2, 13))) = 5 * POWER(2, 13) THEN 'N' ELSE 'Y' END) AS CHAR(1)) AS NULLABLE, CAST(CASE WHEN (TC.COLUMN_FLAGS & 64) = 0 THEN TC.COLUMN_ID ELSE NULL END AS SIGNED) AS COLUMN_ID, CAST(LENGTH(TC.CUR_DEFAULT_VALUE_V2) AS SIGNED) AS DEFAULT_LENGTH, CAST(TC.CUR_DEFAULT_VALUE_V2 AS /* TODO: LONG() */ CHAR(262144)) AS DATA_DEFAULT, CAST(STAT.DISTINCT_CNT AS SIGNED) AS NUM_DISTINCT, CAST(STAT.MIN_VALUE AS /* TODO: RAW */ CHAR(128)) AS LOW_VALUE, CAST(STAT.MAX_VALUE AS /* TODO: RAW */ CHAR(128)) AS HIGH_VALUE, CAST(STAT.DENSITY AS SIGNED) AS DENSITY, CAST(STAT.NULL_CNT AS SIGNED) AS NUM_NULLS, CAST(STAT.BUCKET_CNT AS SIGNED) AS NUM_BUCKETS, CAST(STAT.LAST_ANALYZED AS DATE) AS LAST_ANALYZED, CAST(STAT.SAMPLE_SIZE AS SIGNED) AS SAMPLE_SIZE, CAST(CASE TC.DATA_TYPE WHEN 22 THEN 'CHAR_CS' WHEN 23 THEN 'CHAR_CS' WHEN 30 THEN (CASE WHEN TC.COLLATION_TYPE = 63 THEN 'NULL' ELSE 'CHAR_CS' END) WHEN 43 THEN 'NCHAR_CS' WHEN 44 THEN 'NCHAR_CS' ELSE '' END AS CHAR(44)) AS CHARACTER_SET_NAME, CAST(NULL AS SIGNED) AS CHAR_COL_DECL_LENGTH, CAST(CASE STAT.GLOBAL_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END AS CHAR(3)) AS GLOBAL_STATS, CAST(CASE STAT.USER_STATS WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' ELSE NULL END AS CHAR(3)) AS USER_STATS, CAST(NULL AS CHAR(80)) AS NOTES, CAST(STAT.AVG_LEN AS SIGNED) AS AVG_COL_LEN, CAST(CASE WHEN TC.DATA_TYPE IN (22,23,43,44) THEN TC.DATA_LENGTH ELSE 0 END AS SIGNED) AS CHAR_LENGTH, CAST(CASE TC.DATA_TYPE WHEN 22 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) WHEN 23 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) WHEN 43 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) WHEN 44 THEN (CASE WHEN TC.DATA_PRECISION = 1 THEN 'C' ELSE 'B' END) ELSE NULL END AS CHAR(1)) AS CHAR_USED, CAST(NULL AS CHAR(3)) AS V80_FMT_IMAGE, CAST(NULL AS CHAR(3)) AS DATA_UPGRADED, CAST(CASE WHEN (TC.COLUMN_FLAGS & 64) = 0 THEN 'NO' ELSE 'YES' END AS CHAR(3)) AS HIDDEN_COLUMN, CAST(CASE WHEN (TC.COLUMN_FLAGS & 1) = 1 THEN 'YES' ELSE 'NO' END AS CHAR(3)) AS VIRTUAL_COLUMN, CAST(NULL AS SIGNED) AS SEGMENT_COLUMN_ID, CAST(NULL AS SIGNED) AS INTERNAL_COLUMN_ID, CAST((CASE WHEN STAT.HISTOGRAM_TYPE = 1 THEN 'FREQUENCY' WHEN STAT.HISTOGRAM_TYPE = 3 THEN 'TOP-FREQUENCY' WHEN STAT.HISTOGRAM_TYPE = 4 THEN 'HYBRID' ELSE NULL END) AS CHAR(15)) AS HISTOGRAM, CAST(TC.COLUMN_NAME AS CHAR(4000)) AS QUALIFIED_COL_NAME, CAST('YES' AS CHAR(3)) AS USER_GENERATED, CAST(NULL AS CHAR(3)) AS DEFAULT_ON_NULL, CAST(NULL AS CHAR(3)) AS IDENTITY_COLUMN, CAST(NULL AS CHAR(128)) AS EVALUATION_EDITION, CAST(NULL AS CHAR(128)) AS UNUSABLE_BEFORE, CAST(NULL AS CHAR(128)) AS UNUSABLE_BEGINNING, CAST(NULL AS CHAR(100)) AS COLLATION, CAST(NULL AS SIGNED) AS COLLATED_COLUMN_ID FROM (SELECT T.TENANT_ID, T.TABLE_ID, T.DATABASE_ID, T.TABLE_NAME, T.TABLE_TYPE, C.COLUMN_ID, C.COLUMN_NAME, C.DATA_TYPE, C.COLLATION_TYPE, C.DATA_SCALE, C.DATA_LENGTH, C.DATA_PRECISION, C.NULLABLE, C.COLUMN_FLAGS, C.CUR_DEFAULT_VALUE_V2 FROM OCEANBASE.__ALL_VIRTUAL_CORE_ALL_TABLE T JOIN OCEANBASE.__ALL_VIRTUAL_CORE_COLUMN_TABLE C ON C.TENANT_ID = T.TENANT_ID AND C.TABLE_ID = T.TABLE_ID AND C.IS_HIDDEN = 0 UNION ALL SELECT T.TENANT_ID, T.TABLE_ID, T.DATABASE_ID, T.TABLE_NAME, T.TABLE_TYPE, C.COLUMN_ID, C.COLUMN_NAME, C.DATA_TYPE, C.COLLATION_TYPE, C.DATA_SCALE, C.DATA_LENGTH, C.DATA_PRECISION, C.NULLABLE, C.COLUMN_FLAGS, C.CUR_DEFAULT_VALUE_V2 FROM OCEANBASE.__ALL_VIRTUAL_TABLE T JOIN OCEANBASE.__ALL_VIRTUAL_COLUMN C ON C.TENANT_ID = T.TENANT_ID AND C.TABLE_ID = T.TABLE_ID WHERE TABLE_MODE >> 12 & 15 in (0,1) AND C.IS_HIDDEN = 0) TC JOIN OCEANBASE.__ALL_VIRTUAL_DATABASE DB ON DB.TENANT_ID = TC.TENANT_ID AND DB.DATABASE_ID = TC.DATABASE_ID LEFT JOIN OCEANBASE.__ALL_VIRTUAL_COLUMN_STAT STAT ON TC.TENANT_ID = STAT.TENANT_ID AND TC.TABLE_ID = STAT.TABLE_ID AND TC.COLUMN_ID = STAT.COLUMN_ID AND STAT.OBJECT_TYPE = 1 WHERE TC.TABLE_TYPE IN (0,1,3,4,6,7,8,9,14,15) )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index 597fd7873..ddcf7c7e1 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -20820,6 +20820,7 @@ SELECT/*+leading(DB,TC,STAT)*/ WHEN 46 THEN (CASE TC.COLLATION_TYPE WHEN 63 THEN 'BLOB' ELSE 'CLOB' END) WHEN 47 THEN 'JSON' WHEN 50 THEN 'NUMBER' + WHEN 54 THEN 'ROARINGBITMAP' ELSE 'UNDEFINED' END AS CHAR(128)) AS DATA_TYPE, CAST(NULL AS CHAR(3)) AS DATA_TYPE_MOD, CAST(NULL AS CHAR(128)) AS DATA_TYPE_OWNER, @@ -20839,11 +20840,11 @@ SELECT/*+leading(DB,TC,STAT)*/ ELSE 1 END) ELSE 1 END AS SIGNED) AS DATA_LENGTH, - CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) + CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44,54) THEN NULL ELSE CASE WHEN TC.DATA_PRECISION < 0 THEN NULL ELSE TC.DATA_PRECISION END END AS SIGNED) AS DATA_PRECISION, - CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,19,22,23,27,28,29,30,42,43,44) + CAST(CASE WHEN TC.DATA_TYPE IN (0,11,12,17,19,22,23,27,28,29,30,42,43,44,54) THEN NULL ELSE CASE WHEN TC.DATA_SCALE < -84 THEN NULL ELSE TC.DATA_SCALE END END AS SIGNED) AS DATA_SCALE, diff --git a/src/share/inner_table/table_id_to_name b/src/share/inner_table/table_id_to_name index 9a0552429..b70b7156b 100644 --- a/src/share/inner_table/table_id_to_name +++ b/src/share/inner_table/table_id_to_name @@ -1736,10 +1736,6 @@ # 20014: ENGINES # 20015: ROUTINES # 20016: PROFILING -# 20020: INNODB_FT_BEING_DELETED -# 20021: INNODB_FT_CONFIG -# 20022: INNODB_FT_DELETED -# 20023: INNODB_FT_INDEX_CACHE # 21000: GV$SESSION_EVENT # 21001: GV$SESSION_WAIT # 21002: GV$SESSION_WAIT_HISTORY diff --git a/src/share/ob_index_builder_util.cpp b/src/share/ob_index_builder_util.cpp index 218406469..eaed68369 100644 --- a/src/share/ob_index_builder_util.cpp +++ b/src/share/ob_index_builder_util.cpp @@ -288,6 +288,10 @@ int ObIndexBuilderUtil::add_shadow_partition_keys( ret = OB_ERR_WRONG_KEY_COLUMN; LOG_WARN("Unexpected lob column in shadow partition key", "table_id", data_schema.get_table_id(), K(column_id), K(ret)); + } else if (ob_is_roaringbitmap_tc(const_data_column->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_WARN("Unexpected roaringbitmap column in shadow partition key", "table_id", data_schema.get_table_id(), + K(column_id), K(ret)); } else if (ob_is_extend(const_data_column->get_data_type()) || ob_is_user_defined_sql_type(const_data_column->get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; @@ -433,6 +437,14 @@ int ObIndexBuilderUtil::set_index_table_columns( "column name", sort_item.column_name_, "column length", sort_item.prefix_len_, K(ret)); } + } else if (ob_is_roaringbitmap_tc(data_column->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, sort_item.column_name_.length(), sort_item.column_name_.ptr()); + LOG_WARN("roaringbitmap column cannot be used in key specification", "tenant_id", data_schema.get_tenant_id(), + "database_id", data_schema.get_database_id(), + "table_name", data_schema.get_table_name(), + "column name", sort_item.column_name_, + "column length", sort_item.prefix_len_, K(ret)); } else if (data_column->is_xmltype()) { ret = OB_ERR_XML_INDEX; LOG_USER_ERROR(OB_ERR_XML_INDEX, sort_item.column_name_.length(), sort_item.column_name_.ptr()); @@ -507,6 +519,11 @@ int ObIndexBuilderUtil::set_index_table_columns( LOG_WARN("Lob column should not appear in rowkey position", "data_column", *data_column, K(is_index_column), K(is_rowkey), "order_in_rowkey", data_column->get_order_in_rowkey(), K(row_desc), K(ret)); + } else if (ob_is_roaringbitmap_tc(data_column->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_WARN("roaringbitmap column should not appear in rowkey position", "data_column", *data_column, K(is_index_column), + K(is_rowkey), "order_in_rowkey", data_column->get_order_in_rowkey(), + K(row_desc), K(ret)); } else if (ob_is_extend(data_column->get_data_type()) || ob_is_user_defined_sql_type(data_column->get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_WARN("udt column should not appear in rowkey position", "data_column", *data_column, K(is_index_column), @@ -556,6 +573,12 @@ int ObIndexBuilderUtil::set_index_table_columns( LOG_WARN("Index storing column should not be lob type", "tenant_id", data_schema.get_tenant_id(), "database_id", data_schema.get_database_id(), "table_name", data_schema.get_table_name(), "column name", arg.store_columns_.at(i), K(ret)); + } else if (ob_is_roaringbitmap_tc(data_column->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, arg.store_columns_.at(i).length(), arg.store_columns_.at(i).ptr()); + LOG_WARN("Index storing column should not be roaringbitmap type", "tenant_id", data_schema.get_tenant_id(), + "database_id", data_schema.get_database_id(), "table_name", + data_schema.get_table_name(), "column name", arg.store_columns_.at(i), K(ret)); } else if (ob_is_extend(data_column->get_data_type()) || ob_is_user_defined_sql_type(data_column->get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, arg.store_columns_.at(i).length(), arg.store_columns_.at(i).ptr()); @@ -596,6 +619,14 @@ int ObIndexBuilderUtil::set_index_table_columns( "tenant_id", data_schema.get_tenant_id(), "database_id", data_schema.get_database_id(), "table_name", data_schema.get_table_name(), "column name", arg.hidden_store_columns_.at(i), K(ret)); + } else if (ob_is_roaringbitmap_tc(data_column->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, arg.hidden_store_columns_.at(i).length(), + arg.hidden_store_columns_.at(i).ptr()); + LOG_WARN("Index storing column should not be roaringbitmap type", + "tenant_id", data_schema.get_tenant_id(), + "database_id", data_schema.get_database_id(), "table_name", + data_schema.get_table_name(), "column name", arg.hidden_store_columns_.at(i), K(ret)); } else if (ob_is_extend(data_column->get_data_type()) || ob_is_user_defined_sql_type(data_column->get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; diff --git a/src/share/object/ob_obj_cast.cpp b/src/share/object/ob_obj_cast.cpp index 0a25a429f..de7d213e4 100644 --- a/src/share/object/ob_obj_cast.cpp +++ b/src/share/object/ob_obj_cast.cpp @@ -29,6 +29,7 @@ #include "lib/json_type/ob_json_bin.h" #include "lib/json_type/ob_json_base.h" #include "lib/json_type/ob_json_parse.h" +#include "lib/roaringbitmap/ob_rb_utils.h" #include "share/ob_lob_access_utils.h" #include "sql/engine/expr/ob_expr_lob_utils.h" #include "sql/engine/expr/ob_expr_sql_udt_utils.h" @@ -908,7 +909,8 @@ int ObHexUtils::rawtohex(const ObObj &text, ObCastCtx &cast_ctx, ObObj &result) case ObLongTextType: case ObRawType: case ObJsonType: - case ObGeometryType: { + case ObGeometryType: + case ObRoaringBitmapType: { //https://www.techonthenet.com/oracle/functions/rawtohex.php //NOTE:: when convert string to raw, Oracle use utl_raw.cast_to_raw(), while PL/SQL use hextoraw() // here we use utl_raw.cast_to_raw(), as we can not distinguish in which SQL @@ -7048,6 +7050,11 @@ ObCastEnumOrSetFunc OB_CAST_ENUM_OR_SET[ObMaxTC][2] = cast_not_support_enum_set,/*enum*/ cast_not_support_enum_set,/*set*/ }, + { + /*ObRoaringBitmapTC -> enum_or_set*/ + cast_not_support_enum_set,/*enum*/ + cast_not_support_enum_set,/*set*/ + }, }; //////////////////////////////////////////////////////////// @@ -10604,6 +10611,89 @@ static int geometry_decimalint(const ObObjType expected_type, ObObjCastParams &p return ret; } +static int rb_copy_string(ObObjCastParams ¶ms, + const ObObjType expect_type, + const ObString &src, + ObObj &obj) +{ + int ret = OB_SUCCESS; + char *buf = NULL; + int64_t len = src.length(); + if (is_lob_storage(expect_type)) { + sql::ObTextStringObObjResult str_result(expect_type, ¶ms, &obj, true /*has_lob_header*/); + if (OB_FAIL(str_result.init(len))) { + LOG_WARN("failed to init ObTextStringObObjResult", K(ret)); + } else if (OB_FAIL(str_result.append(src.ptr(), len))) { + LOG_WARN("failed to append string to ObTextStringObObjResult", K(ret), K(src)); + } else { + str_result.set_result(); + } + } else { + if (OB_UNLIKELY(NULL == (buf = static_cast(params.alloc(len))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to alloc buffer for string", K(ret)); + } else { + MEMMOVE(buf, src.ptr(), len); + if (ob_is_raw(expect_type)) { + obj.set_raw(buf, static_cast(len)); + } else { + obj.set_string(expect_type, buf, static_cast(len)); + } + } + } + return ret; +} + +static int roaringbitmap_string(const ObObjType expect_type, ObObjCastParams ¶ms, + const ObObj &in, ObObj &out, const ObCastMode cast_mode) +{ + int ret = OB_SUCCESS; + ObLength res_length = -1; + ObString in_str = in.get_string(); + if (OB_FAIL(sql::ObTextStringHelper::read_real_string_data(params.allocator_v2_, in, in_str))) { + LOG_WARN("fail to get real data.", K(ret), K(in_str)); + } else if (OB_FAIL(rb_copy_string(params, expect_type, in_str, out))){ + LOG_WARN("fail to copy string", K(ret), K(expect_type)); + } else { + res_length = static_cast(out.get_string_len()); + } + SET_RES_ACCURACY_STRING(expect_type, DEFAULT_PRECISION_FOR_STRING, res_length); + return ret; +} + +static int string_roaringbitmap(const ObObjType expect_type, ObObjCastParams ¶ms, + const ObObj &in, ObObj &out, const ObCastMode cast_mode) +{ + int ret = OB_SUCCESS; + ObCollationType in_cs_type = in.get_collation_type(); + if (in_cs_type != CS_TYPE_BINARY) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("invalid in_cs_type of string to cast to roaringbitmap", K(ret), K(in_cs_type)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "cast string collation type not in binary to roaringbitmap"); + } else if (OB_ISNULL(params.allocator_v2_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("invalid allocator", K(ret)); + } else { + ObIAllocator &temp_allocator = *params.allocator_v2_; + ObString in_str; + ObRbBinType bin_type; + if (OB_FAIL(in.get_string(in_str))) { + LOG_WARN("fail to get string", K(ret)); + } else if (OB_FAIL(ObRbUtils::check_get_bin_type(in_str, bin_type))){ + LOG_WARN("invalid roaringbitmap binary string", K(ret)); + } else { + sql::ObTextStringObObjResult text_result(ObRoaringBitmapType, ¶ms, &out, true /*has_lob_header*/); + if (OB_FAIL(text_result.init(in_str.length(), params.allocator_v2_))) { + LOG_WARN("init lob result failed"); + } else if (OB_FAIL(text_result.append(in_str.ptr(), in_str.length()))) { + LOG_WARN("failed to append realdata", K(ret), K(in_str), K(text_result)); + } else { + text_result.set_result(); + } + } + } + return ret; +} ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = { { @@ -10637,6 +10727,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_identity,/*roaringbitmap*/ }, { /*int -> XXX*/ @@ -10669,6 +10760,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*uint -> XXX*/ @@ -10701,6 +10793,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*float -> XXX*/ @@ -10733,6 +10826,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*double -> XXX*/ @@ -10765,6 +10859,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*number -> XXX*/ @@ -10797,6 +10892,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*datetime -> XXX*/ @@ -10829,6 +10925,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*date -> XXX*/ @@ -10861,6 +10958,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*time -> XXX*/ @@ -10893,6 +10991,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*year -> XXX*/ @@ -10925,6 +11024,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*string -> XXX*/ @@ -10957,6 +11057,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + string_roaringbitmap,/*roaringbitmap*/ }, { /*extend -> XXX*/ @@ -10989,6 +11090,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*unknown -> XXX*/ @@ -11021,6 +11123,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*text -> XXX*/ @@ -11053,6 +11156,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + string_roaringbitmap,/*roaringbitmap*/ }, { /*bit -> XXX*/ @@ -11085,6 +11189,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*enum -> XXX*/ @@ -11117,6 +11222,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*enumset_inner -> XXX*/ @@ -11149,6 +11255,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*otimestamp -> XXX*/ @@ -11181,6 +11288,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*raw -> XXX*/ @@ -11213,6 +11321,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*interval -> XXX*/ @@ -11245,6 +11354,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*rowid -> XXX*/ @@ -11277,6 +11387,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*lob -> XXX*/ @@ -11309,6 +11420,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*json -> XXX*/ @@ -11341,6 +11453,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*geometry -> XXX*/ @@ -11373,6 +11486,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*udt -> XXX*/ @@ -11405,6 +11519,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*decimalint-> XXX*/ @@ -11437,6 +11552,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*collection-> xxx*/ @@ -11469,6 +11585,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql date-> xxx*/ @@ -11501,6 +11618,7 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql datetime-> xxx*/ @@ -11533,7 +11651,41 @@ ObObjCastFunc OB_OBJ_CAST[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, + { + /*roaringbitmap-> xxx*/ + cast_not_support,/*null*/ + cast_not_support,/*int*/ + cast_not_support,/*uint*/ + cast_not_support,/*float*/ + cast_not_support,/*double*/ + cast_not_support,/*number*/ + cast_not_support,/*datetime*/ + cast_not_support,/*date*/ + cast_not_support,/*time*/ + cast_not_support,/*year*/ + roaringbitmap_string,/*string*/ + cast_not_support,/*extend*/ + cast_not_support,/*unknown*/ + roaringbitmap_string,/*text*/ + cast_not_support,/*bit*/ + cast_not_expected,/*enumset*/ + cast_not_expected,/*enumset_inner*/ + cast_not_support,/*otimestamp*/ + cast_not_support,/*raw*/ + cast_not_expected,/*interval*/ + cast_not_expected,/*rowid*/ + cast_not_expected,/*lob*/ + cast_not_support,/*json*/ + cast_not_support,/*geometry*/ + cast_not_expected, /*udt*/ + cast_not_support,/*decimalint*/ + cast_not_expected,/*collection*/ + cast_not_expected,/*mysql date*/ + cast_not_expected,/*mysql datetime*/ + cast_identity,/*roaringbitmap*/ + } }; ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = @@ -11569,6 +11721,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*int -> XXX*/ @@ -11601,6 +11754,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*uint -> XXX*/ @@ -11633,6 +11787,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*float -> XXX*/ @@ -11665,6 +11820,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*double -> XXX*/ @@ -11697,6 +11853,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*number -> XXX*/ @@ -11729,6 +11886,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*datetime -> XXX*/ @@ -11761,6 +11919,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*date -> XXX*/ @@ -11793,6 +11952,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*time -> XXX*/ @@ -11825,6 +11985,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*year -> XXX*/ @@ -11857,6 +12018,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*string -> XXX*/ @@ -11889,6 +12051,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*extend -> XXX*/ @@ -11921,6 +12084,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = pl_extend_sql_udt,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*unknown -> XXX*/ @@ -11953,6 +12117,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*text -> XXX*/ @@ -11985,6 +12150,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*bit -> XXX*/ @@ -12017,6 +12183,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enum -> XXX*/ @@ -12049,6 +12216,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enumset_inner -> XXX*/ @@ -12081,6 +12249,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*otimestamp -> XXX*/ @@ -12113,6 +12282,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*raw -> XXX*/ @@ -12145,6 +12315,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*interval -> XXX*/ @@ -12177,6 +12348,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*rowid -> XXX*/ @@ -12209,6 +12381,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*lob -> XXX*/ @@ -12241,6 +12414,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*json -> XXX, not support oracle currently*/ @@ -12273,6 +12447,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*geometry -> XXX, not support oracle currently*/ @@ -12305,6 +12480,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*udt -> XXX, not support oracle currently*/ @@ -12337,6 +12513,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_udt_to_other_not_support,/*roaringbitmap*/ }, { /*decimalint -> XXX*/ @@ -12369,6 +12546,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support, /*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*collection -> XXX*/ @@ -12401,6 +12579,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_udt_to_other_not_support,/*roaringbitmap*/ }, { /*mysql date*/ @@ -12433,6 +12612,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql datetime*/ @@ -12465,6 +12645,40 @@ ObObjCastFunc OBJ_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ + }, + { + /*roaringbitmap -> XXX*/ + cast_not_expected,/*null*/ + cast_not_expected,/*int*/ + cast_not_expected,/*uint*/ + cast_not_expected,/*float*/ + cast_not_expected,/*double*/ + cast_not_expected,/*number*/ + cast_not_expected,/*datetime*/ + cast_not_expected,/*date*/ + cast_not_expected,/*time*/ + cast_not_expected,/*year*/ + cast_not_expected,/*string*/ + cast_not_expected,/*extend*/ + cast_not_expected,/*unknown*/ + cast_not_expected,/*text*/ + cast_not_expected,/*bit*/ + cast_not_expected,/*enumset*/ + cast_not_expected,/*enumset_inner*/ + cast_not_expected,/*otimestamp*/ + cast_not_expected,/*raw*/ + cast_not_expected,/*interval*/ + cast_not_expected,/*rowid*/ + cast_not_expected,/*lob*/ + cast_not_expected,/*json*/ + cast_not_expected,/*geometry*/ + cast_not_expected,/*udt*/ + cast_not_expected,/*decimalint*/ + cast_not_expected,/*collection*/ + cast_not_expected,/*mysql date*/ + cast_not_expected,/*mysql datetime*/ + cast_identity,/*roaringbitmap*/ }, }; @@ -12510,6 +12724,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_identity,/*roaringbitmap*/ }, { /*int -> XXX*/ @@ -12542,6 +12757,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*uint -> XXX*/ @@ -12574,6 +12790,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*float -> XXX*/ @@ -12606,6 +12823,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*double -> XXX*/ @@ -12638,6 +12856,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*number -> XXX*/ @@ -12670,6 +12889,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*datetime -> XXX*/ @@ -12702,6 +12922,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*date -> XXX*/ @@ -12734,6 +12955,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*time -> XXX*/ @@ -12766,6 +12988,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*year -> XXX*/ @@ -12798,6 +13021,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*string -> XXX*/ @@ -12830,6 +13054,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*extend -> XXX*/ @@ -12862,6 +13087,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = pl_extend_sql_udt,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*unknown -> XXX*/ @@ -12894,6 +13120,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*text -> XXX*/ @@ -12926,6 +13153,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*bit -> XXX*/ @@ -12958,6 +13186,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enum -> XXX*/ @@ -12987,9 +13216,10 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*geometry*/ cast_to_udt_not_support,/*udt*/ cast_not_expected,/*decimalint*/ - cast_to_udt_not_support,/*collection*/ + cast_not_expected,/*roaringbitmap*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*collection*/ }, { /*enumset_inner -> XXX*/ @@ -13022,6 +13252,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*otimestamp -> XXX*/ @@ -13054,6 +13285,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*raw -> XXX*/ @@ -13086,6 +13318,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*interval -> XXX*/ @@ -13118,6 +13351,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /* rowid -> XXX */ @@ -13150,6 +13384,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*lob -> XXX*/ @@ -13182,6 +13417,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*json -> XXX*/ @@ -13214,6 +13450,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*geoemtry -> XXX, not support oracle currently*/ @@ -13246,6 +13483,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*udt -> XXX*/ @@ -13278,6 +13516,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_udt_to_other_not_support,/*roaringbitmap*/ }, { /*decimalint -> XXX*/ @@ -13310,6 +13549,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_inconsistent_types,/*roaringbitmap*/ }, { /*collection -> XXX*/ @@ -13342,6 +13582,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_udt_to_other_not_support,/*roaringbitmap*/ }, { /*mysql date*/ @@ -13374,6 +13615,7 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql datetime*/ @@ -13406,6 +13648,40 @@ ObObjCastFunc OBJ_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ + }, + { + /*roaringbitmap -> XXX*/ + cast_not_expected,/*null*/ + cast_not_expected,/*int*/ + cast_not_expected,/*uint*/ + cast_not_expected,/*float*/ + cast_not_expected,/*double*/ + cast_not_expected,/*number*/ + cast_not_expected,/*datetime*/ + cast_not_expected,/*date*/ + cast_not_expected,/*time*/ + cast_not_expected,/*year*/ + cast_not_expected,/*string*/ + cast_not_expected,/*extend*/ + cast_not_expected,/*unknown*/ + cast_not_expected,/*text*/ + cast_not_expected,/*bit*/ + cast_not_expected,/*enumset*/ + cast_not_expected,/*enumset_inner*/ + cast_not_expected,/*otimestamp*/ + cast_not_expected,/*raw*/ + cast_not_expected,/*interval*/ + cast_not_expected,/*rowid*/ + cast_not_expected,/*lob*/ + cast_not_expected,/*json*/ + cast_not_expected,/*geometry*/ + cast_not_expected,/*udt*/ + cast_not_expected,/*decimalint*/ + cast_not_expected,/*collection*/ + cast_not_expected,/*mysql date*/ + cast_not_expected,/*mysql datetime*/ + cast_identity,/*roaringbitmap*/ }, }; diff --git a/src/share/schema/ob_column_schema.cpp b/src/share/schema/ob_column_schema.cpp index 172b7f29e..9a48c07cc 100644 --- a/src/share/schema/ob_column_schema.cpp +++ b/src/share/schema/ob_column_schema.cpp @@ -546,7 +546,7 @@ int ObColumnSchemaV2::get_byte_length( ret = OB_ERR_UNEXPECTED; LOG_WARN("collation type is invalid", K(ret)); } else if (ob_is_text_tc(meta_type_.get_type()) || ob_is_json(meta_type_.get_type()) - || ob_is_geometry(meta_type_.get_type())) { + || ob_is_geometry(meta_type_.get_type()) || ob_is_roaringbitmap(meta_type_.get_type())) { if (for_check_length) { // when check row length, a lob will occupy at most 2KB length = min(get_data_length(), OB_MAX_LOB_HANDLE_LENGTH); diff --git a/src/share/schema/ob_column_schema.h b/src/share/schema/ob_column_schema.h index cfde5424f..2f78f4079 100644 --- a/src/share/schema/ob_column_schema.h +++ b/src/share/schema/ob_column_schema.h @@ -193,6 +193,7 @@ int assign(const ObColumnSchemaV2 &src_schema); inline bool is_string_type() const { return meta_type_.is_string_type(); } inline bool is_json() const { return meta_type_.is_json(); } inline bool is_geometry() const { return meta_type_.is_geometry(); } + inline bool is_roaringbitmap() const { return meta_type_.is_roaringbitmap(); } inline bool is_raw() const { return meta_type_.is_raw(); } inline bool is_decimal_int() const { return meta_type_.is_decimal_int(); } diff --git a/src/share/schema/ob_schema_printer.cpp b/src/share/schema/ob_schema_printer.cpp index 6154c6ba1..9682b3c7a 100644 --- a/src/share/schema/ob_schema_printer.cpp +++ b/src/share/schema/ob_schema_printer.cpp @@ -361,6 +361,10 @@ int ObSchemaPrinter::print_table_definition_columns(const ObTableSchema &table_s if (OB_SUCC(ret) && OB_FAIL(databuff_printf(buf, buf_len, pos, "'%s'", to_cstring(ObHexEscapeSqlStr(out_str))))) { SHARE_SCHEMA_LOG(WARN, "fail to print default value of string tc", K(ret)); } + } else if (ob_is_roaringbitmap_tc(default_value.get_type())) { + if (OB_FAIL(print_roaringbitmap_default_value(table_schema, default_value, buf, buf_len, pos))) { + SHARE_SCHEMA_LOG(WARN, "fail to print default value of roaringbitmap", K(ret)); + } } else if (OB_FAIL(default_value.print_varchar_literal(buf, buf_len, pos, tz_info))) { SHARE_SCHEMA_LOG(WARN, "fail to print sql literal", K(ret)); } @@ -5723,6 +5727,27 @@ int ObSchemaPrinter::print_table_definition_lob_params(const ObTableSchema &tabl return ret; } + int ObSchemaPrinter::print_roaringbitmap_default_value(const ObTableSchema &table_schema, + ObObj &default_value, + char* buf, + const int64_t& buf_len, + int64_t& pos) const +{ + int ret = OB_SUCCESS; + ObString out_str = default_value.get_string(); + const char *HEXCHARS = "0123456789ABCDEF"; + for (int i = 0; OB_SUCC(ret) && i < out_str.length(); ++i) { + if (i == 0 && OB_FAIL(databuff_printf(buf, buf_len, pos, " 0x"))) { + SHARE_SCHEMA_LOG(WARN, "fail to print default value", K(ret)); + } else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "%c%c", + HEXCHARS[*(out_str.ptr() + i) >> 4 & 0xF], + HEXCHARS[*(out_str.ptr() + i) & 0xF]))) { + SHARE_SCHEMA_LOG(WARN, "fail to print default value hex", K(ret)); + } + } + return ret; +} + } // end namespace schema } //end of namespace share } // end namespace oceanbase diff --git a/src/share/schema/ob_schema_printer.h b/src/share/schema/ob_schema_printer.h index 17a976187..65cde1485 100644 --- a/src/share/schema/ob_schema_printer.h +++ b/src/share/schema/ob_schema_printer.h @@ -501,6 +501,11 @@ public: const int64_t& buf_len, int64_t& pos) const; + int print_roaringbitmap_default_value(const ObTableSchema &table_schema, + ObObj &default_value, + char* buf, + const int64_t& buf_len, + int64_t& pos) const; private: static bool is_subpartition_valid_in_mysql(const ObTableSchema &table_schema) { diff --git a/src/share/schema/ob_table_schema.cpp b/src/share/schema/ob_table_schema.cpp index ff94c030b..734dfbc44 100644 --- a/src/share/schema/ob_table_schema.cpp +++ b/src/share/schema/ob_table_schema.cpp @@ -1926,7 +1926,7 @@ bool ObTableSchema::is_valid() const } } } else if (ob_is_text_tc(column->get_data_type()) || ob_is_json_tc(column->get_data_type()) - || ob_is_geometry_tc(column->get_data_type())) { + || ob_is_geometry_tc(column->get_data_type()) || ob_is_roaringbitmap_tc(column->get_data_type())) { ObLength max_length = 0; max_length = ObAccuracy::MAX_ACCURACY[column->get_data_type()].get_length(); if (max_length < column->get_data_length()) { @@ -5390,7 +5390,7 @@ int ObTableSchema::check_row_length( // The full text column in the index only counts the length of one word segment row_length += OB_MAX_OBJECT_NAME_LENGTH; } else if (ob_is_string_type(col->get_data_type()) || ob_is_json(col->get_data_type()) - || ob_is_geometry(col->get_data_type())) { + || ob_is_geometry(col->get_data_type()) || ob_is_roaringbitmap(col->get_data_type())) { int64_t length = 0; if (OB_FAIL(col->get_byte_length(length, is_oracle_mode, true))) { SQL_RESV_LOG(WARN, "fail to get byte length of column", K(ret)); @@ -5550,7 +5550,8 @@ int ObTableSchema::has_lob_column(bool &has_lob, const bool check_large /*= fals ret = OB_ERR_UNEXPECTED; LOG_WARN("Column schema is NULL", K(ret)); } else if (ob_is_json_tc(column_schema->get_data_type()) - || ob_is_geometry_tc(column_schema->get_data_type())) { + || ob_is_geometry_tc(column_schema->get_data_type()) + || ob_is_roaringbitmap_tc(column_schema->get_data_type())) { has_lob = true; // cannot know whether a json is lob or not from schema } else if (check_large) { if (ob_is_large_text(column_schema->get_data_type())) { diff --git a/src/share/schema/ob_table_sql_service.cpp b/src/share/schema/ob_table_sql_service.cpp index 63fe3bde6..71985cc42 100644 --- a/src/share/schema/ob_table_sql_service.cpp +++ b/src/share/schema/ob_table_sql_service.cpp @@ -1736,7 +1736,7 @@ int ObTableSqlService::supplement_for_core_table(ObISQLClient &sql_client, MEMSET(orig_default_value_buf, 0, value_buf_len); lib::Worker::CompatMode compat_mode = lib::Worker::CompatMode::INVALID; if (!ob_is_string_type(column.get_data_type()) && !ob_is_json(column.get_data_type()) - && !ob_is_geometry(column.get_data_type())) { + && !ob_is_geometry(column.get_data_type()) && !ob_is_roaringbitmap(column.get_data_type())) { if (OB_FAIL(ObCompatModeGetter::get_table_compat_mode( column.get_tenant_id(), column.get_table_id(), compat_mode))) { LOG_WARN("fail to get tenant mode", K(ret), K(column)); @@ -1754,7 +1754,7 @@ int ObTableSqlService::supplement_for_core_table(ObISQLClient &sql_client, ObString orig_default_value; if (OB_SUCC(ret)) { if (ob_is_string_type(column.get_data_type()) || ob_is_json(column.get_data_type()) - || ob_is_geometry(column.get_data_type())) { + || ob_is_geometry(column.get_data_type()) || ob_is_roaringbitmap(column.get_data_type())) { ObString orig_default_value_str = column.get_orig_default_value().get_string(); orig_default_value.assign_ptr(orig_default_value_str.ptr(), orig_default_value_str.length()); } else { @@ -4246,6 +4246,11 @@ int ObTableSqlService::gen_column_dml( LOG_WARN("tenant data version is less than 4.2, skip index feature is not supported", K(ret), K(tenant_data_version), K(column)); LOG_USER_ERROR(OB_NOT_SUPPORTED, "tenant data version is less than 4.2, skip index"); + } else if (tenant_data_version < DATA_VERSION_4_3_2_0 && + (ob_is_roaringbitmap(column.get_data_type()))) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("tenant data version is less than 4.3.2, roaringbitmap type is not supported", K(ret), K(tenant_data_version), K(column)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "tenant data version is less than 4.3.2, roaringbitmap type"); } else if (OB_FAIL(sql::ObSQLUtils::is_charset_data_version_valid(column.get_charset_type(), exec_tenant_id))) { LOG_WARN("failed to check charset data version valid", K(column.get_charset_type()), K(ret)); @@ -4256,7 +4261,8 @@ int ObTableSqlService::gen_column_dml( column.is_identity_column() || ob_is_string_type(column.get_data_type()) || ob_is_json(column.get_data_type()) || - ob_is_geometry(column.get_data_type())) { + ob_is_geometry(column.get_data_type()) || + ob_is_roaringbitmap(column.get_data_type())) { //The default value of the generated column is the expression definition of the generated column ObString orig_default_value_str = column.get_orig_default_value().get_string(); ObString cur_default_value_str = column.get_cur_default_value().get_string(); diff --git a/src/share/vector/ob_continuous_vector.cpp b/src/share/vector/ob_continuous_vector.cpp index b90abf2aa..b15d3c893 100644 --- a/src/share/vector/ob_continuous_vector.cpp +++ b/src/share/vector/ob_continuous_vector.cpp @@ -74,6 +74,7 @@ template class ObContinuousVector>; template class ObContinuousVector>; template class ObContinuousVector>; template class ObContinuousVector>; +template class ObContinuousVector>; } // end namespace common } // end namespace oceanbase diff --git a/src/share/vector/ob_discrete_vector.cpp b/src/share/vector/ob_discrete_vector.cpp index 27511f6e2..2aeb79e3f 100644 --- a/src/share/vector/ob_discrete_vector.cpp +++ b/src/share/vector/ob_discrete_vector.cpp @@ -75,5 +75,6 @@ template class ObDiscreteVector>; template class ObDiscreteVector>; template class ObDiscreteVector>; template class ObDiscreteVector>; +template class ObDiscreteVector>; } // end namespace common } // end namespace oceanbase diff --git a/src/share/vector/ob_uniform_vector.cpp b/src/share/vector/ob_uniform_vector.cpp index 8f9e3f3d6..e26a009f5 100644 --- a/src/share/vector/ob_uniform_vector.cpp +++ b/src/share/vector/ob_uniform_vector.cpp @@ -100,6 +100,7 @@ template class ObUniformVector>; template class ObUniformVector>; template class ObUniformVector>; template class ObUniformVector>; +template class ObUniformVector>; template class ObUniformVector>; template class ObUniformVector>; @@ -133,5 +134,6 @@ template class ObUniformVector>; template class ObUniformVector>; template class ObUniformVector>; template class ObUniformVector>; +template class ObUniformVector>; } // end namespace common } // end namespace oceanbase diff --git a/src/share/vector/ob_vector_define.h b/src/share/vector/ob_vector_define.h index 4d2083696..b7e586d94 100644 --- a/src/share/vector/ob_vector_define.h +++ b/src/share/vector/ob_vector_define.h @@ -90,6 +90,7 @@ DEFINE_CONTINUOUS_VECTOR(LobContVec, VEC_TC_LOB); DEFINE_CONTINUOUS_VECTOR(JsonContVec, VEC_TC_JSON); DEFINE_CONTINUOUS_VECTOR(GeoContVec, VEC_TC_GEO); DEFINE_CONTINUOUS_VECTOR(UdtContVec, VEC_TC_UDT); +DEFINE_CONTINUOUS_VECTOR(RoaringBitmapContVec, VEC_TC_ROARINGBITMAP); #undef DEFINE_CONTINUOUS_VECTOR constexpr bool is_continuous_vec(const VecValueTypeClass tc) @@ -103,7 +104,8 @@ constexpr bool is_continuous_vec(const VecValueTypeClass tc) || tc == VEC_TC_LOB || tc == VEC_TC_JSON || tc == VEC_TC_GEO - || tc == VEC_TC_UDT); + || tc == VEC_TC_UDT + || tc == VEC_TC_ROARINGBITMAP); } #define DEFINE_DISCRETE_VECTOR(vector_name, vec_tc) \ @@ -118,6 +120,7 @@ DEFINE_DISCRETE_VECTOR(LobDiscVec, VEC_TC_LOB); DEFINE_DISCRETE_VECTOR(JsonDiscVec, VEC_TC_JSON); DEFINE_DISCRETE_VECTOR(GeoDiscVec, VEC_TC_GEO); DEFINE_DISCRETE_VECTOR(UdtDiscVec, VEC_TC_UDT); +DEFINE_DISCRETE_VECTOR(RoaringBitmapDiscVec, VEC_TC_ROARINGBITMAP); #undef DEFINE_DISCRETE_VECTOR constexpr bool is_discrete_vec(const VecValueTypeClass vec_tc) @@ -131,7 +134,8 @@ constexpr bool is_discrete_vec(const VecValueTypeClass vec_tc) || vec_tc == VEC_TC_LOB || vec_tc == VEC_TC_JSON || vec_tc == VEC_TC_GEO - || vec_tc == VEC_TC_UDT); + || vec_tc == VEC_TC_UDT + || vec_tc == VEC_TC_ROARINGBITMAP); } #define DEFINE_UNIFORM_VECTOR(vector_name, vec_tc) \ @@ -168,6 +172,7 @@ DEFINE_UNIFORM_VECTOR(LobUniVec, VEC_TC_LOB); DEFINE_UNIFORM_VECTOR(JsonUniVec, VEC_TC_JSON); DEFINE_UNIFORM_VECTOR(GeoUniVec, VEC_TC_GEO); DEFINE_UNIFORM_VECTOR(UdtUniVec, VEC_TC_UDT); +DEFINE_UNIFORM_VECTOR(RoaringBitmapUniVec, VEC_TC_ROARINGBITMAP); #undef DEFINE_UNIFORM_VECTOR constexpr bool is_uniform_vec(const VecValueTypeClass tc) @@ -209,6 +214,7 @@ DEFINE_UNIFORM_CONST_VECTOR(LobUniCVec, VEC_TC_LOB); DEFINE_UNIFORM_CONST_VECTOR(JsonUniCVec, VEC_TC_JSON); DEFINE_UNIFORM_CONST_VECTOR(GeoUniCVec, VEC_TC_GEO); DEFINE_UNIFORM_CONST_VECTOR(UdtUniCVec, VEC_TC_UDT); +DEFINE_UNIFORM_CONST_VECTOR(RoaringBitmapUniCVec, VEC_TC_ROARINGBITMAP); #undef DEFINE_UNIFORM_CONST_VECTOR } diff --git a/src/share/vector/type_traits.h b/src/share/vector/type_traits.h index c3d437ad4..53ad92533 100644 --- a/src/share/vector/type_traits.h +++ b/src/share/vector/type_traits.h @@ -110,6 +110,7 @@ DEFINE_VECTOR_TC_TRAITS(VEC_TC_DEC_INT128, true, int128_t); DEFINE_VECTOR_TC_TRAITS(VEC_TC_DEC_INT256, true, int256_t); DEFINE_VECTOR_TC_TRAITS(VEC_TC_DEC_INT512, true, int512_t); DEFINE_VECTOR_TC_TRAITS(VEC_TC_COLLECTION, false, ObString); +DEFINE_VECTOR_TC_TRAITS(VEC_TC_ROARINGBITMAP, false, ObString); #undef DEFINE_VECTOR_TC_TRAITS diff --git a/src/share/vector/vector_basic_op.h b/src/share/vector/vector_basic_op.h index 69d56362e..569d629c7 100644 --- a/src/share/vector/vector_basic_op.h +++ b/src/share/vector/vector_basic_op.h @@ -328,6 +328,7 @@ struct VecTCHashCalc } }; + template struct VecTCHashCalcWithHashType { @@ -791,6 +792,7 @@ struct VecTCCmpCalc } }; + // null type comparison struct VecDummyCmpCalc diff --git a/src/sql/CMakeLists.txt b/src/sql/CMakeLists.txt index a799e874f..2ddff4034 100644 --- a/src/sql/CMakeLists.txt +++ b/src/sql/CMakeLists.txt @@ -739,6 +739,16 @@ ob_set_subtarget(ob_sql engine_expr engine/expr/ob_expr_last_refresh_scn.cpp engine/expr/ob_expr_json_utils.cpp engine/expr/ob_expr_inner_table_option_printer.cpp + engine/expr/ob_expr_rb_build_empty.cpp + engine/expr/ob_expr_rb_is_empty.cpp + engine/expr/ob_expr_rb_func_helper.cpp + engine/expr/ob_expr_rb_build_varbinary.cpp + engine/expr/ob_expr_rb_to_varbinary.cpp + engine/expr/ob_expr_rb_cardinality.cpp + engine/expr/ob_expr_rb_calc_cardinality.cpp + engine/expr/ob_expr_rb_calc.cpp + engine/expr/ob_expr_rb_to_string.cpp + engine/expr/ob_expr_rb_from_string.cpp ) ob_set_subtarget(ob_sql engine_join diff --git a/src/sql/code_generator/ob_static_engine_cg.cpp b/src/sql/code_generator/ob_static_engine_cg.cpp index 55fa40fe5..694004657 100644 --- a/src/sql/code_generator/ob_static_engine_cg.cpp +++ b/src/sql/code_generator/ob_static_engine_cg.cpp @@ -2060,6 +2060,9 @@ int ObStaticEngineCG::fill_sort_funcs( } else if (is_oracle_mode() && OB_UNLIKELY(ObJsonType == expr->datum_meta_.type_)) { ret = OB_ERR_INVALID_CMP_OP; LOG_WARN("order by json not allowed", K(ret)); + } else if (OB_UNLIKELY(ObRoaringBitmapType == expr->datum_meta_.type_)) { + ret = OB_ERR_INVALID_TYPE_FOR_OP; + LOG_WARN("order by roaringbitmap not allowed", K(ret)); } else { ObSortCmpFunc cmp_func; cmp_func.cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(expr->datum_meta_.type_, @@ -4591,7 +4594,10 @@ int ObStaticEngineCG::generate_spec(ObLogGroupBy &op, ObMergeGroupBySpec &spec, ARRAY_FOREACH(group_exprs, i) { const ObRawExpr *raw_expr = group_exprs.at(i); ObExpr *expr = NULL; - if (OB_FAIL(generate_rt_expr(*raw_expr, expr))) { + if (ObRoaringBitmapType == raw_expr->get_data_type()) { + ret = OB_ERR_INVALID_TYPE_FOR_OP; + LOG_WARN("group by roaringbitmap not allowed", K(ret)); + } else if (OB_FAIL(generate_rt_expr(*raw_expr, expr))) { LOG_WARN("failed to generate_rt_expr", K(ret)); } else if (OB_FAIL(spec.add_group_expr(expr))) { OB_LOG(WARN, "fail to add_group_expr", K(ret)); @@ -4856,7 +4862,10 @@ int ObStaticEngineCG::generate_spec(ObLogGroupBy &op, ObHashGroupBySpec &spec, ARRAY_FOREACH(group_exprs, i) { const ObRawExpr *raw_expr = group_exprs.at(i); ObExpr *expr = NULL; - if (OB_FAIL(generate_rt_expr(*raw_expr, expr))) { + if (ObRoaringBitmapType == raw_expr->get_data_type()) { + ret = OB_ERR_INVALID_TYPE_FOR_OP; + LOG_WARN("group by roaringbitmap not allowed", K(ret)); + } else if (OB_FAIL(generate_rt_expr(*raw_expr, expr))) { LOG_WARN("failed to generate_rt_expr", K(ret)); } else if (OB_FAIL(spec.add_group_expr(expr))) { OB_LOG(WARN, "fail to add_group_expr", K(ret)); diff --git a/src/sql/engine/aggregate/ob_aggregate_processor.cpp b/src/sql/engine/aggregate/ob_aggregate_processor.cpp index 6643c417a..dcbb930a2 100644 --- a/src/sql/engine/aggregate/ob_aggregate_processor.cpp +++ b/src/sql/engine/aggregate/ob_aggregate_processor.cpp @@ -37,6 +37,7 @@ #include "lib/xml/ob_xml_parser.h" #include "lib/xml/ob_binary_aggregate.h" #include "sql/engine/expr/ob_expr_xml_func_helper.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" #include "lib/alloc/malloc_hook.h" #include "pl/ob_pl_user_type.h" #include "pl/ob_pl.h" @@ -1982,6 +1983,9 @@ int ObAggregateProcessor::generate_group_row(GroupRow *&new_group_row, case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { void *tmp_buf = NULL; set_need_advance_collect(); @@ -2184,6 +2188,9 @@ int ObAggregateProcessor::fill_group_row(GroupRow *new_group_row, case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { void *tmp_buf = NULL; set_need_advance_collect(); @@ -2619,6 +2626,9 @@ int ObAggregateProcessor::rollup_aggregation(AggrCell &aggr_cell, AggrCell &roll case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { GroupConcatExtraResult *aggr_extra = NULL; GroupConcatExtraResult *rollup_extra = NULL; @@ -2899,6 +2909,9 @@ int ObAggregateProcessor::prepare_aggr_result(const ObChunkDatumStore::StoredRow case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { GroupConcatExtraResult *extra = NULL; if (OB_ISNULL(extra = static_cast(aggr_cell.get_extra()))) { @@ -3213,6 +3226,9 @@ int ObAggregateProcessor::process_aggr_batch_result( case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { GroupConcatExtraResult *extra_info = NULL; if (OB_ISNULL(extra_info = static_cast(aggr_cell.get_extra()))) { @@ -3476,6 +3492,9 @@ int ObAggregateProcessor::process_aggr_result(const ObChunkDatumStore::StoredRow case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { GroupConcatExtraResult *extra = NULL; if (OB_ISNULL(extra = static_cast(aggr_cell.get_extra()))) { @@ -3875,6 +3894,30 @@ int ObAggregateProcessor::collect_aggr_result( } break; } + case T_FUN_SYS_RB_BUILD_AGG: { + GroupConcatExtraResult *extra = static_cast(aggr_cell.get_extra()); + if (OB_FAIL(get_rb_build_agg_result(aggr_info, extra, result))) { + LOG_WARN("failed to get rb_build_agg result", K(ret)); + } else { + } + break; + } + case T_FUN_SYS_RB_OR_AGG: { + GroupConcatExtraResult *extra = static_cast(aggr_cell.get_extra()); + if (OB_FAIL(get_rb_calc_agg_result(aggr_info, extra, result, ObRbOperation::OR))) { + LOG_WARN("failed to get roaringbitmap calculate or result", K(ret)); + } else { + } + break; + } + case T_FUN_SYS_RB_AND_AGG: { + GroupConcatExtraResult *extra = static_cast(aggr_cell.get_extra()); + if (OB_FAIL(get_rb_calc_agg_result(aggr_info, extra, result, ObRbOperation::AND))) { + LOG_WARN("failed to get roaringbitmap calculate and result", K(ret)); + } else { + } + break; + } case T_FUN_GROUP_CONCAT: { GroupConcatExtraResult *extra = NULL; ObString sep_str; @@ -8354,6 +8397,179 @@ int ObAggregateProcessor::init_asmvt_result(ObIAllocator &allocator, return ret; } +int ObAggregateProcessor::get_rb_build_agg_result(const ObAggrInfo &aggr_info, + GroupConcatExtraResult *&extra, + ObDatum &concat_result) +{ + int ret = OB_SUCCESS; + common::ObArenaAllocator tmp_alloc(ObModIds::OB_SQL_AGGR_FUNC, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID()); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(eval_ctx_.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + if (OB_ISNULL(extra) || OB_UNLIKELY(extra->empty())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unpexcted null", K(ret), K(extra)); + } else if (extra->is_iterated() && OB_FAIL(extra->rewind())) { + // Group concat row may be iterated in rollup_process(), rewind here. + LOG_WARN("rewind failed", KPC(extra), K(ret)); + } else if (!extra->is_iterated() && OB_FAIL(extra->finish_add_row())) { + LOG_WARN("finish_add_row failed", KPC(extra), K(ret)); + } else { + const ObChunkDatumStore::StoredRow *storted_row = NULL; + bool inited_tmp_obj = false; + ObObj *tmp_obj = NULL; + ObRoaringBitmap *rb = NULL; + + while (OB_SUCC(ret) && OB_SUCC(extra->get_next_row(storted_row))) { + if (OB_ISNULL(storted_row)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unexpected null", K(ret), K(storted_row)); + } else { + // get obj + if (!inited_tmp_obj + && OB_ISNULL(tmp_obj = static_cast(tmp_alloc.alloc(sizeof(ObObj) * (storted_row->cnt_))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to allocate memory", K(ret), K(tmp_obj)); + } else if (!inited_tmp_obj && FALSE_IT(inited_tmp_obj = true)) { + } else if (OB_FAIL(convert_datum_to_obj(aggr_info, *storted_row, tmp_obj, storted_row->cnt_))) { + LOG_WARN("failed to convert datum to obj", K(ret)); + } else if (tmp_obj->is_null()) { + // do noting for null + } else if (!tmp_obj->is_integer_type()) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid data type for roaringbitmap build agg"); + } else if (OB_ISNULL(rb) && OB_ISNULL(rb = OB_NEWx(ObRoaringBitmap, &tmp_alloc, (&tmp_alloc)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(rb->value_add(tmp_obj->get_uint64()))) { + LOG_WARN("failed to add value to roaringbitmap", K(ret), K(tmp_obj->get_uint64())); + } + } + }//end of while + + if (ret != OB_ITER_END && ret != OB_SUCCESS) { + LOG_WARN("fail to get next row", K(ret)); + } else if (OB_ISNULL(rb)) { + ret = OB_SUCCESS; + concat_result.set_null(); + } else { + ret = OB_SUCCESS; + ObString rb_bin; + if (OB_FAIL(ObRbUtils::rb_serialize(tmp_alloc, rb_bin, rb))) { + LOG_WARN("failed to serialize roaringbitmap", K(ret)); + } else { + ObString blob_locator; + ObExprStrResAlloc expr_res_alloc(*aggr_info.expr_, eval_ctx_); + ObTextStringResult blob_res(ObLongTextType, true, &expr_res_alloc); + int64_t total_length = rb_bin.length(); + if (OB_FAIL(ret)) { + } else if (OB_FAIL(blob_res.init(total_length))) { + LOG_WARN("failed to init blob res", K(ret), K(rb_bin), K(total_length)); + } else if (OB_FAIL(blob_res.append(rb_bin))) { + LOG_WARN("failed to append roaringbitmap binary data", K(ret), K(rb_bin)); + } else { + blob_res.get_result_buffer(blob_locator); + concat_result.set_string(blob_locator); + } + } + } + ObRbUtils::rb_destroy(rb); + } + return ret; +} + +int ObAggregateProcessor::get_rb_calc_agg_result(const ObAggrInfo &aggr_info, + GroupConcatExtraResult *&extra, + ObDatum &concat_result, + ObRbOperation calc_op) +{ + int ret = OB_SUCCESS; + common::ObArenaAllocator tmp_alloc(ObModIds::OB_SQL_AGGR_FUNC, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID()); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(eval_ctx_.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + if (OB_ISNULL(extra) || OB_UNLIKELY(extra->empty())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unpexcted null", K(ret), K(extra)); + } else if (extra->is_iterated() && OB_FAIL(extra->rewind())) { + // Group concat row may be iterated in rollup_process(), rewind here. + LOG_WARN("rewind failed", KPC(extra), K(ret)); + } else if (!extra->is_iterated() && OB_FAIL(extra->finish_add_row())) { + LOG_WARN("finish_add_row failed", KPC(extra), K(ret)); + } else { + const ObChunkDatumStore::StoredRow *storted_row = NULL; + bool inited_tmp_obj = false; + ObObj *tmp_obj = NULL; + ObRoaringBitmap *rb = NULL; + + while (OB_SUCC(ret) && OB_SUCC(extra->get_next_row(storted_row))) { + if (OB_ISNULL(storted_row)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unexpected null", K(ret), K(storted_row)); + } else { + ObString tmp_bin; + // get obj + if (!inited_tmp_obj + && OB_ISNULL(tmp_obj = static_cast(tmp_alloc.alloc(sizeof(ObObj) * (storted_row->cnt_))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to allocate memory", K(ret), K(tmp_obj)); + } else if (!inited_tmp_obj && FALSE_IT(inited_tmp_obj = true)) { + } else if (OB_FAIL(convert_datum_to_obj(aggr_info, *storted_row, tmp_obj, storted_row->cnt_))) { + LOG_WARN("failed to convert datum to obj", K(ret)); + } else if (tmp_obj->is_null()) { + // do noting for null + } else if (!(tmp_obj->is_roaringbitmap() + || tmp_obj->is_roaringbitmap() + || tmp_obj->is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid data type for roaringbitmap agg"); + } else if (OB_FALSE_IT(tmp_bin = tmp_obj->get_string())) { + } else if (OB_FAIL(ObTextStringHelper::read_real_string_data(&tmp_alloc, *tmp_obj, tmp_bin))) { + LOG_WARN("failed to get real data.", K(ret), K(tmp_bin)); + } else if (OB_ISNULL(rb)) { + if (OB_FAIL(ObRbUtils::rb_deserialize(tmp_alloc, tmp_bin, rb))) { + LOG_WARN("failed to deserialize roaringbitmap", K(ret)); + } + } else { + ObRoaringBitmap *tmp_rb = NULL; + if (OB_FAIL(ObRbUtils::rb_deserialize(tmp_alloc, tmp_bin, tmp_rb))){ + LOG_WARN("failed to deserialize roaringbitmap", K(ret)); + } else if (OB_FAIL(rb->value_calc(tmp_rb, calc_op))) { + LOG_WARN("failed to calculate roaringbitmap", K(ret)); + } else if (OB_FALSE_IT(ObRbUtils::rb_destroy(tmp_rb))) { + } + } + } + }//end of while + + if (ret != OB_ITER_END && ret != OB_SUCCESS) { + LOG_WARN("fail to get next row", K(ret)); + } else if (OB_ISNULL(rb)) { + ret = OB_SUCCESS; + concat_result.set_null(); + } else { + ret = OB_SUCCESS; + ObString rb_bin; + if (OB_FAIL(ObRbUtils::rb_serialize(tmp_alloc, rb_bin, rb))) { + LOG_WARN("failed to serialize roaringbitmap", K(ret)); + } else { + ObString blob_locator; + ObExprStrResAlloc expr_res_alloc(*aggr_info.expr_, eval_ctx_); + ObTextStringResult blob_res(ObLongTextType, true, &expr_res_alloc); + int64_t total_length = rb_bin.length(); + if (OB_FAIL(ret)) { + } else if (OB_FAIL(blob_res.init(total_length))) { + LOG_WARN("failed to init blob res", K(ret), K(rb_bin), K(total_length)); + } else if (OB_FAIL(blob_res.append(rb_bin))) { + LOG_WARN("failed to append roaringbitmap binary data", K(ret), K(rb_bin)); + } else { + blob_res.get_result_buffer(blob_locator); + concat_result.set_string(blob_locator); + } + } + } + ObRbUtils::rb_destroy(rb); + } + return ret; +} + + int ObAggregateProcessor::check_rows_prefix_str_equal_for_hybrid_hist(const ObChunkDatumStore::LastStoredRow &prev_row, const ObChunkDatumStore::StoredRow &cur_row, const ObAggrInfo &aggr_info, diff --git a/src/sql/engine/aggregate/ob_aggregate_processor.h b/src/sql/engine/aggregate/ob_aggregate_processor.h index ea22713b0..c92d5171c 100644 --- a/src/sql/engine/aggregate/ob_aggregate_processor.h +++ b/src/sql/engine/aggregate/ob_aggregate_processor.h @@ -29,6 +29,7 @@ #include "sql/engine/expr/ob_expr_dll_udf.h" #include "sql/engine/expr/ob_rt_datum_arith.h" #include "lib/geo/ob_geo_mvt.h" +#include "lib/roaringbitmap/ob_rb_utils.h" namespace oceanbase { @@ -997,6 +998,13 @@ private: const ObObj *tmp_obj, uint32_t obj_cnt, mvt_agg_result &mvt_res); + int get_rb_build_agg_result(const ObAggrInfo &aggr_info, + GroupConcatExtraResult *&extra, + ObDatum &concat_result); + int get_rb_calc_agg_result(const ObAggrInfo &aggr_info, + GroupConcatExtraResult *&extra, + ObDatum &concat_result, + ObRbOperation calc_op); int check_key_valid(common::hash::ObHashSet &view_key_names, const ObString& key); int shadow_truncate_string_for_hist(const ObObjMeta obj_meta, @@ -1118,7 +1126,11 @@ public: case T_FUN_JSON_OBJECTAGG: case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: - case T_FUN_SYS_ST_ASMVT: { + case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: + { need_id = true; break; } @@ -1268,6 +1280,9 @@ OB_INLINE bool ObAggregateProcessor::need_extra_info(const ObExprOperatorType ex case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { need_extra = true; break; diff --git a/src/sql/engine/dml/ob_dml_service.cpp b/src/sql/engine/dml/ob_dml_service.cpp index b6fae3a4c..85019b46d 100644 --- a/src/sql/engine/dml/ob_dml_service.cpp +++ b/src/sql/engine/dml/ob_dml_service.cpp @@ -96,6 +96,10 @@ int ObDMLService::check_row_null(const ObExprPtrIArray &row, ret = OB_BAD_NULL_ERROR; LOG_WARN("dml with ignore not supported in geometry type"); LOG_USER_ERROR(OB_BAD_NULL_ERROR, column_infos.at(i).column_name_.length(), column_infos.at(i).column_name_.ptr()); + } else if (ob_is_roaringbitmap(row.at(col_idx)->obj_meta_.get_type())) { + ret = OB_BAD_NULL_ERROR; + LOG_WARN("dml with ignore not supported in roaringbitmap type"); + LOG_USER_ERROR(OB_BAD_NULL_ERROR, column_infos.at(i).column_name_.length(), column_infos.at(i).column_name_.ptr()); } else if (check_cascaded_reference(row.at(col_idx), row)) { //This column is dependent on other columns and cannot be modified again; //otherwise, it will necessitate a cascading recalculation of the dependent expression results. diff --git a/src/sql/engine/expr/ob_datum_cast.cpp b/src/sql/engine/expr/ob_datum_cast.cpp index acce1b89b..411881931 100644 --- a/src/sql/engine/expr/ob_datum_cast.cpp +++ b/src/sql/engine/expr/ob_datum_cast.cpp @@ -26,6 +26,7 @@ #include "lib/json_type/ob_json_bin.h" #include "lib/json_type/ob_json_base.h" #include "lib/json_type/ob_json_parse.h" +#include "lib/roaringbitmap/ob_rb_utils.h" #include "share/ob_lob_access_utils.h" #include "sql/engine/expr/ob_expr_lob_utils.h" #include "sql/engine/expr/ob_expr_json_func_helper.h" @@ -486,7 +487,8 @@ int ObDatumHexUtils::rawtohex(const ObExpr &expr, const ObString &in_str, } break; } - case ObGeometryType: { + case ObGeometryType: + case ObRoaringBitmapType: { ObString lob_data = in_str; if (OB_FAIL(ObTextStringHelper::read_real_string_data(&tmp_alloc, in_type, expr.args_[0]->obj_meta_.has_lob_header(), lob_data, &ctx.exec_ctx_))) { @@ -4150,6 +4152,40 @@ CAST_FUNC_NAME(string, geometry) return ret; } +CAST_FUNC_NAME(string, roaringbitmap) +{ + EVAL_STRING_ARG() + { + ObCollationType in_cs_type = expr.args_[0]->datum_meta_.cs_type_; + if (in_cs_type != CS_TYPE_BINARY) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("invalid in_cs_type of string to cast to roaringbitmap", K(ret), K(in_cs_type)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "cast string collation type not in binary to roaringbitmap"); + } else { + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator(); + ObString in_str = child_res->get_string(); + ObRbBinType bin_type; + if (OB_FAIL(ObTextStringHelper::read_real_string_data(temp_allocator, *child_res, + expr.args_[0]->datum_meta_, expr.args_[0]->obj_meta_.has_lob_header(), in_str))) { + LOG_WARN("failed to get real data.", K(ret), K(in_str)); + } else if (OB_FAIL(ObRbUtils::check_get_bin_type(in_str, bin_type))) { + LOG_WARN("invalid roaringbitmap binary string", K(ret)); + } else { + ObTextStringDatumResult text_result(ObRoaringBitmapType, &expr, &ctx, &res_datum); + if (OB_FAIL(text_result.init(in_str.length()))) { + LOG_WARN("Lob: init lob result failed"); + } else if (OB_FAIL(text_result.append(in_str.ptr(), in_str.length()))) { + LOG_WARN("failed to append realdata", K(ret), K(in_str), K(text_result)); + } else { + text_result.set_result(); + } + } + } + } + return ret; +} + CAST_FUNC_NAME(number, int) { EVAL_ARG() @@ -10728,6 +10764,69 @@ CAST_FUNC_NAME(decimalint, geometry) return ret; } +// ================ +// roaringbitmap -> xxx +static int rb_copy_string(const ObExpr &expr, + ObString &src, + ObEvalCtx &ctx, + ObDatum &res_datum) +{ + int ret = OB_SUCCESS; + char *out_ptr = NULL; + int64_t len = src.length(); + if (expr.obj_meta_.is_lob_storage()) { + ObTextStringDatumResult text_result(ObRoaringBitmapType, &expr, &ctx, &res_datum); + if (OB_FAIL(text_result.init(len))) { + LOG_WARN("Lob: init lob result failed"); + } else if (OB_FAIL(text_result.append(src.ptr(), src.length()))) { + LOG_WARN("failed to append realdata", K(ret), K(src), K(text_result)); + } else { + text_result.set_result(); + } + } else { + if (expr.res_buf_len_ < len) { + if (OB_ISNULL(out_ptr = expr.get_str_res_mem(ctx, len))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("allocate memory failed", K(ret)); + } + } else { + out_ptr = const_cast(res_datum.ptr_); + } + if (OB_SUCC(ret)) { + MEMMOVE(out_ptr, src.ptr(), len); + res_datum.set_string(out_ptr, len); + } + } + return ret; +} + +CAST_FUNC_NAME(roaringbitmap, string) +{ + EVAL_STRING_ARG() + { + ObString rb_bin = child_res->get_string(); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator(); + if (OB_FAIL(ObTextStringHelper::read_real_string_data(temp_allocator, *child_res, + expr.args_[0]->datum_meta_, expr.args_[0]->obj_meta_.has_lob_header(), rb_bin))) { + LOG_WARN("fail to get real data.", K(ret), K(rb_bin)); + } else if (OB_FAIL(rb_copy_string(expr, rb_bin, ctx, res_datum))){ + LOG_WARN("fail to copy string", K(ret)); + } + } + return ret; +} + +CAST_FUNC_NAME(roaringbitmap, roaringbitmap) +{ + EVAL_STRING_ARG() + { + ObString rb_bin = child_res->get_string(); + res_datum.set_string(rb_bin); + } + return ret; +} + // exclude varchar/char type int anytype_anytype_explicit(const sql::ObExpr &expr, sql::ObEvalCtx &ctx, @@ -11788,6 +11887,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*int -> XXX*/ @@ -11820,6 +11920,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*uint -> XXX*/ @@ -11852,6 +11953,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*float -> XXX*/ @@ -11884,6 +11986,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*double -> XXX*/ @@ -11916,6 +12019,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*number -> XXX*/ @@ -11948,6 +12052,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*datetime -> XXX*/ @@ -11980,6 +12085,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*date -> XXX*/ @@ -12012,6 +12118,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*time -> XXX*/ @@ -12044,6 +12151,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*year -> XXX*/ @@ -12076,6 +12184,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*string -> XXX*/ @@ -12108,6 +12217,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*extend -> XXX*/ @@ -12140,6 +12250,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = pl_extend_sql_udt,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*unknown -> XXX*/ @@ -12172,6 +12283,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*text -> XXX*/ @@ -12203,6 +12315,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*bit -> XXX*/ @@ -12235,6 +12348,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enum -> XXX*/ @@ -12267,6 +12381,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enumset_inner -> XXX*/ @@ -12299,6 +12414,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*otimestamp -> XXX*/ @@ -12331,6 +12447,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*raw -> XXX*/ @@ -12363,6 +12480,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*interval -> XXX*/ @@ -12395,6 +12513,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /* rowid -> XXX */ @@ -12427,6 +12546,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*lob -> XXX*/ @@ -12459,6 +12579,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*json -> XXX*/ @@ -12491,6 +12612,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*geometry -> XXX*/ @@ -12523,6 +12645,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*udt -> XXX*/ @@ -12555,6 +12678,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*decimalint -> XXX*/ @@ -12587,6 +12711,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected, /*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*collection -> XXX*/ @@ -12619,6 +12744,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql date*/ @@ -12651,6 +12777,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql datetime*/ @@ -12683,6 +12810,40 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ + }, + { + /*roaringbitmap -> XXX*/ + cast_not_expected,/*null*/ + cast_not_expected,/*int*/ + cast_not_expected,/*uint*/ + cast_not_expected,/*float*/ + cast_not_expected,/*double*/ + cast_not_expected,/*number*/ + cast_not_expected,/*datetime*/ + cast_not_expected,/*date*/ + cast_not_expected,/*time*/ + cast_not_expected,/*year*/ + cast_not_expected,/*string*/ + cast_not_expected,/*extend*/ + cast_not_expected,/*unknown*/ + cast_not_expected,/*text*/ + cast_not_expected,/*bit*/ + cast_not_expected,/*enumset*/ + cast_not_expected,/*enumset_inner*/ + cast_not_expected,/*otimestamp*/ + cast_not_expected,/*raw*/ + cast_not_expected,/*interval*/ + cast_not_expected,/*rowid*/ + cast_not_expected,/*lob*/ + cast_not_expected,/*json*/ + cast_not_expected,/*geometry*/ + cast_not_expected,/*udt*/ + cast_not_expected,/*decimalint*/ + cast_not_expected,/*collection*/ + cast_not_expected,/*mysql date*/ + cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, }; @@ -12721,6 +12882,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_eval_arg,/*roaringbitmap*/ }, { /*int -> XXX*/ @@ -12753,6 +12915,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*uint -> XXX*/ @@ -12785,6 +12948,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*float -> XXX*/ @@ -12817,6 +12981,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*double -> XXX*/ @@ -12849,6 +13014,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*number -> XXX*/ @@ -12881,6 +13047,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*datetime -> XXX*/ @@ -12913,6 +13080,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*date -> XXX*/ @@ -12945,6 +13113,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*time -> XXX*/ @@ -12977,6 +13146,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*year -> XXX*/ @@ -13009,6 +13179,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*string -> XXX*/ @@ -13041,6 +13212,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*extend -> XXX*/ @@ -13073,6 +13245,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = pl_extend_sql_udt,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*unknown -> XXX*/ @@ -13105,6 +13278,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*text -> XXX*/ @@ -13137,6 +13311,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*bit -> XXX*/ @@ -13169,6 +13344,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enum -> XXX*/ @@ -13201,6 +13377,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enumset_inner -> XXX*/ @@ -13233,6 +13410,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*otimestamp -> XXX*/ @@ -13265,6 +13443,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*raw -> XXX*/ @@ -13297,6 +13476,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*interval -> XXX*/ @@ -13329,6 +13509,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*rowid -> XXX*/ @@ -13361,6 +13542,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*lob -> XXX*/ @@ -13393,6 +13575,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*json -> XXX*/ @@ -13425,6 +13608,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*geometry -> XXX*/ @@ -13457,6 +13641,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*udt -> XXX*/ @@ -13489,6 +13674,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*decimalint -> XXX*/ @@ -13521,6 +13707,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_to_udt_not_support, /*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*collection -> XXX*/ @@ -13553,6 +13740,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_udt_to_other_not_support,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql date*/ @@ -13585,6 +13773,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql datetime*/ @@ -13617,6 +13806,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_ORACLE_EXPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, }; @@ -13653,6 +13843,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_eval_arg,/*roaringbitmap*/ }, { /*int -> XXX*/ @@ -13685,6 +13876,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*uint -> XXX*/ @@ -13717,6 +13909,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*float -> XXX*/ @@ -13749,6 +13942,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*double -> XXX*/ @@ -13781,6 +13975,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*number -> XXX*/ @@ -13813,6 +14008,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*datetime -> XXX*/ @@ -13845,6 +14041,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*date -> XXX*/ @@ -13877,6 +14074,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*time -> XXX*/ @@ -13909,6 +14107,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*year -> XXX*/ @@ -13941,6 +14140,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*string -> XXX*/ @@ -13973,6 +14173,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + string_roaringbitmap,/*roaringbitmap*/ }, { /*extend -> XXX*/ @@ -14005,6 +14206,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*unknown -> XXX*/ @@ -14037,6 +14239,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*text -> XXX*/ @@ -14069,6 +14272,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + string_roaringbitmap,/*roaringbitmap*/ }, { /*bit -> XXX*/ @@ -14101,6 +14305,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*enumset -> XXX*/ @@ -14133,6 +14338,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*enumset_inner -> XXX*/ @@ -14165,6 +14371,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*otimestamp -> XXX*/ @@ -14197,6 +14404,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*raw -> XXX*/ @@ -14229,6 +14437,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*interval -> XXX*/ @@ -14261,6 +14470,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*rowid -> XXX*/ @@ -14293,6 +14503,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*lob -> XXX*/ @@ -14325,6 +14536,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*json -> XXX*/ @@ -14357,6 +14569,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*geometry -> XXX*/ @@ -14389,6 +14602,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*udt -> XXX*/ @@ -14421,6 +14635,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*decimalint -> XXX*/ @@ -14453,6 +14668,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_support,/*roaringbitmap*/ }, { /*collection -> XXX*/ @@ -14485,6 +14701,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql date -> XXX*/ @@ -14517,6 +14734,7 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ }, { /*mysql datetime -> XXX*/ @@ -14549,6 +14767,40 @@ ObExpr::EvalFunc OB_DATUM_CAST_MYSQL_IMPLICIT[ObMaxTC][ObMaxTC] = cast_not_expected,/*collection, not implemented in mysql mode*/ cast_not_expected,/*mysql date*/ cast_not_expected,/*mysql datetime*/ + cast_not_expected,/*roaringbitmap*/ + }, + { + /*roaringbitmap -> XXX*/ + cast_not_support,/*null*/ + cast_not_support,/*int*/ + cast_not_support,/*uint*/ + cast_not_support,/*float*/ + cast_not_support,/*double*/ + cast_not_support,/*number*/ + cast_not_support,/*datetime*/ + cast_not_support,/*date*/ + cast_not_support,/*time*/ + cast_not_support,/*year*/ + roaringbitmap_string,/*string*/ + cast_not_support,/*extend*/ + cast_not_support,/*unknown*/ + roaringbitmap_string,/*text*/ + cast_not_support,/*bit*/ + cast_not_expected,/*enumset*/ + cast_not_expected,/*enumset_inner*/ + cast_not_support,/*otimestamp*/ + cast_not_support,/*raw*/ + cast_not_expected,/*interval*/ + cast_not_expected,/*rowid*/ + cast_not_expected,/*lob*/ + cast_not_support,/*json*/ + cast_not_support,/*geometry*/ + cast_not_expected,/*udt*/ + cast_not_support,/*decimalint*/ + cast_not_expected,/*collection*/ + cast_not_expected,/*mysql date*/ + cast_not_expected,/*mysql datetime*/ + roaringbitmap_roaringbitmap,/*roaringbitmap*/ }, }; @@ -14699,6 +14951,11 @@ ObExpr::EvalEnumSetFunc OB_DATUM_CAST_MYSQL_ENUMSET_IMPLICIT[ObMaxTC][2] = cast_not_support_enum_set,/*enum*/ cast_not_support_enum_set,/*set*/ }, + { + /*ObRoaringBitmapTC -> enum_or_set*/ + cast_not_support_enum_set,/*enum*/ + cast_not_support_enum_set,/*set*/ + }, }; int string_collation_check(const bool is_strict_mode, diff --git a/src/sql/engine/expr/ob_expr.cpp b/src/sql/engine/expr/ob_expr.cpp index 89e2946cb..b0680b2f4 100644 --- a/src/sql/engine/expr/ob_expr.cpp +++ b/src/sql/engine/expr/ob_expr.cpp @@ -975,6 +975,7 @@ int ObExpr::init_vector(ObEvalCtx &ctx, CONTINUOUS_VECTOR_INIT_SWITCH(VEC_TC_JSON); CONTINUOUS_VECTOR_INIT_SWITCH(VEC_TC_GEO); CONTINUOUS_VECTOR_INIT_SWITCH(VEC_TC_UDT); + CONTINUOUS_VECTOR_INIT_SWITCH(VEC_TC_ROARINGBITMAP); #undef CONTINUOUS_VECTOR_INIT_SWITCH default: ret = OB_INVALID_ARGUMENT; @@ -1006,6 +1007,7 @@ int ObExpr::init_vector(ObEvalCtx &ctx, DISCRETE_VECTOR_INIT_SWITCH(VEC_TC_JSON); DISCRETE_VECTOR_INIT_SWITCH(VEC_TC_GEO); DISCRETE_VECTOR_INIT_SWITCH(VEC_TC_UDT); + DISCRETE_VECTOR_INIT_SWITCH(VEC_TC_ROARINGBITMAP); #undef DISCRETE_VECTOR_INIT_SWITCH default: ret = OB_INVALID_ARGUMENT; @@ -1055,6 +1057,7 @@ int ObExpr::init_vector(ObEvalCtx &ctx, UNIFORM_VECTOR_INIT_SWITCH(VEC_TC_JSON); UNIFORM_VECTOR_INIT_SWITCH(VEC_TC_GEO); UNIFORM_VECTOR_INIT_SWITCH(VEC_TC_UDT); + UNIFORM_VECTOR_INIT_SWITCH(VEC_TC_ROARINGBITMAP); #undef UNIFORM_VECTOR_INIT_SWITCH default: ret = OB_INVALID_ARGUMENT; @@ -1121,6 +1124,7 @@ int VectorHeader::init_uniform_const_vector(VecValueTypeClass vec_value_tc, UNIFORM_CONST_VECTOR_INIT_SWITCH(VEC_TC_JSON); UNIFORM_CONST_VECTOR_INIT_SWITCH(VEC_TC_GEO); UNIFORM_CONST_VECTOR_INIT_SWITCH(VEC_TC_UDT); + UNIFORM_CONST_VECTOR_INIT_SWITCH(VEC_TC_ROARINGBITMAP); #undef UNIFORM_CONST_VECTOR_INIT_SWITCH default: ret = OB_INVALID_ARGUMENT; diff --git a/src/sql/engine/expr/ob_expr.h b/src/sql/engine/expr/ob_expr.h index bdfc3cdd0..fb0618974 100644 --- a/src/sql/engine/expr/ob_expr.h +++ b/src/sql/engine/expr/ob_expr.h @@ -355,7 +355,8 @@ struct ObDynReserveBuf || common::ObJsonTC == tc || common::ObGeometryTC == tc || common::ObUserDefinedSQLTC == tc - || common::ObCollectionSQLTC == tc; + || common::ObCollectionSQLTC == tc + || common::ObRoaringBitmapTC == tc; } ObDynReserveBuf() = default; diff --git a/src/sql/engine/expr/ob_expr_abs_result_type.map b/src/sql/engine/expr/ob_expr_abs_result_type.map index 95a628172..ac3774e07 100644 --- a/src/sql/engine/expr/ob_expr_abs_result_type.map +++ b/src/sql/engine/expr/ob_expr_abs_result_type.map @@ -54,6 +54,7 @@ static constexpr ObObjType ABS_RESULT_TYPE[ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }; @@ -113,6 +114,7 @@ static constexpr ObObjType ABS_RESULT_TYPE_ORACLE[ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }; static_assert(is_array_fully_initialized(ABS_RESULT_TYPE_ORACLE), "ABS_RESULT_TYPE_ORACLE is partially initlized"); diff --git a/src/sql/engine/expr/ob_expr_arithmetic_result_type.map b/src/sql/engine/expr/ob_expr_arithmetic_result_type.map index 2c6c3418a..35dc4e480 100644 --- a/src/sql/engine/expr/ob_expr_arithmetic_result_type.map +++ b/src/sql/engine/expr/ob_expr_arithmetic_result_type.map @@ -56,6 +56,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyIntType*/ @@ -114,6 +115,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SmallIntType*/ @@ -172,6 +174,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumIntType*/ @@ -230,6 +233,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*Int32Type*/ @@ -288,6 +292,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntType*/ @@ -346,6 +351,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UTinyIntType*/ @@ -404,6 +410,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*USmallIntType*/ @@ -462,6 +469,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UMediumIntType*/ @@ -520,6 +528,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt32Type*/ @@ -578,6 +587,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt64Type*/ @@ -636,6 +646,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*FloatType*/ @@ -694,6 +705,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DoubleType*/ @@ -752,6 +764,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UFloatType*/ @@ -810,6 +823,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UDoubleType*/ @@ -868,6 +882,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberType*/ @@ -926,6 +941,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UNumberType*/ @@ -984,6 +1000,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateTimeType*/ @@ -1042,6 +1059,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimestampType*/ @@ -1100,6 +1118,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateType*/ @@ -1158,6 +1177,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimeType*/ @@ -1216,6 +1236,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*YearType*/ @@ -1274,6 +1295,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*VarcharType*/ @@ -1332,6 +1354,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*CharType*/ @@ -1390,6 +1413,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*HexStringType*/ @@ -1448,6 +1472,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ExtendType*/ @@ -1506,6 +1531,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UnknownType*/ @@ -1564,6 +1590,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTinyTextType*/ { @@ -1621,6 +1648,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTextType*/ { @@ -1678,6 +1706,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObMediumTextType*/ { @@ -1735,6 +1764,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLongTextType*/ { @@ -1792,6 +1822,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*BitType*/ { @@ -1849,6 +1880,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObUInt64Type, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumType*/ { @@ -1906,6 +1938,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetType*/ { @@ -1963,6 +1996,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumInnerType*/ { @@ -2020,6 +2054,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetInnerType*/ { @@ -2077,6 +2112,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampTZType*/ { @@ -2134,6 +2170,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampLTZType*/ { @@ -2191,6 +2228,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /* ObTimestampNanoType*/ { @@ -2248,6 +2286,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObRawType*/ { @@ -2305,6 +2344,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalYMType*/ { @@ -2362,6 +2402,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalDSType*/ { @@ -2419,6 +2460,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNumberFloatType*/ { @@ -2476,6 +2518,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNVarchar2Type*/ { @@ -2533,6 +2576,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNCharType*/ { @@ -2590,6 +2634,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObURowIDType*/ { @@ -2647,6 +2692,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLobType*/ { @@ -2704,6 +2750,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObJsonType*/ { @@ -2761,6 +2808,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObGeometryType*/ { @@ -2818,6 +2866,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObUserDefinedSqlType*/ { @@ -2875,6 +2924,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObDecimalIntType*/ { @@ -2932,6 +2982,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObCollectionSqlType*/ { @@ -2989,6 +3040,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateType*/ { @@ -3046,6 +3098,7 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateTimeType*/ { @@ -3103,6 +3156,65 @@ static constexpr ObObjType ARITH_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UInt64Type */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* ObTinyTextType */ + ObMaxType, /* ObTextType */ + ObMaxType, /* ObMediumTextType */ + ObMaxType, /* ObLongTextType */ + ObMaxType, /* ObBitType */ + ObMaxType, /* ObEnumType */ + ObMaxType, /* ObSetType */ + ObMaxType, /* ObEnumInnerType */ + ObMaxType, /* ObSetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* UDT */ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* ObCollectionSQLType*/ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, }; diff --git a/src/sql/engine/expr/ob_expr_cast.h b/src/sql/engine/expr/ob_expr_cast.h index 46117b9ed..bacc08233 100644 --- a/src/sql/engine/expr/ob_expr_cast.h +++ b/src/sql/engine/expr/ob_expr_cast.h @@ -83,6 +83,7 @@ static const int32_t CAST_STRING_DEFUALT_LENGTH[ObMaxType + 1] = { 1,//collection 10,//mysql date 19,//mysql datetime + 1,//roaringbitmap 0//max, invalid type, or count of obj type }; diff --git a/src/sql/engine/expr/ob_expr_div_result_type.map b/src/sql/engine/expr/ob_expr_div_result_type.map index 6369475ce..e184765e3 100644 --- a/src/sql/engine/expr/ob_expr_div_result_type.map +++ b/src/sql/engine/expr/ob_expr_div_result_type.map @@ -56,6 +56,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyIntType*/ @@ -114,6 +115,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SmallIntType*/ @@ -172,6 +174,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumIntType*/ @@ -230,6 +233,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*Int32Type*/ @@ -288,6 +292,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntType*/ @@ -346,6 +351,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UTinyIntType*/ @@ -404,6 +410,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*USmallIntType*/ @@ -462,6 +469,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UMediumIntType*/ @@ -520,6 +528,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt32Type*/ @@ -578,6 +587,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UIntType*/ @@ -636,6 +646,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*FloatType*/ @@ -694,6 +705,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DoubleType*/ @@ -752,6 +764,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UFloatType*/ @@ -810,6 +823,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UDoubleType*/ @@ -868,6 +882,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberType*/ @@ -926,6 +941,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UNumberType*/ @@ -984,6 +1000,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateTimeType*/ @@ -1042,6 +1059,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimestampType*/ @@ -1100,6 +1118,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateType*/ @@ -1158,6 +1177,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimeType*/ @@ -1216,6 +1236,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*YearType*/ @@ -1274,6 +1295,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*VarcharType*/ @@ -1332,6 +1354,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*CharType*/ @@ -1390,6 +1413,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*HexStringType*/ @@ -1448,6 +1472,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ExtendType*/ @@ -1506,6 +1531,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UnknownType*/ @@ -1564,6 +1590,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTinyTextType*/ { @@ -1621,6 +1648,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTextType*/ { @@ -1678,6 +1706,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObMediumTextType*/ { @@ -1735,6 +1764,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLongTextType*/ { @@ -1792,6 +1822,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*BitType*/ { @@ -1849,6 +1880,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumType*/ { @@ -1906,6 +1938,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetType*/ { @@ -1963,6 +1996,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumInnerType*/ { @@ -2020,6 +2054,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetInnerType*/ { @@ -2077,6 +2112,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampTZType*/ { @@ -2134,6 +2170,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampLTZType*/ { @@ -2191,6 +2228,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampNanoType*/ { @@ -2248,6 +2286,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObRawType*/ { @@ -2305,6 +2344,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalYMType*/ { @@ -2362,6 +2402,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalDSType*/ { @@ -2419,6 +2460,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNumberFloatType*/ { @@ -2476,6 +2518,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNVarchar2Type*/ { @@ -2533,6 +2576,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNCharType*/ { @@ -2590,6 +2634,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObURowIDType*/ { @@ -2647,6 +2692,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLobType*/ { @@ -2704,6 +2750,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObJsonType*/ { @@ -2761,6 +2808,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObGeometryType*/ { @@ -2818,6 +2866,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObUserDefinedSQLType*/ { @@ -2875,6 +2924,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObDecimalIntType*/ { @@ -2932,6 +2982,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObCollectionSQLType*/ { @@ -2989,6 +3040,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateType*/ { @@ -3046,6 +3098,7 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateTimeType*/ { @@ -3103,6 +3156,65 @@ static constexpr ObObjType DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UInt64Type */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* ObTinyTextType */ + ObMaxType, /* ObTextType */ + ObMaxType, /* ObMediumTextType */ + ObMaxType, /* ObLongTextType */ + ObMaxType, /* ObBitType */ + ObMaxType, /* ObEnumType */ + ObMaxType, /* ObSetType */ + ObMaxType, /* ObEnumInnerType */ + ObMaxType, /* ObSetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* ObUserDefinedSQLType*/ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* ObCollectionSQLType*/ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, }; diff --git a/src/sql/engine/expr/ob_expr_eval_functions.cpp b/src/sql/engine/expr/ob_expr_eval_functions.cpp index 750161689..e02aa412b 100644 --- a/src/sql/engine/expr/ob_expr_eval_functions.cpp +++ b/src/sql/engine/expr/ob_expr_eval_functions.cpp @@ -378,7 +378,15 @@ #include "ob_expr_sdo_relate.h" #include "ob_expr_inner_table_option_printer.h" #include "ob_expr_password.h" - +#include "ob_expr_rb_build_empty.h" +#include "ob_expr_rb_is_empty.h" +#include "ob_expr_rb_build_varbinary.h" +#include "ob_expr_rb_to_varbinary.h" +#include "ob_expr_rb_cardinality.h" +#include "ob_expr_rb_calc_cardinality.h" +#include "ob_expr_rb_calc.h" +#include "ob_expr_rb_to_string.h" +#include "ob_expr_rb_from_string.h" namespace oceanbase { @@ -1177,28 +1185,28 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = { NULL, // ObExprCanAccessTrigger::can_access_trigger, /* 694 */ NULL, //ObRelationalExprOperator::eval_min_max_compare, /* 695 */ NULL, //ObRelationalExprOperator::min_max_row_eval, /* 696 */ - NULL, // ObExprRbBuildEmpty::eval_rb_build_empty, /* 697 */ - NULL, // ObExprRbIsEmpty::eval_rb_is_empty, /* 698 */ - NULL, // ObExprRbBuildVarbinary::eval_rb_build_varbinary, /* 699 */ - NULL, // ObExprRbToVarbinary::eval_rb_to_varbinary, /* 700 */ - NULL, // ObExprRbCardinality::eval_rb_cardinality, /* 701 */ - NULL, // ObExprRbAndCardinality::eval_rb_and_cardinality, /* 702 */ - NULL, // ObExprRbOrCardinality::eval_rb_or_cardinality, /* 703 */ - NULL, // ObExprRbXorCardinality::eval_rb_xor_cardinality, /* 704 */ - NULL, // ObExprRbAndnotCardinality::eval_rb_andnot_cardinality, /* 705 */ - NULL, // ObExprRbAndNull2emptyCardinality::eval_rb_and_null2empty_cardinality, /* 706 */ - NULL, // ObExprRbOrNull2emptyCardinality::eval_rb_or_null2empty_cardinality, /* 707 */ - NULL, // ObExprRbAndnotNull2emptyCardinality::eval_rb_andnot_null2empty_cardinality, /* 708 */ - NULL, // ObExprRbAnd::eval_rb_and, /* 709 */ - NULL, // ObExprRbOr::eval_rb_or, /* 710 */ - NULL, // ObExprRbXor::eval_rb_xor, /* 711 */ - NULL, // ObExprRbAndnot::eval_rb_andnot, /* 712 */ - NULL, // ObExprRbAndNull2empty::eval_rb_and_null2empty, /* 713 */ - NULL, // ObExprRbOrNull2empty::eval_rb_or_null2empty, /* 714 */ - NULL, // ObExprRbAndnotNull2empty::eval_rb_andnot_null2empty, /* 715 */ + ObExprRbBuildEmpty::eval_rb_build_empty, /* 697 */ + ObExprRbIsEmpty::eval_rb_is_empty, /* 698 */ + ObExprRbBuildVarbinary::eval_rb_build_varbinary, /* 699 */ + ObExprRbToVarbinary::eval_rb_to_varbinary, /* 700 */ + ObExprRbCardinality::eval_rb_cardinality, /* 701 */ + ObExprRbAndCardinality::eval_rb_and_cardinality, /* 702 */ + ObExprRbOrCardinality::eval_rb_or_cardinality, /* 703 */ + ObExprRbXorCardinality::eval_rb_xor_cardinality, /* 704 */ + ObExprRbAndnotCardinality::eval_rb_andnot_cardinality, /* 705 */ + ObExprRbAndNull2emptyCardinality::eval_rb_and_null2empty_cardinality, /* 706 */ + ObExprRbOrNull2emptyCardinality::eval_rb_or_null2empty_cardinality, /* 707 */ + ObExprRbAndnotNull2emptyCardinality::eval_rb_andnot_null2empty_cardinality, /* 708 */ + ObExprRbAnd::eval_rb_and, /* 709 */ + ObExprRbOr::eval_rb_or, /* 710 */ + ObExprRbXor::eval_rb_xor, /* 711 */ + ObExprRbAndnot::eval_rb_andnot, /* 712 */ + ObExprRbAndNull2empty::eval_rb_and_null2empty, /* 713 */ + ObExprRbOrNull2empty::eval_rb_or_null2empty, /* 714 */ + ObExprRbAndnotNull2empty::eval_rb_andnot_null2empty, /* 715 */ ObExprSdoRelate::eval_sdo_relate, /* 716 */ - NULL, // ObExprRbToString::eval_rb_to_string, /* 717 */ - NULL, // ObExprRbFromString::eval_rb_from_string, /* 718 */ + ObExprRbToString::eval_rb_to_string, /* 717 */ + ObExprRbFromString::eval_rb_from_string, /* 718 */ NULL, // ObExprRbIterate::eval_rb_iterate, /* 719 */ NULL, // ObExprArray::eval_array, /* 720 */ NULL, // ObExprVectorL1Distance::calc_l1_distance, /* 721 */ diff --git a/src/sql/engine/expr/ob_expr_int_div_result_type.map b/src/sql/engine/expr/ob_expr_int_div_result_type.map index f3129b84d..b35b804fc 100644 --- a/src/sql/engine/expr/ob_expr_int_div_result_type.map +++ b/src/sql/engine/expr/ob_expr_int_div_result_type.map @@ -56,6 +56,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyIntType*/ @@ -114,6 +115,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SmallIntType*/ @@ -172,6 +174,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumIntType*/ @@ -230,6 +233,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*Int32Type*/ @@ -288,6 +292,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntType*/ @@ -346,6 +351,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UTinyIntType*/ @@ -404,6 +410,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*USmallIntType*/ @@ -462,6 +469,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UMediumIntType*/ @@ -520,6 +528,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt32Type*/ @@ -578,6 +587,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt64Type*/ @@ -636,6 +646,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*FloatType*/ @@ -694,6 +705,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DoubleType*/ @@ -752,6 +764,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UFloatType*/ @@ -810,6 +823,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UDoubleType*/ @@ -868,6 +882,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberType*/ @@ -926,6 +941,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UNumberType*/ @@ -984,6 +1000,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateTimeType*/ @@ -1042,6 +1059,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimestampType*/ @@ -1100,6 +1118,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateType*/ @@ -1158,6 +1177,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimeType*/ @@ -1216,6 +1236,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*YearType*/ @@ -1274,6 +1295,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*VarcharType*/ @@ -1332,6 +1354,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*CharType*/ @@ -1390,6 +1413,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*HexStringType*/ @@ -1448,6 +1472,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ExtendType*/ @@ -1506,6 +1531,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UnknownType*/ @@ -1564,6 +1590,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTinyTextType*/ { @@ -1621,6 +1648,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTextType*/ { @@ -1678,6 +1706,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObMediumTextType*/ { @@ -1735,6 +1764,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLongTextType*/ { @@ -1792,6 +1822,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*BitType*/ { @@ -1849,6 +1880,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumType*/ { @@ -1906,6 +1938,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetType*/ { @@ -1963,6 +1996,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUInt64Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumInnerType*/ { @@ -2020,6 +2054,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetInnerType*/ { @@ -2077,6 +2112,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /* ObTimestampTZType*/ { @@ -2134,6 +2170,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /* ObTimestampLTZType*/ { @@ -2191,6 +2228,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /* ObTimestampNanoType*/ { @@ -2248,6 +2286,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /* ObRawType*/ { @@ -2305,6 +2344,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntervalYMType*/ { @@ -2362,6 +2402,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntervalDSType*/ { @@ -2419,6 +2460,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNumberFloatType*/ { @@ -2476,6 +2518,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNVarchar2Type*/ { @@ -2533,6 +2576,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNCharType*/ { @@ -2590,6 +2634,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObURowIDType*/ { @@ -2647,6 +2692,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLobType*/ { @@ -2704,6 +2750,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObJsonType*/ { @@ -2762,6 +2809,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObGeometryType*/ { @@ -2819,6 +2867,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObUserDefinedSQLType*/ { @@ -2876,6 +2925,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObDecimalIntType*/ { @@ -2933,6 +2983,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObCollectionSQLType*/ { @@ -2990,6 +3041,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateType*/ { @@ -3047,6 +3099,7 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateTimeType*/ { @@ -3104,6 +3157,65 @@ static constexpr ObObjType INT_DIV_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UInt64Type */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* ObTinyTextType */ + ObMaxType, /* ObTextType */ + ObMaxType, /* ObMediumTextType */ + ObMaxType, /* ObLongTextType */ + ObMaxType, /* ObBitType */ + ObMaxType, /* ObEnumType */ + ObMaxType, /* ObSetType */ + ObMaxType, /* ObEnumInnerType */ + ObMaxType, /* ObSetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* ObUserDefinedSQLType*/ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* ObCollectionSQLType */ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, }; diff --git a/src/sql/engine/expr/ob_expr_merge_result_type_oracle.map b/src/sql/engine/expr/ob_expr_merge_result_type_oracle.map index 08d18da97..3ae9e0668 100644 --- a/src/sql/engine/expr/ob_expr_merge_result_type_oracle.map +++ b/src/sql/engine/expr/ob_expr_merge_result_type_oracle.map @@ -55,6 +55,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObCollectionSQLType, /* NullType=>ObCollectionSQLType*/ ObMySQLDateType, /*NullType=>ObMySQLDateType */ ObMySQLDateTimeType, /*NullType=>ObMySQLDateTimeType */ + ObMaxType, /* NullType=>ObRoaringBitmapType*/ }, /*TinyIntType*/ @@ -113,6 +114,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /* TinyInt=>ObCollectionSQLType*/ ObVarcharType, /*TinyIntType=>ObMySQLDateType */ ObVarcharType, /*TinyIntType=>ObMySQLDateTimeType */ + ObMaxType, /*TinyInt=>ObRoaringBitmapType*/ }, /*SmallIntType*/ @@ -171,6 +173,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*SmallInt=>ObCollectionSQLType*/ ObVarcharType, /*SmallInt=>ObMySQLDateType */ ObVarcharType, /*SmallInt=>ObMySQLDateTimeType */ + ObMaxType, /*SmallInt=>ObRoaringBitmapType*/ }, /*MediumIntType*/ @@ -229,6 +232,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*MediumInt=>ObCollectionSQLType*/ ObVarcharType, /*MediumInt=>ObMySQLDateType */ ObVarcharType, /*MediumInt=>ObMySQLDateTimeType */ + ObMaxType, /*MediumInt=>ObRoaringBitmapType*/ }, /*Int32Type*/ @@ -287,6 +291,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*Int32Type=>ObCollectionSQLType*/ ObVarcharType, /*Int32Type=>ObMySQLDateType */ ObVarcharType, /*Int32Type=>ObMySQLDateTimeType */ + ObMaxType, /*Int32Type=>ObRoaringBitmapType*/ }, /*IntType*/ @@ -345,6 +350,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*IntType=>ObCollectionSQLType*/ ObVarcharType, /*IntType=>ObMySQLDateType */ ObVarcharType, /*IntType=>ObMySQLDateTimeType */ + ObMaxType, /*IntType=>ObRoaringBitmapType*/ }, /*UTinyIntType*/ @@ -403,11 +409,12 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UTinyIntType=>ObCollectionSQLType*/ ObVarcharType, /*UTinyIntType=>ObMySQLDateType */ ObVarcharType, /*UTinyIntType=>ObMySQLDateTimeType */ + ObMaxType, /*UTinyIntType=>ObRoaringBitmapType*/ }, /*USmallIntType*/ { - ObUInt32Type, /*USmallIntType=>NullType */ + ObUInt32Type, /*USmallIntType=>NullType */ ObInt32Type, /*USmallIntType=>TinyIntType */ ObInt32Type, /*USmallIntType=>SmallIntType */ ObInt32Type, /*USmallIntType=>MediumIntType */ @@ -461,6 +468,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*USmallIntType=>ObCollectionSQLType*/ ObVarcharType, /*USmallIntType=>ObMySQLDateType */ ObVarcharType, /*USmallIntType=>ObMySQLDateTimeType */ + ObMaxType, /*USmallIntType=>ObRoaringBitmapType*/ }, /*UMediumIntType*/ @@ -519,6 +527,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UMediumIntType=>ObCollectionSQLType*/ ObVarcharType, /*UMediumIntType=>ObMySQLDateType */ ObVarcharType, /*UMediumIntType=>ObMySQLDateTimeType */ + ObMaxType, /*UMediumIntType=>ObRoaringBitmapType*/ }, /*UInt32Type*/ @@ -577,6 +586,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UInt32Type=>ObCollectionSQLType*/ ObVarcharType, /*UInt32Type=>ObMySQLDateType */ ObVarcharType, /*UInt32Type=>ObMySQLDateTimeType */ + ObMaxType, /*UInt32Type=>ObRoaringBitmapType*/ }, /*UIntType*/ @@ -635,6 +645,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UIntType=>ObCollectionSQLType*/ ObVarcharType, /*UIntType=>ObMySQLDateType */ ObVarcharType, /*UIntType=>ObMySQLDateTimeType */ + ObMaxType, /*UIntType=>ObRoaringBitmapType*/ }, /*FloatType*/ @@ -693,6 +704,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*FloatType=>ObCollectionSQLType*/ ObVarcharType, /*FloatType=>ObMySQLDateType */ ObVarcharType, /*FloatType=>ObMySQLDateTimeType */ + ObMaxType, /*FloatType=>ObRoaringBitmapType*/ }, /*DoubleType*/ @@ -751,6 +763,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*DoubleTYpe=>ObCollectionSQLType*/ ObVarcharType, /*DoubleType=>ObMySQLDateType */ ObVarcharType, /*DoubleType=>ObMySQLDateTimeType */ + ObMaxType, /*DoubleTYpe=>ObRoaringBitmapType*/ }, /*UFloatType*/ @@ -809,6 +822,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UFloatTYpe=>ObCollectionSQLType*/ ObVarcharType, /*UFloatType=>ObMySQLDateType */ ObVarcharType, /*UFloatType=>ObMySQLDateTimeType */ + ObMaxType, /*UFloatTYpe=>ObRoaringBitmapType*/ }, /*UDoubleType*/ @@ -867,6 +881,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UDoubleTYpe=>ObCollectionSQLType*/ ObVarcharType, /*UDoubleType=>ObMySQLDateType */ ObVarcharType, /*UDoubleType=>ObMySQLDateTimeType */ + ObMaxType, /*UDoubleTYpe=>ObRoaringBitmapType*/ }, /*NumberType*/ @@ -925,11 +940,12 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*NumberTYpe=>ObCollectionSQLType*/ ObVarcharType, /*NumberType=>ObMySQLDateType */ ObVarcharType, /*NumberType=>ObMySQLDateTimeType */ + ObMaxType, /*NumberTYpe=>ObRoaringBitmapType*/ }, /*UNumberType*/ { - ObUNumberType, /*UNumberType=>NullType */ + ObUNumberType, /*UNumberType=>NullType */ ObNumberType, /*UNumberType=>TinyIntType */ ObNumberType, /*UNumberType=>SmallIntType */ ObNumberType, /*UNumberType=>MediumIntType */ @@ -983,6 +999,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UNumberTYpe=>ObCollectionSQLType*/ ObVarcharType, /*UNumberType=>ObMySQLDateType */ ObVarcharType, /*UNumberType=>ObMySQLDateTimeType */ + ObMaxType, /*UNumberTYpe=>ObRoaringBitmapType*/ }, /*DateTimeType*/ @@ -1041,6 +1058,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*DateTimeTYpe=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*DateTimeType=>ObMySQLDateType */ ObMySQLDateTimeType, /*DateTimeType=>ObMySQLDateTimeType */ + ObMaxType, /*DateTimeTYpe=>ObRoaringBitmapType*/ }, /*TimestampType*/ @@ -1099,6 +1117,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*TimestampTYpe=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*TimestampType=>ObMySQLDateType */ ObMySQLDateTimeType, /*TimestampType=>ObMySQLDateTimeType */ + ObMaxType, /*TimestampTYpe=>ObRoaringBitmapType*/ }, /*DateType*/ @@ -1157,6 +1176,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*DateTYpe=>ObCollectionSQLType*/ ObMySQLDateType, /*DateType=>ObMySQLDateType */ ObMySQLDateTimeType, /*DateType=>ObMySQLDateTimeType */ + ObMaxType, /*DateTYpe=>ObRoaringBitmapType*/ }, /*TimeType*/ @@ -1215,6 +1235,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*TimeTYpe=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*TimeType=>ObMySQLDateType */ ObMySQLDateTimeType, /*TimeType=>ObMySQLDateTimeType */ + ObMaxType, /*TimeTYpe=>ObRoaringBitmapType*/ }, /*YearType*/ @@ -1273,6 +1294,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*YearTYpe=>ObCollectionSQLType*/ ObVarcharType, /*YearType=>ObMySQLDateType */ ObVarcharType, /*YearType=>ObMySQLDateTimeType */ + ObMaxType, /*YearTYpe=>ObRoaringBitmapType*/ }, /*VarcharType*/ @@ -1331,6 +1353,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*VarcharTYpe=>ObCollectionSQLType*/ ObVarcharType, /*VarcharType=>ObMySQLDateType */ ObVarcharType, /*VarcharType=>ObMySQLDateTimeType */ + ObMaxType, /*VarcharTYpe=>ObRoaringBitmapType*/ }, /*CharType*/ @@ -1389,6 +1412,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*CharType=>ObCollectionSQLType*/ ObCharType, /*CharType=>ObMySQLDateType */ ObCharType, /*CharType=>ObMySQLDateTimeType */ + ObMaxType, /*CharType=>ObRoaringBitmapType*/ }, /*HexStringType*/ @@ -1447,6 +1471,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*HexStringType=>ObCollectionSQLType*/ ObVarcharType, /*HexStringType=>ObMySQLDateType */ ObVarcharType, /*HexStringType=>ObMySQLDateTimeType */ + ObMaxType, /*HexStringType=>ObRoaringBitmapType*/ }, /*ExtendType*/ @@ -1505,6 +1530,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObCollectionSQLType, /*ExtendType=>ObCollectionSQLType*/ ObMaxType, /*ExtendType=>ObMySQLDateType */ ObMaxType, /*ExtendType=>ObMySQLDateTimeType */ + ObMaxType, /*ExtendType=>ObRoaringBitmapType*/ }, /*UnknownType*/ @@ -1563,6 +1589,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*UnknownType=>ObCollectionSQLType*/ ObVarcharType, /*UnknownType=>ObMySQLDateType */ ObVarcharType, /*UnknownType=>ObMySQLDateTimeType */ + ObMaxType, /*UnknownType=>ObRoaringBitmapType*/ }, /*ObTinyTextType*/ { @@ -1620,6 +1647,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTinyTextType=>ObCollectionSQLType*/ ObTinyTextType, /*ObTinyTextType=>ObMySQLDateType */ ObTinyTextType, /*ObTinyTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTinyTextType=>ObRoaringBitmapType*/ }, /*ObTextType*/ { @@ -1677,6 +1705,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTextType=>ObCollectionSQLType*/ ObTextType, /*ObTextType=>ObMySQLDateType */ ObTextType, /*ObTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTextType=>ObRoaringBitmapType*/ }, /*ObMediumTextType*/ @@ -1732,9 +1761,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObMediumTextType=>ObGeometryType*/ ObMaxType, /*ObMediumTextType=>ObUserDefinedSQLType*/ ObMediumTextType, - ObMaxType, /*ObMediumTextType=>ObCollectionSQLType*/ + ObMaxType, /*ObMediumTextType=>ObCollectionSQLType*/ ObMediumTextType, /*ObMediumTextType=>ObMySQLDateType */ ObMediumTextType, /*ObMediumTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObMediumTextType=>ObRoaringBitmapType*/ }, /*ObLongTextType*/ @@ -1793,6 +1823,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObLongTextType=>ObCollectionSQLType*/ ObLongTextType, /*ObLongTextType=>ObMySQLDateType */ ObLongTextType, /*ObLongTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObLongTextType=>ObRoaringBitmapType*/ }, /*ObBitType*/ { @@ -1850,6 +1881,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObBitType=>ObCollectionSQLType*/ ObVarcharType, /*ObBitType=>ObMySQLDateType */ ObVarcharType, /*ObBitType=>ObMySQLDateTimeType */ + ObMaxType, /*ObBitType=>ObRoaringBitmapType*/ }, /*ObEnumType*/ { @@ -1907,6 +1939,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObEnumType=>ObCollectionSQLType*/ ObVarcharType, /*ObEnumType=>ObMySQLDateType */ ObVarcharType, /*ObEnumType=>ObMySQLDateTimeType */ + ObMaxType, /*ObEnumType=>ObRoaringBitmapType*/ }, /*ObSetType*/ { @@ -1964,6 +1997,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObSetType=>ObCollectionSQLType*/ ObVarcharType, /*ObSetType=>ObMySQLDateType */ ObVarcharType, /*ObSetType=>ObMySQLDateTimeType */ + ObMaxType, /*ObSetType=>ObRoaringBitmapType*/ }, /*ObEnumInnerType*/ { @@ -2021,6 +2055,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObEnumInnerType=>ObCollectionSQLType*/ ObVarcharType, /*ObEnumInnerType=>ObMySQLDateType */ ObVarcharType, /*ObEnumInnerType=>ObMySQLDateTimeType */ + ObMaxType, /*ObEnumInnerType=>ObRoaringBitmapType*/ }, /*ObSetInnerType*/ { @@ -2078,6 +2113,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObSetInnerType=>ObCollectionSQLType*/ ObVarcharType, /*ObSetInnerType=>ObMySQLDateType */ ObVarcharType, /*ObSetInnerType=>ObMySQLDateTimeType */ + ObMaxType, /*ObSetInnerType=>ObRoaringBitmapType*/ }, /*ObTimestampTZType*/ { @@ -2135,6 +2171,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTimestampTZType=>ObCollectionSQLType*/ ObTimestampTZType, /*ObTimestampTZType=>ObMySQLDateType */ ObTimestampTZType, /*ObTimestampTZType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTimestampTZType=>ObRoaringBitmapType*/ }, /*ObTimestampLTZType*/ { @@ -2192,6 +2229,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTimestampLTZType=>ObCollectionSQLType*/ ObTimestampLTZType, /*ObTimestampLTZType=>ObMySQLDateType */ ObTimestampLTZType, /*ObTimestampLTZType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTimestampLTZType=>ObRoaringBitmapType*/ }, /*ObTimestampNanoType*/ { @@ -2249,6 +2287,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTimestampNanoType=>ObCollectionSQLType*/ ObTimestampNanoType, /*ObTimestampNanoType=>ObMySQLDateType */ ObTimestampNanoType, /*ObTimestampNanoType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTimestampNanoType=>ObRoaringBitmapType*/ }, /*ObRawType*/ { @@ -2306,6 +2345,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObRawType=>ObCollectionSQLType*/ ObRawType, /*ObRawType=>ObMySQLDateType */ ObRawType, /*ObRawType=>ObMySQLDateTimeType */ + ObMaxType, /*ObRawType=>ObRoaringBitmapType*/ }, /*ObIntervalYMType*/ { @@ -2363,6 +2403,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObIntervalYMType=>ObCollectionSQLType*/ ObIntervalYMType, /*ObIntervalYMType=>ObMySQLDateType */ ObIntervalYMType, /*ObIntervalYMType=>ObMySQLDateTimeType */ + ObMaxType, /*ObIntervalYMType=>ObRoaringBitmapType*/ }, /*ObIntervalDSType*/ { @@ -2420,6 +2461,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObIntervalDSType=>ObCollectionSQLType*/ ObIntervalDSType, /*ObIntervalDSType=>ObMySQLDateType */ ObMaxType, /*ObIntervalDSType=>ObMySQLDateTimeType */ + ObMaxType, /*ObIntervalDSType=>ObRoaringBitmapType*/ }, /*ObNumberFloatType*/ @@ -2478,6 +2520,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*NumberFloatType=>ObCollectionSQLType*/ ObVarcharType, /*NumberFloatType=>ObMySQLDateType */ ObVarcharType, /*NumberFloatType=>ObMySQLDateTimeType */ + ObMaxType, /*NumberFloatType=>ObRoaringBitmapType*/ }, /*ObNVarchar2Type*/ { @@ -2535,6 +2578,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObNVarchar2Type=>ObCollectionSQLType*/ ObNVarchar2Type, /*ObNVarchar2Type=>ObMySQLDateType */ ObNVarchar2Type, /*ObNVarchar2Type=>ObMySQLDateTimeType */ + ObMaxType, /*ObNVarchar2Type=>ObRoaringBitmapType*/ }, /*ObNCharType*/ { @@ -2592,6 +2636,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObNCharType=>ObCollectionSQLType*/ ObNCharType, /*ObNCharType=>ObMySQLDateType */ ObNCharType, /*ObNCharType=>ObMySQLDateTimeType */ + ObMaxType, /*ObNCharType=>ObRoaringBitmapType*/ }, /*ObURowIDType*/ { @@ -2649,6 +2694,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObURowIDType=>ObCollectionSQLType*/ ObMaxType, /*ObURowIDType=>ObMySQLDateType */ ObMaxType, /*ObURowIDType=>ObMySQLDateTimeType */ + ObMaxType, /*ObURowIDType=>ObRoaringBitmapType*/ }, /*ObLobType*/ { @@ -2706,6 +2752,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /* ObLobType=>ObCollectionSQLType*/ ObMaxType, /*ObLobType=>ObMySQLDateType */ ObMaxType, /*ObLobType=>ObMySQLDateTimeType */ + ObMaxType, /* ObLobType=>ObRoaringBitmapType*/ }, /*ObJsonType*/ { @@ -2734,7 +2781,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObJsonType, /* ObJsonType=>VarcharType */ ObJsonType, /* ObJsonType=>CharType */ ObJsonType, /* ObJsonType=>HexStringType */ - ObMaxType, /* ObJsonType=>ExtendType */ + ObMaxType, /* ObJsonType=>ExtendType */ ObJsonType, /* ObJsonType=>UnknownType */ ObJsonType, /* ObJsonType=>ObTinyTextType */ ObJsonType, /* ObJsonType=>ObTextType */ @@ -2745,24 +2792,25 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObVarcharType, /* ObJsonType=>ObSetType */ ObVarcharType, /* ObJsonType=>ObEnumInnerType */ ObVarcharType, /* ObJsonType=>ObSetInnerType */ - ObMaxType, /* ObJsonType=>ObTimestampTZType */ - ObMaxType, /* ObJsonType=>ObTimestampLTZType */ - ObMaxType, /* ObJsonType=>ObTimestampNanoType */ - ObMaxType, /* ObJsonType=>ObRawType */ - ObMaxType, /* ObJsonType=>ObIntervalYMType */ - ObMaxType, /* ObJsonType=>ObIntervalDSType */ - ObMaxType, /* ObJsonType=>ObNumberFloatType */ - ObMaxType, /* ObJsonType=>ObNVarchar2Type */ - ObMaxType, /* ObJsonType=>ObNCharType */ - ObMaxType, /*ObJsonType=>ObURowIDType*/ - ObMaxType, /*ObJsonType=>ObLobType*/ - ObJsonType, /*ObJsonType=>ObJsonType*/ - ObMaxType, /*ObJsonType=>ObGeometryType*/ - ObMaxType, /*ObJsonType=>ObUserDefinedSQLType*/ + ObMaxType, /* ObJsonType=>ObTimestampTZType */ + ObMaxType, /* ObJsonType=>ObTimestampLTZType */ + ObMaxType, /* ObJsonType=>ObTimestampNanoType */ + ObMaxType, /* ObJsonType=>ObRawType */ + ObMaxType, /* ObJsonType=>ObIntervalYMType */ + ObMaxType, /* ObJsonType=>ObIntervalDSType */ + ObMaxType, /* ObJsonType=>ObNumberFloatType */ + ObMaxType, /* ObJsonType=>ObNVarchar2Type */ + ObMaxType, /* ObJsonType=>ObNCharType */ + ObMaxType, /*ObJsonType=>ObURowIDType*/ + ObMaxType, /*ObJsonType=>ObLobType*/ + ObJsonType, /*ObJsonType=>ObJsonType*/ + ObMaxType, /*ObJsonType=>ObGeometryType*/ + ObMaxType, /*ObJsonType=>ObUserDefinedSQLType*/ ObJsonType, - ObMaxType, /*ObJsonType=>ObCollectionSQLType*/ + ObMaxType, /*ObJsonType=>ObCollectionSQLType*/ ObJsonType, /*ObJsonType=>ObMySQLDateType */ ObJsonType, /*ObJsonType=>ObMySQLDateTimeType */ + ObMaxType, /*ObJsonType=>ObRoaringBitmapType*/ }, /*ObGeometryType*/ { @@ -2798,28 +2846,29 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObGeometryType, /* ObGeometryType=>ObMediumTextType */ ObGeometryType, /* ObGeometryType=>ObLongTextType */ ObGeometryType, /* ObGeometryType=>ObBitType */ - ObMaxType, /* ObGeometryType=>ObEnumType */ - ObMaxType, /* ObGeometryType=>ObSetType */ - ObMaxType, /* ObGeometryType=>ObEnumInnerType */ - ObMaxType, /* ObGeometryType=>ObSetInnerType */ - ObMaxType, /* ObGeometryType=>ObTimestampTZType */ - ObMaxType, /* ObGeometryType=>ObTimestampLTZType */ - ObMaxType, /* ObGeometryType=>ObTimestampNanoType */ - ObMaxType, /* ObGeometryType=>ObRawType */ - ObMaxType, /* ObGeometryType=>ObIntervalYMType */ - ObMaxType, /* ObGeometryType=>ObIntervalDSType */ - ObMaxType, /* ObGeometryType=>ObNumberFloatType */ - ObMaxType, /* ObGeometryType=>ObNVarchar2Type */ - ObMaxType, /* ObGeometryType=>ObNCharType */ - ObMaxType, /* ObGeometryType=>ObURowIDType*/ - ObMaxType, /* ObGeometryType=>ObLobType*/ - ObMaxType, /* ObGeometryType=>ObJsonType*/ + ObMaxType, /* ObGeometryType=>ObEnumType */ + ObMaxType, /* ObGeometryType=>ObSetType */ + ObMaxType, /* ObGeometryType=>ObEnumInnerType */ + ObMaxType, /* ObGeometryType=>ObSetInnerType */ + ObMaxType, /* ObGeometryType=>ObTimestampTZType */ + ObMaxType, /* ObGeometryType=>ObTimestampLTZType */ + ObMaxType, /* ObGeometryType=>ObTimestampNanoType */ + ObMaxType, /* ObGeometryType=>ObRawType */ + ObMaxType, /* ObGeometryType=>ObIntervalYMType */ + ObMaxType, /* ObGeometryType=>ObIntervalDSType */ + ObMaxType, /* ObGeometryType=>ObNumberFloatType */ + ObMaxType, /* ObGeometryType=>ObNVarchar2Type */ + ObMaxType, /* ObGeometryType=>ObNCharType */ + ObMaxType, /* ObGeometryType=>ObURowIDType*/ + ObMaxType, /* ObGeometryType=>ObLobType*/ + ObMaxType, /* ObGeometryType=>ObJsonType*/ ObGeometryType, /* ObGeometryType=>ObGeometryType*/ ObMaxType, /* ObGeometryType=>ObUserDefinedSQLType*/ ObGeometryType, - ObMaxType, /* ObGeometryType=>ObCollectionSQLType*/ + ObMaxType, /* ObGeometryType=>ObCollectionSQLType*/ ObGeometryType, /*ObGeometryType=>ObMySQLDateType */ ObGeometryType, /*ObGeometryType=>ObMySQLDateTimeType */ + ObMaxType, /* ObGeometryType=>ObRoaringBitmapType*/ }, /*ObUserDefinedSQLType*/ { @@ -2877,6 +2926,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /* ObUserDefinedSQLType=>ObCollectionSQLType*/ ObMaxType, /*ObUserDefinedSQLType=>ObMySQLDateType */ ObMaxType, /*ObUserDefinedSQLType=>ObMySQLDateTimeType */ + ObMaxType, /* ObUserDefinedSQLType=>ObRoaringBitmapType*/ }, /*ObDecimalIntType*/ { @@ -2934,6 +2984,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /* ObDecimalIntType=>ObCollectionSQLType */ ObMaxType, /*ObUserDefinedSQLType=>ObMySQLDateType */ ObMaxType, /*ObUserDefinedSQLType=>ObMySQLDateTimeType */ + ObMaxType, /*ObDecimalIntType=>ObRoaringBitmapType*/ }, /*ObCollectionSQLType*/ { @@ -2991,6 +3042,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObCollectionSQLType, /* ObCollectionSQLType */ ObMaxType, /* ObCollectionSQLType=>ObMySQLDateType */ ObMaxType, /* ObCollectionSQLType=>ObMySQLDateTimeType */ + ObMaxType, /* ObCollectionSQLType=>ObRoaringBitmapType*/ }, /*MySQLDateType*/ { @@ -3048,6 +3100,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObMySQLDateType=>ObCollectionSQLType*/ ObMySQLDateType, /*ObMySQLDateType=>ObMySQLDateType */ ObMySQLDateTimeType, /*ObMySQLDateType=>ObMySQLDateTimeType */ + ObMaxType, /* ObCollectionSQLType=>ObRoaringBitmapType*/ }, /*MySQLDateTimeType*/ { @@ -3105,6 +3158,65 @@ static constexpr ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = { ObMaxType, /*ObMySQLDateTimeType=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*ObMySQLDateTimeType=>ObMySQLDateType */ ObMySQLDateTimeType, /*ObMySQLDateTimeType=>ObMySQLDateTimeType */ + ObMaxType, /* ObCollectionSQLType=>ObRoaringBitmapType*/ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* ObRoaringBitmapType=>NullType */ + ObMaxType, /* ObRoaringBitmapType=>TinyIntType */ + ObMaxType, /* ObRoaringBitmapType=>SmallIntType */ + ObMaxType, /* ObRoaringBitmapType=>MediumIntType */ + ObMaxType, /* ObRoaringBitmapType=>Int32Type */ + ObMaxType, /* ObRoaringBitmapType=>IntType */ + ObMaxType, /* ObRoaringBitmapType=>UTinyIntType */ + ObMaxType, /* ObRoaringBitmapType=>USmallIntType */ + ObMaxType, /* ObRoaringBitmapType=>UMediumIntType */ + ObMaxType, /* ObRoaringBitmapType=>UInt32Type */ + ObMaxType, /* ObRoaringBitmapType=>UIntType */ + ObMaxType, /* ObRoaringBitmapType=>FloatType */ + ObMaxType, /* ObRoaringBitmapType=>DoubleType */ + ObMaxType, /* ObRoaringBitmapType=>UFloatType */ + ObMaxType, /* ObRoaringBitmapType=>UDoubleType */ + ObMaxType, /* ObRoaringBitmapType=>NumberType */ + ObMaxType, /* ObRoaringBitmapType=>UNumberType */ + ObMaxType, /* ObRoaringBitmapType=>DateTimeType */ + ObMaxType, /* ObRoaringBitmapType=>TimestampType */ + ObMaxType, /* ObRoaringBitmapType=>DateType */ + ObMaxType, /* ObRoaringBitmapType=>TimeType */ + ObMaxType, /* ObRoaringBitmapType=>YearType */ + ObMaxType, /* ObRoaringBitmapType=>VarcharType */ + ObMaxType, /* ObRoaringBitmapType=>CharType */ + ObMaxType, /* ObRoaringBitmapType=>HexStringType */ + ObMaxType, /* ObRoaringBitmapType=>ExtendType */ + ObMaxType, /* ObRoaringBitmapType=>UnknownType */ + ObMaxType, /* ObRoaringBitmapType=>ObTinyTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObMediumTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObLongTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObBitType */ + ObMaxType, /* ObRoaringBitmapType=>ObEnumType */ + ObMaxType, /* ObRoaringBitmapType=>ObSetType */ + ObMaxType, /* ObRoaringBitmapType=>ObEnumInnerType */ + ObMaxType, /* ObRoaringBitmapType=>ObSetInnerType */ + ObMaxType, /* ObRoaringBitmapType=>ObTimestampTZType */ + ObMaxType, /* ObRoaringBitmapType=>ObTimestampLTZType */ + ObMaxType, /* ObRoaringBitmapType=>ObTimestampNanoType */ + ObMaxType, /* ObRoaringBitmapType=>ObRawType */ + ObMaxType, /* ObRoaringBitmapType=>ObIntervalYMType */ + ObMaxType, /* ObRoaringBitmapType=>ObIntervalDSType */ + ObMaxType, /* ObRoaringBitmapType=>ObNumberFloatType */ + ObMaxType, /* ObRoaringBitmapType=>ObNVarchar2Type */ + ObMaxType, /* ObRoaringBitmapType=>ObNCharType */ + ObMaxType, /* ObRoaringBitmapType=>ObURowIDType*/ + ObLobType, /* ObRoaringBitmapType=>ObLobType*/ + ObMaxType, /* ObRoaringBitmapType=>ObJsonType*/ + ObMaxType, /* ObRoaringBitmapType=>ObGeometryType*/ + ObMaxType, /* ObRoaringBitmapType=>ObUserDefinedSQLType*/ + ObMaxType, /* ObRoaringBitmapType=>ObDecimalIntType */ + ObMaxType, /* ObRoaringBitmapType=>ObCollectionSQLType */ + ObMaxType, /* ObRoaringBitmapType=>ObMySQLDateType */ + ObMaxType, /* ObRoaringBitmapType=>ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType=>ObRoaringBitmapType*/ }, }; @@ -3162,9 +3274,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*NullType=>ObGeometryType*/ ObUserDefinedSQLType,/*NullType=>ObUserDefinedSQLType*/ ObNumberType, /*NullType=>ObDecimalIntType */ - ObCollectionSQLType, /* NullType=>ObCollectionSQLType*/ + ObCollectionSQLType, /*NullType=>ObCollectionSQLType*/ ObMySQLDateType, /*NullType=>ObMySQLDateType */ ObMySQLDateTimeType, /*NullType=>ObMySQLDateTimeType */ + ObMaxType, /*NullType=>ObRoaringBitmapType*/ }, /*TinyIntType*/ @@ -3220,9 +3333,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*TinyInt=>ObGeometryType*/ ObMaxType, /*TinyInt=>ObUserDefinedSQLType*/ ObNumberType, /*TinyInt=>ObDecimalIntType */ - ObMaxType, /* TinyInt=>ObCollectionSQLType*/ + ObMaxType, /*TinyInt=>ObCollectionSQLType*/ ObVarcharType, /*TinyIntType=>ObMySQLDateType */ ObVarcharType, /*TinyIntType=>ObMySQLDateTimeType */ + ObMaxType, /*TinyInt=>ObRoaringBitmapType*/ }, /*SmallIntType*/ @@ -3281,6 +3395,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*SmallInt=>ObCollectionSQLType*/ ObVarcharType, /*SmallInt=>ObMySQLDateType */ ObVarcharType, /*SmallInt=>ObMySQLDateTimeType */ + ObMaxType, /*SmallInt=>ObRoaringBitmapType*/ }, /*MediumIntType*/ @@ -3339,6 +3454,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*MediumInt=>ObCollectionSQLType*/ ObVarcharType, /*MediumInt=>ObMySQLDateType */ ObVarcharType, /*MediumInt=>ObMySQLDateTimeType */ + ObMaxType, /*MediumInt=>ObRoaringBitmapType*/ }, /*Int32Type*/ @@ -3394,9 +3510,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*Int32Type=>ObGeometryType*/ ObMaxType, /*Int32Type=>ObUserDefinedSQLType*/ ObNumberType, /*Int32Type=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*Int32Type=>ObCollectionSQLType*/ ObVarcharType, /*Int32Type=>ObMySQLDateType */ ObVarcharType, /*Int32Type=>ObMySQLDateTimeType */ + ObMaxType, /*Int32Type=>ObRoaringBitmapType*/ }, /*IntType*/ @@ -3455,6 +3572,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*IntType=>ObCollectionSQLType*/ ObVarcharType, /*IntType=>ObMySQLDateType */ ObVarcharType, /*IntType=>ObMySQLDateTimeType */ + ObMaxType, /*IntType=>ObRoaringBitmapType*/ }, /*UTinyIntType*/ @@ -3510,9 +3628,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*UTinyIntType=>ObGeometryType*/ ObMaxType, /*UTinyIntType=>ObUserDefinedSQLType*/ ObNumberType, /*IntType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*IntType=>ObCollectionSQLType*/ ObVarcharType, /*UTinyIntType=>ObMySQLDateType */ ObVarcharType, /*UTinyIntType=>ObMySQLDateTimeType */ + ObMaxType, /*IntType=>ObRoaringBitmapType*/ }, /*USmallIntType*/ @@ -3568,9 +3687,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*USmallIntType=>ObGeometryType*/ ObMaxType, /*USmallIntType=>ObUserDefinedSQLType*/ ObNumberType, /*IntType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*IntType=>ObCollectionSQLType*/ ObVarcharType, /*USmallIntType=>ObMySQLDateType */ ObVarcharType, /*USmallIntType=>ObMySQLDateTimeType */ + ObMaxType, /*IntType=>ObRoaringBitmapType*/ }, /*UMediumIntType*/ @@ -3626,9 +3746,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*UMediumIntType=>ObGeometryType*/ ObMaxType, /*UMediumIntType=>ObUserDefinedSQLType*/ ObNumberType, /*IntType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*IntType=>ObCollectionSQLType*/ ObVarcharType, /*UMediumIntType=>ObMySQLDateType */ ObVarcharType, /*UMediumIntType=>ObMySQLDateTimeType */ + ObMaxType, /*IntType=>ObRoaringBitmapType*/ }, /*UInt32Type*/ @@ -3684,9 +3805,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*UInt32Type=>ObGeometryType*/ ObMaxType, /*UInt32Type=>ObUserDefinedSQLType*/ ObNumberType, /*IntType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*IntType=>ObCollectionSQLType*/ ObVarcharType, /*UInt32Type=>ObMySQLDateType */ ObVarcharType, /*UInt32Type=>ObMySQLDateTimeType */ + ObMaxType, /*IntType=>ObRoaringBitmapType*/ }, /*UIntType*/ @@ -3741,10 +3863,11 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObJsonType, /*UIntType=>ObJsonType*/ ObGeometryType, /*UIntType=>ObGeometryType*/ ObMaxType, /*UIntType=>ObUserDefinedSQLType*/ - ObNumberType, /*IntType=>ObDecimalIntType */ - ObMaxType, + ObNumberType, /*UIntType=>ObDecimalIntType */ + ObMaxType, /*UIntType=>ObCollectionSQLType*/ ObVarcharType, /*UIntType=>ObMySQLDateType */ ObVarcharType, /*UIntType=>ObMySQLDateTimeType */ + ObMaxType, /*UIntType=>ObRoaringBitmapType*/ }, /*FloatType*/ @@ -3800,9 +3923,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*FloatType=>ObGeometryType*/ ObMaxType, /*FloatType=>ObUserDefinedSQLType*/ ObFloatType, /*FloatType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*FloatType=>ObCollectionSQLType*/ ObVarcharType, /*FloatType=>ObMySQLDateType */ ObVarcharType, /*FloatType=>ObMySQLDateTimeType */ + ObMaxType, /*FloatType=>ObRoaringBitmapType*/ }, /*DoubleType*/ @@ -3858,9 +3982,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*DoubleTYpe=>ObGeometryType*/ ObMaxType, /*DoubleTYpe=>ObUserDefinedSQLType*/ ObDoubleType, /*DoubleType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*DoubleType=>ObCollectionSQLType*/ ObVarcharType, /*DoubleType=>ObMySQLDateType */ ObVarcharType, /*DoubleType=>ObMySQLDateTimeType */ + ObMaxType, /*DoubleType=>ObRoaringBitmapType*/ }, /*UFloatType*/ @@ -3915,10 +4040,11 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObJsonType, /*UFloatType=>ObJsonType*/ ObGeometryType, /*UFloatTYpe=>ObGeometryType*/ ObMaxType, /*UFloatTYpe=>ObUserDefinedSQLType*/ - ObFloatType, /*FloatType=>ObDecimalIntType */ - ObMaxType, + ObFloatType, /*UFloatTYpe=>ObDecimalIntType */ + ObMaxType, /*UFloatTYpe=>ObCollectionSQLType*/ ObVarcharType, /*UFloatType=>ObMySQLDateType */ ObVarcharType, /*UFloatType=>ObMySQLDateTimeType */ + ObMaxType, /*UFloatTYpe=>ObRoaringBitmapType*/ }, /*UDoubleType*/ @@ -3974,9 +4100,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*UDoubleTYpe=>ObGeometryType*/ ObMaxType, /*UDoubleTYpe=>ObUserDefinedSQLType*/ ObDoubleType, /*UDoubleType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*UDoubleType=>ObCollectionSQLType*/ ObVarcharType, /*UDoubleType=>ObMySQLDateType */ ObVarcharType, /*UDoubleType=>ObMySQLDateTimeType */ + ObMaxType, /*UDoubleType=>ObRoaringBitmapType*/ }, /*NumberType*/ @@ -4032,9 +4159,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*NumberTYpe=>ObGeometryType*/ ObMaxType, /*NumberTYpe=>ObUserDefinedSQLType*/ ObNumberType, /*NumberType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*NumberTYpe=>ObCollectionSQLType*/ ObVarcharType, /*NumberType=>ObMySQLDateType */ ObVarcharType, /*NumberType=>ObMySQLDateTimeType */ + ObMaxType, /*NumberTYpe=>ObRoaringBitmapType*/ }, /*UNumberType*/ @@ -4090,9 +4218,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*UNumberTYpe=>ObGeometryType*/ ObMaxType, /*UNumberTYpe=>ObUserDefinedSQLType*/ ObNumberType, /*NumberType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*UNumberTYpe=>ObCollectionSQLType*/ ObVarcharType, /*UNumberType=>ObMySQLDateType */ ObVarcharType, /*UNumberType=>ObMySQLDateTimeType */ + ObMaxType, /*UNumberTYpe=>RoaringBitmapType*/ }, /*DateTimeType*/ @@ -4148,9 +4277,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*DateTimeTYpe=>ObGeometryType*/ ObMaxType, /*DateTimeTYpe=>ObUserDefinedSQLType*/ ObVarcharType, /*DateTimeType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*DateTimeTYpe=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*DateTimeType=>ObMySQLDateType */ ObMySQLDateTimeType, /*DateTimeType=>ObMySQLDateTimeType */ + ObMaxType, /*DateTimeTYpe=>ObRoaringBitmapType*/ }, /*TimestampType*/ @@ -4206,9 +4336,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*TimestampTYpe=>ObGeometryType*/ ObMaxType, /*TimestampTYpe=>ObUserDefinedSQLType*/ ObVarcharType, /*TimestampType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*TimestampTYpe=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*TimestampType=>ObMySQLDateType */ ObMySQLDateTimeType, /*TimestampType=>ObMySQLDateTimeType */ + ObMaxType, /*TimestampTYpe=>ObRoaringBitmapType*/ }, /*DateType*/ @@ -4264,9 +4395,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*DateTYpe=>ObGeometryType*/ ObMaxType, /*DateTYpe=>ObUserDefinedSQLType*/ ObVarcharType, /*TimestampType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*DateTYpe=>ObCollectionSQLType*/ ObMySQLDateType, /*DateType=>ObMySQLDateType */ ObMySQLDateTimeType, /*DateType=>ObMySQLDateTimeType */ + ObMaxType, /*DateTYpe=>ObRoaringBitmapType*/ }, /*TimeType*/ @@ -4322,9 +4454,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*TimeTYpe=>ObGeometryType*/ ObMaxType, /*TimeTYpe=>ObUserDefinedSQLType*/ ObVarcharType, /*TimestampType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*TimeTYpe=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*TimeType=>ObMySQLDateType */ ObMySQLDateTimeType, /*TimeType=>ObMySQLDateTimeType */ + ObMaxType, /*TimeTYpe=>ObRoaringBitmapType*/ }, /*YearType*/ @@ -4380,9 +4513,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*YearTYpe=>ObGeometryType*/ ObMaxType, /*YearTYpe=>ObUserDefinedSQLType*/ ObDecimalIntType, /*YearType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*YearTYpe=>ObCollectionSQLType*/ ObVarcharType, /*YearType=>ObMySQLDateType */ ObVarcharType, /*YearType=>ObMySQLDateTimeType */ + ObMaxType, /*YearTYpe=>ObRoaringBitmapType*/ }, /*VarcharType*/ @@ -4438,9 +4572,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*VarcharTYpe=>ObGeometryType*/ ObMaxType, /*VarcharTYpe=>ObUserDefinedSQLType*/ ObVarcharType, /*VarcharType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*VarcharTYpe=>ObCollectionSQLType*/ ObVarcharType, /*VarcharType=>ObMySQLDateType */ ObVarcharType, /*VarcharType=>ObMySQLDateTimeType */ + ObMaxType, /*VarcharTYpe=>ObRoaringBitmapType*/ }, /*CharType*/ @@ -4496,9 +4631,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*CharType=>ObGeometryType*/ ObMaxType, /*CharType=>ObUserDefinedSQLType*/ ObCharType, /*CharType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*CharType=>ObCollectionSQLType*/ ObCharType, /*CharType=>ObMySQLDateType */ ObCharType, /*CharType=>ObMySQLDateTimeType */ + ObMaxType, /*CharType=>ObRoaringBitmapType*/ }, /*HexStringType*/ @@ -4554,9 +4690,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*HexStringType=>ObGeometryType*/ ObMaxType, /*HexStringType=>ObUserDefinedSQLType*/ ObVarcharType, /*HexStringType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*HexStringType=>ObCollectionSQLType*/ ObVarcharType, /*HexStringType=>ObMySQLDateType */ ObVarcharType, /*HexStringType=>ObMySQLDateTimeType */ + ObMaxType, /*HexStringType=>ObRoaringBitmapType*/ }, /*ExtendType*/ @@ -4615,6 +4752,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObCollectionSQLType, /*ExtendType=>ObCollectionSQLType*/ ObMaxType, /*ExtendType=>ObMySQLDateType */ ObMaxType, /*ExtendType=>ObMySQLDateTimeType */ + ObMaxType, /*ExtendType=>ObRoaringBitmapType*/ }, /*UnknownType*/ @@ -4670,9 +4808,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*UnknownType=>ObGeometryType*/ ObMaxType, /*UnknownType=>ObUserDefinedSQLType*/ ObVarcharType, /*UnknownType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*UnknownType=>ObCollectionSQLType*/ ObVarcharType, /*UnknownType=>ObMySQLDateType */ ObVarcharType, /*UnknownType=>ObMySQLDateTimeType */ + ObMaxType, /*UnknownType=>ObRoaringBitmapType*/ }, /*ObTinyTextType*/ { @@ -4727,9 +4866,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObTinyTextType=>ObGeometryType*/ ObMaxType, /*ObTinyTextType=>ObUserDefinedSQLType*/ ObTinyTextType, /*ObTinyTextType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObTinyTextType=>ObCollectionSQLType*/ ObTinyTextType, /*ObTinyTextType=>ObMySQLDateType */ ObTinyTextType, /*ObTinyTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTinyTextType=>ObRoaringBitmapType*/ }, /*ObTextType*/ { @@ -4784,9 +4924,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObTextType=>ObGeometryType*/ ObMaxType, /*ObTextType=>ObUserDefinedSQLType*/ ObTextType, /*ObTextType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObTextType=>ObCollectionSQLType*/ ObTextType, /*ObTextType=>ObMySQLDateType */ ObTextType, /*ObTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTextType=>ObRoaringBitmapType*/ }, /*ObMediumTextType*/ @@ -4842,9 +4983,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObMediumTextType=>ObGeometryType*/ ObMaxType, /*ObMediumTextType=>ObUserDefinedSQLType*/ ObMediumTextType, /*ObMediumTextType=>ObDecimalIntType */ + ObMaxType, /*ObMediumTextType=>ObCollectionSQLType*/ ObMediumTextType, /*ObMediumTextType=>ObMySQLDateType */ ObMediumTextType, /*ObMediumTextType=>ObMySQLDateTimeType */ - ObMaxType, + ObMaxType, /*ObMediumTextType=>ObRoaringBitmapType*/ }, /*ObLongTextType*/ @@ -4900,9 +5042,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObLongTextType=>ObGeometryType*/ ObMaxType, /*ObLongTextType=>ObUserDefinedSQLType*/ ObLongTextType, /*ObLongTextType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObLongTextType=ObCollectionSQLType*/ ObLongTextType, /*ObLongTextType=>ObMySQLDateType */ ObLongTextType, /*ObLongTextType=>ObMySQLDateTimeType */ + ObMaxType, /*ObLongTextType=ObRoaringBitmapType*/ }, /*ObBitType*/ { @@ -4957,9 +5100,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObBitType=>ObGeometryType*/ ObMaxType, /*ObBitType=>ObUserDefinedSQLType*/ ObNumberType, /*ObBitType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObBitType=>ObCollectionSQLType*/ ObVarcharType, /*ObBitType=>ObMySQLDateType */ ObVarcharType, /*ObBitType=>ObMySQLDateTimeType */ + ObMaxType, /*ObBitType=>ObRoaringBitmapType*/ }, /*ObEnumType*/ { @@ -5014,9 +5158,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObEnumType=>ObGeometryType*/ ObMaxType, /*ObEnumType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObEnumType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObEnumType=>ObCollectionSQLType*/ ObVarcharType, /*ObEnumType=>ObMySQLDateType */ ObVarcharType, /*ObEnumType=>ObMySQLDateTimeType */ + ObMaxType, /*ObEnumType=>ObRoaringBitmapType*/ }, /*ObSetType*/ { @@ -5071,9 +5216,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObSetType=>ObGeometryType*/ ObMaxType, /*ObSetType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObSetType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObSetType=>ObCollectionSQLType*/ ObVarcharType, /*ObSetType=>ObMySQLDateType */ ObVarcharType, /*ObSetType=>ObMySQLDateTimeType */ + ObMaxType, /*ObSetType=>ObRoaringBitmapType*/ }, /*ObEnumInnerType*/ { @@ -5128,9 +5274,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObEnumInnerType=>ObGeometryType*/ ObMaxType, /*ObEnumInnerType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObEnumInnerType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObEnumInnerType=>ObCollectionSQLType*/ ObVarcharType, /*ObEnumInnerType=>ObMySQLDateType */ ObVarcharType, /*ObEnumInnerType=>ObMySQLDateTimeType */ + ObMaxType, /*ObEnumInnerType=>bRoaringBitmapType*/ }, /*ObSetInnerType*/ { @@ -5185,9 +5332,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObSetInnerType=>ObGeometryType*/ ObMaxType, /*ObSetInnerType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObSetInnerType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObSetInnerType=>ObCollectionSQLType*/ ObVarcharType, /*ObSetInnerType=>ObMySQLDateType */ ObVarcharType, /*ObSetInnerType=>ObMySQLDateTimeType */ + ObMaxType, /*ObSetInnerType=>ObRoaringBitmapType*/ }, /*ObTimestampTZType*/ { @@ -5242,9 +5390,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTimestampTZType=>ObGeometryType*/ ObMaxType, /*ObTimestampTZType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObTimestampTZType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObTimestampTZType=>ObCollectionSQLType*/ ObTimestampTZType, /*ObTimestampTZType=>ObMySQLDateType */ ObTimestampTZType, /*ObTimestampTZType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTimestampTZType=>ObRoaringBitmapType*/ }, /*ObTimestampLTZType*/ { @@ -5299,9 +5448,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTimestampLTZType=>ObGeometryType*/ ObMaxType, /*ObTimestampLTZType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObTimestampLTZType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObTimestampLTZType=>ObCollectionSQLType*/ ObTimestampLTZType, /*ObTimestampLTZType=>ObMySQLDateType */ ObTimestampLTZType, /*ObTimestampLTZType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTimestampLTZType=>ObRoaringBitmapType*/ }, /*ObTimestampNanoType*/ { @@ -5356,9 +5506,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObTimestampNanoType=>ObGeometryType*/ ObMaxType, /*ObTimestampNanoType=>ObUserDefinedSQLType*/ ObVarcharType, /*ObTimestampNanoType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObTimestampNanoType=>ObCollectionSQLType*/ ObTimestampNanoType, /*ObTimestampNanoType=>ObMySQLDateType */ ObTimestampNanoType, /*ObTimestampNanoType=>ObMySQLDateTimeType */ + ObMaxType, /*ObTimestampNanoType=>ObRoaringBitmapType*/ }, /*ObRawType*/ { @@ -5412,10 +5563,11 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObRawType=>ObJsonType*/ ObMaxType, /*ObRawType=>ObGeometryType*/ ObMaxType, /*ObRawType=>ObUserDefinedSQLType*/ - ObRawType, /* ObRawType=>ObDecimalIntType */ - ObMaxType, + ObRawType, /*ObRawType=>ObDecimalIntType */ + ObMaxType, /*ObRawType=>ObCollectionSQLType*/ ObRawType, /*ObRawType=>ObMySQLDateType */ ObRawType, /*ObRawType=>ObMySQLDateTimeType */ + ObMaxType, /*ObRawType=>ObRoaringBitmapType*/ }, /*ObIntervalYMType*/ { @@ -5470,9 +5622,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObIntervalYMType=>ObGeometryType*/ ObMaxType, /*ObIntervalYMType=>ObUserDefinedSQLType*/ ObIntervalYMType, /* ObIntervalYMType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObIntervalYMType=>ObCollectionSQLType*/ ObIntervalYMType, /*ObIntervalYMType=>ObMySQLDateType */ ObIntervalYMType, /*ObIntervalYMType=>ObMySQLDateTimeType */ + ObMaxType, /*ObIntervalYMType=>ObRoaringBitmapType*/ }, /*ObIntervalDSType*/ { @@ -5527,9 +5680,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObIntervalDSType=>ObGeometryType*/ ObMaxType, /*ObIntervalDSType=>ObUserDefinedSQLType*/ ObIntervalDSType, /* ObIntervalDSType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObIntervalDSType=>ObCollectionSQLType*/ ObIntervalDSType, /*ObIntervalDSType=>ObMySQLDateType */ ObMaxType, /*ObIntervalDSType=>ObMySQLDateTimeType */ + ObMaxType, /*ObIntervalDSType=>ObRoaringBitmapType*/ }, /*ObNumberFloatType*/ @@ -5585,9 +5739,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*NumberFloatType=>ObGeometryType*/ ObMaxType, /*NumberFloatType=>ObUserDefinedSQLType*/ ObNumberType, /*NumberFloatType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*NumberFloatType=>ObCollectionSQLType*/ ObVarcharType, /*NumberFloatType=>ObMySQLDateType */ ObVarcharType, /*NumberFloatType=>ObMySQLDateTimeType */ + ObMaxType, /*NumberFloatType=>ObRoaringBitmapType*/ }, /*ObNVarchar2Type*/ { @@ -5642,9 +5797,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObNVarchar2Type=>ObGeometryType*/ ObMaxType, /*ObNVarchar2Type=>ObUserDefinedSQLType*/ ObNVarchar2Type, /* ObNVarchar2Type=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObNVarchar2Type=>ObCollectionSQLType*/ ObNVarchar2Type, /*ObNVarchar2Type=>ObMySQLDateType */ ObNVarchar2Type, /*ObNVarchar2Type=>ObMySQLDateTimeType */ + ObMaxType, /*ObNVarchar2Type=>ObRoaringBitmapType*/ }, /*ObNCharType*/ { @@ -5699,9 +5855,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObNCharType=>ObGeometryType*/ ObMaxType, /*ObNCharType=>ObUserDefinedSQLType*/ ObNCharType, /* ObNCharType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObNCharType=>ObCollectionSQLType*/ ObNCharType, /*ObNCharType=>ObMySQLDateType */ ObNCharType, /*ObNCharType=>ObMySQLDateTimeType */ + ObMaxType, /*ObNCharType=>ObRoaringBitmapType*/ }, /*ObURowIDType*/ { @@ -5755,10 +5912,11 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObURowIDType=>ObJsonType*/ ObMaxType, /*ObURowIDType=>ObGeometryType*/ ObMaxType, /*ObURowIDType=>ObUserDefinedSQLType*/ - ObMaxType, /* ObURowIDType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObURowIDType=>ObDecimalIntType */ + ObMaxType, /*ObURowIDType=>ObCollectionSQLType*/ ObMaxType, /*ObURowIDType=>ObMySQLDateType */ ObMaxType, /*ObURowIDType=>ObMySQLDateTimeType */ + ObMaxType, /*ObURowIDType=>ObRoaringBitmapType*/ }, /*ObLobType*/ { @@ -5813,9 +5971,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /* ObLobType=>ObGeometryType*/ ObMaxType, /* ObLobType=>ObUserDefinedSQLType*/ ObMaxType, /* ObLobType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /* ObLobType=>ObCollectionSQLType*/ ObMaxType, /*ObLobType=>ObMySQLDateType */ ObMaxType, /*ObLobType=>ObMySQLDateTimeType */ + ObMaxType, /* ObLobType=>ObRoaringBitmapType*/ }, /*ObJsonType*/ { @@ -5870,9 +6029,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObJsonType=>ObGeometryType*/ ObMaxType, /*ObJsonType=>ObUserDefinedSQLType*/ ObJsonType, /* ObJsonType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /*ObJsonType=>ObCollectionSQLType*/ ObJsonType, /*ObJsonType=>ObMySQLDateType */ ObJsonType, /*ObJsonType=>ObMySQLDateTimeType */ + ObMaxType, /*ObJsonType=>ObRoaringBitmapType*/ }, /*ObGeometryType*/ { @@ -5927,9 +6087,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /* ObGeometryType=>ObGeometryType*/ ObMaxType, /* ObGeometryType=>ObUserDefinedSQLType*/ ObGeometryType, /* ObGeometryType=>ObDecimalIntType */ - ObMaxType, + ObMaxType, /* ObGeometryType=>ObCollectionSQLType*/ ObGeometryType, /*ObGeometryType=>ObMySQLDateType */ ObGeometryType, /*ObGeometryType=>ObMySQLDateTimeType */ + ObMaxType, /* ObGeometryType=>ObRoaringBitmapType*/ }, /*ObUserDefinedSQLType*/ { @@ -5983,10 +6144,11 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /* ObUserDefinedSQLType=>ObJsonType*/ ObMaxType, /* ObUserDefinedSQLType=>ObGeometryType*/ ObUserDefinedSQLType, /*ObUserDefinedSQLType*/ - ObMaxType, /* ObDecimalIntType */ - ObMaxType, + ObMaxType, /* ObUserDefinedSQLType=>ObDecimalIntType */ + ObMaxType, /* ObUserDefinedSQLType=>ObCollectionSQLType*/ ObMaxType, /*ObUserDefinedSQLType=>ObMySQLDateType */ ObMaxType, /*ObUserDefinedSQLType=>ObMySQLDateTimeType */ + ObMaxType, /* ObUserDefinedSQLType=>ObRoaringBitmapType*/ }, /*ObDecimalIntType*/ { @@ -6041,9 +6203,10 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObGeometryType, /*ObDecimalIntType=>ObGeometryType*/ ObMaxType, /* ObDecimalIntType=>ObUserDefinedSqlType */ ObNumberType, /*ObDecimalIntType=>ObDecimalIntType */ - ObMaxType, /* ObDecimalIntType=>ObCollectionSQLType */ + ObMaxType, /*ObDecimalIntType=>ObCollectionSQLType */ ObVarcharType, /*ObDecimalIntType=>ObMySQLDateType */ ObVarcharType, /*ObDecimalIntType=>ObMySQLDateTimeType */ + ObMaxType, /*ObDecimalIntType=>ObRoaringBitmapType*/ }, /*ObCollectionSQLType*/ { @@ -6101,6 +6264,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObCollectionSQLType, /* ObCollectionSQLType=>ObCollectionSQLType*/ ObMaxType, /* ObCollectionSQLType=>ObMySQLDateType */ ObMaxType, /* ObCollectionSQLType=>ObMySQLDateTimeType */ + ObMaxType, /* ObCollectionSQLType=>ObRoaringBitmapType*/ }, /*MySQLDateType*/ { @@ -6158,6 +6322,7 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObMySQLDateType=>ObCollectionSQLType*/ ObMySQLDateType, /*ObMySQLDateType=>ObMySQLDateType */ ObMySQLDateTimeType, /*ObMySQLDateType=>ObMySQLDateTimeType */ + ObMaxType, /* ObCollectionSQLType=>ObRoaringBitmapType*/ }, /*MySQLDateTimeType*/ { @@ -6215,6 +6380,65 @@ static constexpr ObObjType MERGE_RESULT_TYPE_ORACLE[ObMaxType][ObMaxType] = { ObMaxType, /*ObMySQLDateTimeType=>ObCollectionSQLType*/ ObMySQLDateTimeType, /*ObMySQLDateTimeType=>ObMySQLDateType */ ObMySQLDateTimeType, /*ObMySQLDateTimeType=>ObMySQLDateTimeType */ + ObMaxType, /* ObCollectionSQLType=>ObRoaringBitmapType*/ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* ObRoaringBitmapType=>NullType */ + ObMaxType, /* ObRoaringBitmapType=>TinyIntType */ + ObMaxType, /* ObRoaringBitmapType=>SmallIntType */ + ObMaxType, /* ObRoaringBitmapType=>MediumIntType */ + ObMaxType, /* ObRoaringBitmapType=>Int32Type */ + ObMaxType, /* ObRoaringBitmapType=>IntType */ + ObMaxType, /* ObRoaringBitmapType=>UTinyIntType */ + ObMaxType, /* ObRoaringBitmapType=>USmallIntType */ + ObMaxType, /* ObRoaringBitmapType=>UMediumIntType */ + ObMaxType, /* ObRoaringBitmapType=>UInt32Type */ + ObMaxType, /* ObRoaringBitmapType=>UIntType */ + ObMaxType, /* ObRoaringBitmapType=>FloatType */ + ObMaxType, /* ObRoaringBitmapType=>DoubleType */ + ObMaxType, /* ObRoaringBitmapType=>UFloatType */ + ObMaxType, /* ObRoaringBitmapType=>UDoubleType */ + ObMaxType, /* ObRoaringBitmapType=>NumberType */ + ObMaxType, /* ObRoaringBitmapType=>UNumberType */ + ObMaxType, /* ObRoaringBitmapType=>DateTimeType */ + ObMaxType, /* ObRoaringBitmapType=>TimestampType */ + ObMaxType, /* ObRoaringBitmapType=>DateType */ + ObMaxType, /* ObRoaringBitmapType=>TimeType */ + ObMaxType, /* ObRoaringBitmapType=>YearType */ + ObMaxType, /* ObRoaringBitmapType=>VarcharType */ + ObMaxType, /* ObRoaringBitmapType=>CharType */ + ObMaxType, /* ObRoaringBitmapType=>HexStringType */ + ObMaxType, /* ObRoaringBitmapType=>ExtendType */ + ObMaxType, /* ObRoaringBitmapType=>UnknownType */ + ObMaxType, /* ObRoaringBitmapType=>ObTinyTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObMediumTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObLongTextType */ + ObMaxType, /* ObRoaringBitmapType=>ObBitType */ + ObMaxType, /* ObRoaringBitmapType=>ObEnumType */ + ObMaxType, /* ObRoaringBitmapType=>ObSetType */ + ObMaxType, /* ObRoaringBitmapType=>ObEnumInnerType */ + ObMaxType, /* ObRoaringBitmapType=>ObSetInnerType */ + ObMaxType, /* ObRoaringBitmapType=>ObTimestampTZType */ + ObMaxType, /* ObRoaringBitmapType=>ObTimestampLTZType */ + ObMaxType, /* ObRoaringBitmapType=>ObTimestampNanoType */ + ObMaxType, /* ObRoaringBitmapType=>ObRawType */ + ObMaxType, /* ObRoaringBitmapType=>ObIntervalYMType */ + ObMaxType, /* ObRoaringBitmapType=>ObIntervalDSType */ + ObMaxType, /* ObRoaringBitmapType=>ObNumberFloatType */ + ObMaxType, /* ObRoaringBitmapType=>ObNVarchar2Type */ + ObMaxType, /* ObRoaringBitmapType=>ObNCharType */ + ObMaxType, /* ObRoaringBitmapType=>ObURowIDType*/ + ObLobType, /* ObRoaringBitmapType=>ObLobType*/ + ObMaxType, /* ObRoaringBitmapType=>ObJsonType*/ + ObMaxType, /* ObRoaringBitmapType=>ObGeometryType*/ + ObMaxType, /* ObRoaringBitmapType=>ObUserDefinedSQLType*/ + ObMaxType, /* ObRoaringBitmapType=>ObDecimalIntType */ + ObMaxType, /* ObRoaringBitmapType=>ObCollectionSQLType */ + ObMaxType, /* ObRoaringBitmapType=>ObMySQLDateType */ + ObMaxType, /* ObRoaringBitmapType=>ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType=>ObRoaringBitmapType*/ }, }; diff --git a/src/sql/engine/expr/ob_expr_mod_result_type.map b/src/sql/engine/expr/ob_expr_mod_result_type.map index b9657e9ca..0ebe670f3 100644 --- a/src/sql/engine/expr/ob_expr_mod_result_type.map +++ b/src/sql/engine/expr/ob_expr_mod_result_type.map @@ -56,6 +56,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyIntType*/ @@ -114,6 +115,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SmallIntType*/ @@ -172,6 +174,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumIntType*/ @@ -230,6 +233,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*Int32Type*/ @@ -288,6 +292,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntType*/ @@ -346,6 +351,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UTinyIntType*/ @@ -404,6 +410,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*USmallIntType*/ @@ -462,6 +469,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UMediumIntType*/ @@ -520,6 +528,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt32Type*/ @@ -578,6 +587,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UIntType*/ @@ -636,6 +646,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*FloatType*/ @@ -694,6 +705,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DoubleType*/ @@ -752,6 +764,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UFloatType*/ @@ -810,6 +823,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUDoubleType, /* ObMySQLDateType */ ObUDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UDoubleType*/ @@ -868,6 +882,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUDoubleType, /* ObMySQLDateType */ ObUDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberType*/ @@ -926,6 +941,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UNumberType*/ @@ -984,6 +1000,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUNumberType, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateTimeType*/ @@ -1042,6 +1059,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimestampType*/ @@ -1100,6 +1118,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateType*/ @@ -1158,6 +1177,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimeType*/ @@ -1216,6 +1236,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*YearType*/ @@ -1274,6 +1295,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*VarcharType*/ @@ -1332,6 +1354,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*CharType*/ @@ -1390,6 +1413,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*HexStringType*/ @@ -1448,6 +1472,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUDoubleType, /* ObMySQLDateType */ ObUDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ExtendType*/ @@ -1506,6 +1531,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UnknownType*/ @@ -1564,6 +1590,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyTextType*/ { @@ -1621,6 +1648,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TextType*/ { @@ -1678,6 +1706,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumTextType*/ { @@ -1735,6 +1764,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*LongTextType*/ { @@ -1792,6 +1822,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*BitType*/ { @@ -1849,6 +1880,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObUInt64Type, /* ObMySQLDateType */ ObUNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumType*/ { @@ -1906,6 +1938,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetType*/ { @@ -1963,6 +1996,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumInnerType*/ { @@ -2020,6 +2054,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetInnerType*/ { @@ -2077,6 +2112,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampTZType*/ @@ -2135,6 +2171,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampLTZType*/ { @@ -2192,6 +2229,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampNanoType*/ { @@ -2249,6 +2287,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObRawType*/ { @@ -2306,6 +2345,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalYMType*/ { @@ -2363,6 +2403,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalDSType*/ { @@ -2420,6 +2461,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNumberFloatType*/ { @@ -2477,6 +2519,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNVarchar2Type*/ { @@ -2534,6 +2577,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObNCharType*/ { @@ -2591,6 +2635,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObURowIDType*/ { @@ -2648,6 +2693,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLobType*/ { @@ -2705,6 +2751,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObJsonType*/ { @@ -2762,6 +2809,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObGeometryType*/ { @@ -2819,6 +2867,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObUserDefinedSQLType*/ { @@ -2876,6 +2925,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObDecimalIntType*/ @@ -2934,6 +2984,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /*ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObCollectionSQLType*/ { @@ -2991,6 +3042,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateType*/ { @@ -3048,6 +3100,7 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateTimeType*/ { @@ -3105,6 +3158,65 @@ static constexpr ObObjType MOD_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UInt64Type */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* ObTinyTextType */ + ObMaxType, /* ObTextType */ + ObMaxType, /* ObMediumTextType */ + ObMaxType, /* ObLongTextType */ + ObMaxType, /* ObBitType */ + ObMaxType, /* ObEnumType */ + ObMaxType, /* ObSetType */ + ObMaxType, /* ObEnumInnerType */ + ObMaxType, /* ObSetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* ObUserDefinedSQLType */ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* ObCollectionSQLType */ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, }; diff --git a/src/sql/engine/expr/ob_expr_neg_result_type.map b/src/sql/engine/expr/ob_expr_neg_result_type.map index 1343f3ee1..a51400d19 100644 --- a/src/sql/engine/expr/ob_expr_neg_result_type.map +++ b/src/sql/engine/expr/ob_expr_neg_result_type.map @@ -54,6 +54,7 @@ static constexpr ObObjType NEG_RESULT_TYPE[ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }; static constexpr ObObjType NEG_RESULT_TYPE_ORACLE[ObMaxType] = @@ -112,6 +113,7 @@ static constexpr ObObjType NEG_RESULT_TYPE_ORACLE[ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }; static_assert(is_array_fully_initialized(NEG_RESULT_TYPE_ORACLE), "NEG_RESULT_TYPE_ORACLE is partially initlized"); diff --git a/src/sql/engine/expr/ob_expr_nvl_promotion.map b/src/sql/engine/expr/ob_expr_nvl_promotion.map index bf7d69f9c..89cd37384 100644 --- a/src/sql/engine/expr/ob_expr_nvl_promotion.map +++ b/src/sql/engine/expr/ob_expr_nvl_promotion.map @@ -31,6 +31,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMySQLDateType, /*mysql date*/ ObMySQLDateTimeType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*int -> XXX*/ @@ -63,6 +64,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*uint -> XXX*/ @@ -95,6 +97,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*float -> XXX*/ @@ -127,6 +130,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*double -> XXX*/ @@ -159,6 +163,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*number -> XXX*/ @@ -191,6 +196,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*datetime -> XXX*/ @@ -223,6 +229,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMySQLDateTimeType, /*mysql date*/ ObMySQLDateTimeType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*date -> XXX*/ @@ -255,6 +262,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMySQLDateType, /*mysql date*/ ObMySQLDateTimeType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*time -> XXX*/ @@ -287,6 +295,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMySQLDateTimeType, /*mysql date*/ ObMySQLDateTimeType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*year -> XXX*/ @@ -319,6 +328,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*string -> XXX*/ @@ -351,6 +361,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*extend -> XXX*/ @@ -383,6 +394,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*unknown -> XXX*/ @@ -415,6 +427,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*text -> XXX*/ @@ -447,6 +460,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObLongTextType, /*mysql date*/ ObLongTextType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*bit -> XXX*/ @@ -479,6 +493,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*EnumSet -> XXX*/ @@ -511,6 +526,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*EnumSetInner -> XXX*/ @@ -543,6 +559,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*OTimestamp -> XXX*/ @@ -575,6 +592,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObTimestampTZType, /*mysql date*/ ObTimestampTZType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Raw -> XXX*/ @@ -607,6 +625,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Interval -> XXX*/ @@ -639,6 +658,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*RowID -> XXX*/ @@ -671,6 +691,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Lob -> XXX*/ @@ -703,6 +724,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Json -> XXX*/ @@ -732,8 +754,10 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Geometry*/ ObMaxType, /*UDT*/ ObJsonType, /*DecimalInt*/ + ObMaxType, /*Collection Sql Type*/ ObJsonType, /*mysql date*/ ObJsonType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Geometry -> XXX*/ @@ -766,6 +790,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*UDT -> XXX*/ @@ -798,6 +823,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*DecimalInt -> XXX*/ @@ -830,6 +856,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObVarcharType, /*mysql date*/ ObVarcharType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Collection Sql Type -> XXX*/ @@ -862,6 +889,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType, /*mysql date*/ ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*mysql date -> XXX*/ @@ -894,6 +922,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMySQLDateType, /*mysql date*/ ObMySQLDateTimeType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*mysql datetime -> XXX*/ @@ -926,6 +955,40 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMySQLDateTimeType, /*mysql date*/ ObMySQLDateTimeType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ + }, + { + /*RoaringBitmap -> XXX*/ + ObMaxType, /*null*/ + ObMaxType, /*int*/ + ObMaxType, /*uint*/ + ObMaxType, /*float*/ + ObMaxType, /*double*/ + ObMaxType, /*number*/ + ObMaxType, /*datetime*/ + ObMaxType, /*date*/ + ObMaxType, /*time*/ + ObMaxType, /*year*/ + ObMaxType, /*string*/ + ObMaxType, /*extend*/ + ObMaxType, /*unknown*/ + ObMaxType, /*text*/ + ObMaxType, /*bit*/ + ObMaxType, /*EnumSet*/ + ObMaxType, /*EnumSetInner*/ + ObMaxType, /*OTimestamp*/ + ObMaxType, /*Raw*/ + ObMaxType, /*Interval*/ + ObMaxType, /*RowID*/ + ObMaxType, /*Lob*/ + ObMaxType, /*Json*/ + ObMaxType, /*Geometry*/ + ObMaxType, /*UDT*/ + ObMaxType, /*DecimalInt*/ + ObMaxType, /*Collection Sql Type*/ + ObMaxType, /*mysql date*/ + ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, }; @@ -963,6 +1026,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObCollectionSQLType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { // treat int as number, because const 1 will be parsed to bigint 1, not number 1 now. @@ -1060,6 +1124,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*double -> XXX*/ @@ -1092,6 +1157,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*number -> XXX*/ @@ -1124,6 +1190,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*datetime -> XXX*/ @@ -1156,6 +1223,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*date -> XXX*/ @@ -1188,6 +1256,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*time -> XXX*/ @@ -1220,6 +1289,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*year -> XXX*/ @@ -1252,6 +1322,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*string -> XXX*/ @@ -1284,6 +1355,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*extend -> XXX*/ @@ -1316,6 +1388,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*unknown -> XXX*/ @@ -1348,6 +1421,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*text -> XXX*/ @@ -1380,6 +1454,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*bit -> XXX*/ @@ -1412,6 +1487,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*EnumSet -> XXX*/ @@ -1444,6 +1520,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*EnumSetInner -> XXX*/ @@ -1476,6 +1553,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*otimestamp-> XXX*/ @@ -1508,6 +1586,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Raw-> XXX*/ @@ -1540,6 +1619,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Interval-> XXX*/ @@ -1572,6 +1652,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*RowID-> XXX*/ @@ -1604,6 +1685,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Lob -> XXX*/ @@ -1636,6 +1718,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Json -> XXX*/ @@ -1668,6 +1751,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*Geometry -> XXX*/ @@ -1700,6 +1784,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*User Defined Type -> XXX*/ @@ -1732,6 +1817,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*DecimalInt -> XXX*/ @@ -1764,6 +1850,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*User Defined Type -> XXX*/ @@ -1796,6 +1883,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*MySQL Date -> XXX*/ @@ -1828,6 +1916,7 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, { /*MySQL DateTime -> XXX*/ @@ -1860,5 +1949,39 @@ static const ObObjType NVL_TYPE_PROMOTION_ORACLE[ObMaxTC][ObMaxTC] = ObMaxType, /*Collection Sql Type*/ ObMaxType,/*mysql date*/ ObMaxType,/*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ + }, + { + /*RoaringBitmap -> XXX*/ + ObMaxType, /*null*/ + ObMaxType, /*int*/ + ObMaxType, /*uint*/ + ObMaxType, /*float*/ + ObMaxType, /*double*/ + ObMaxType, /*number*/ + ObMaxType, /*datetime*/ + ObMaxType, /*date*/ + ObMaxType, /*time*/ + ObMaxType, /*year*/ + ObMaxType, /*string*/ + ObMaxType, /*extend*/ + ObMaxType, /*unknown*/ + ObMaxType, /*text*/ + ObMaxType, /*bit*/ + ObMaxType, /*EnumSet*/ + ObMaxType, /*EnumSetInner*/ + ObMaxType, /*OTimestamp*/ + ObMaxType, /*Raw*/ + ObMaxType, /*Interval*/ + ObMaxType, /*RowID*/ + ObMaxType, /*Lob*/ + ObMaxType, /*Json*/ + ObMaxType, /*Geometry*/ + ObMaxType, /*UDT*/ + ObMaxType, /*DecimalInt*/ + ObMaxType, /*Collection Sql Type*/ + ObMaxType, /*mysql date*/ + ObMaxType, /*mysql datetime*/ + ObMaxType, /*RoaringBitmap*/ }, }; diff --git a/src/sql/engine/expr/ob_expr_operator.cpp b/src/sql/engine/expr/ob_expr_operator.cpp index 9d54f6b6a..92a57b412 100644 --- a/src/sql/engine/expr/ob_expr_operator.cpp +++ b/src/sql/engine/expr/ob_expr_operator.cpp @@ -1030,6 +1030,8 @@ int ObExprOperator::is_same_kind_type_for_case(const ObExprResType &type1, const match = type2.is_geometry(); } else if (type1.is_user_defined_sql_type()) { match = type2.is_user_defined_sql_type() && type1.get_udt_id() == type2.get_udt_id(); + } else if (type1.is_roaringbitmap()) { + match = type2.is_roaringbitmap(); } } return ret; @@ -1581,6 +1583,7 @@ ObObjType ObExprOperator::enumset_calc_types_[ObMaxTC] = ObNullType, /*COLLECTION*/ ObVarcharType, /*ObMySQLDateTC*/ ObVarcharType, /*ObMySQLDateTimeTC*/ + ObVarcharType, /*ObRoaringBitmapTC*/ }; //////////////////////////////////////////////////////////////// @@ -2089,6 +2092,15 @@ int ObExprOperator::calc_cmp_type2(ObExprResType &type, || type_ == T_OP_NOT_IN)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("Incorrect cmp type with geometry arguments", K(type1), K(type2), K(type_), K(ret)); + } else if ((type1.is_roaringbitmap() || type2.is_roaringbitmap()) + && !(type_ == T_OP_EQ + || type_ == T_OP_NE + || type_ == T_OP_NSEQ + || type_ == T_OP_SQ_EQ + || type_ == T_OP_SQ_NE + || type_ == T_OP_SQ_NSEQ)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("Incorrect cmp type with geometry arguments", K(type1), K(type2), K(type_), K(ret)); } else if (is_oracle_mode() && (type1.is_json() || type2.is_json()) && (type_ >= T_OP_EQ && type_ <= T_OP_NE)) { diff --git a/src/sql/engine/expr/ob_expr_operator_factory.cpp b/src/sql/engine/expr/ob_expr_operator_factory.cpp index 48d70d9c3..3e2b84acb 100644 --- a/src/sql/engine/expr/ob_expr_operator_factory.cpp +++ b/src/sql/engine/expr/ob_expr_operator_factory.cpp @@ -441,6 +441,15 @@ #include "sql/engine/expr/ob_expr_priv_st_asmvtgeom.h" #include "sql/engine/expr/ob_expr_priv_st_makevalid.h" #include "sql/engine/expr/ob_expr_inner_table_option_printer.h" +#include "sql/engine/expr/ob_expr_rb_build_empty.h" +#include "sql/engine/expr/ob_expr_rb_is_empty.h" +#include "sql/engine/expr/ob_expr_rb_build_varbinary.h" +#include "sql/engine/expr/ob_expr_rb_to_varbinary.h" +#include "sql/engine/expr/ob_expr_rb_cardinality.h" +#include "sql/engine/expr/ob_expr_rb_calc_cardinality.h" +#include "sql/engine/expr/ob_expr_rb_calc.h" +#include "sql/engine/expr/ob_expr_rb_to_string.h" +#include "sql/engine/expr/ob_expr_rb_from_string.h" #include "sql/engine/expr/ob_expr_lock_func.h" @@ -1083,6 +1092,27 @@ void ObExprOperatorFactory::register_expr_operators() REG_OP(ObExprCurrentRole); REG_OP(ObExprInnerTableOptionPrinter); REG_OP(ObExprInnerTableSequenceGetter); + REG_OP(ObExprRbBuildEmpty); + REG_OP(ObExprRbIsEmpty); + REG_OP(ObExprRbBuildVarbinary); + REG_OP(ObExprRbToVarbinary); + REG_OP(ObExprRbCardinality); + REG_OP(ObExprRbAndCardinality); + REG_OP(ObExprRbOrCardinality); + REG_OP(ObExprRbXorCardinality); + REG_OP(ObExprRbAndnotCardinality); + REG_OP(ObExprRbAndNull2emptyCardinality); + REG_OP(ObExprRbOrNull2emptyCardinality); + REG_OP(ObExprRbAndnotNull2emptyCardinality); + REG_OP(ObExprRbAnd); + REG_OP(ObExprRbOr); + REG_OP(ObExprRbXor); + REG_OP(ObExprRbAndnot); + REG_OP(ObExprRbAndNull2empty); + REG_OP(ObExprRbOrNull2empty); + REG_OP(ObExprRbAndnotNull2empty); + REG_OP(ObExprRbToString); + REG_OP(ObExprRbFromString); }(); // 注册oracle系统函数 REG_OP_ORCL(ObExprSysConnectByPath); diff --git a/src/sql/engine/expr/ob_expr_output_pack.cpp b/src/sql/engine/expr/ob_expr_output_pack.cpp index d3dcdfff1..b33acfda3 100644 --- a/src/sql/engine/expr/ob_expr_output_pack.cpp +++ b/src/sql/engine/expr/ob_expr_output_pack.cpp @@ -525,7 +525,7 @@ int ObExprOutputPack::process_lob_locator_results(common::ObObj& value, // 3. if client does not support use_lob_locator ,,return full lob data without locator header bool is_use_lob_locator = my_session.is_client_use_lob_locator(); bool is_support_outrow_locator_v2 = my_session.is_client_support_lob_locatorv2(); - if (!(value.is_lob() || value.is_json() || value.is_geometry() ||value.is_lob_locator())) { + if (!(value.is_lob() || value.is_json() || value.is_geometry() || value.is_roaringbitmap() || value.is_lob_locator())) { // not lob types, do nothing } else if (is_use_lob_locator && value.is_lob() && lib::is_oracle_mode()) { // if does not have extern header, mock one @@ -593,6 +593,8 @@ int ObExprOutputPack::process_lob_locator_results(common::ObObj& value, dst_type = ObJsonType; } else if (value.is_geometry()) { dst_type = ObGeometryType; + } else if (value.is_roaringbitmap()) { + dst_type = ObRoaringBitmapType; } // remove has lob header flag value.set_lob_value(dst_type, data.ptr(), static_cast(data.length())); @@ -683,7 +685,7 @@ int ObExprOutputPack::try_encode_row(const ObExpr &expr, ObEvalCtx &ctx, LOG_WARN("convert text obj charset failed", K(ret)); } if (OB_FAIL(ret)) { - } else if ((obj.is_lob() || obj.is_lob_locator() || obj.is_json() || obj.is_geometry()) + } else if ((obj.is_lob() || obj.is_lob_locator() || obj.is_json() || obj.is_geometry() || obj.is_roaringbitmap()) && OB_FAIL(process_lob_locator_results(obj, alloc, *session, ctx.exec_ctx_))) { LOG_WARN("convert lob locator to longtext failed", K(ret)); } else if ((obj.is_user_defined_sql_type() || obj.is_collection_sql_type() || obj.is_geometry()) diff --git a/src/sql/engine/expr/ob_expr_rb_build_empty.cpp b/src/sql/engine/expr/ob_expr_rb_build_empty.cpp new file mode 100644 index 000000000..2f0d18ecb --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_build_empty.cpp @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_build_empty. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_build_empty.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "sql/engine/expr/ob_expr_lob_utils.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbBuildEmpty::ObExprRbBuildEmpty(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_BUILD_EMPTY, N_RB_BUILD_EMPTY, 0, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbBuildEmpty::~ObExprRbBuildEmpty() +{ +} + + +int ObExprRbBuildEmpty::calc_result_type0(ObExprResType &type, ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + type.set_roaringbitmap(); + type.set_length((ObAccuracy::DDL_DEFAULT_ACCURACY[ObRoaringBitmapType]).get_length()); + return OB_SUCCESS; +} + +int ObExprRbBuildEmpty::eval_rb_build_empty(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res) +{ + int ret = OB_SUCCESS; + + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + + ObString rb_bin; + ObRoaringBitmap *rb_empty; + if (OB_ISNULL(rb_empty = OB_NEWx(ObRoaringBitmap, &tmp_allocator, (&tmp_allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(ObRbUtils::rb_serialize(tmp_allocator, rb_bin, rb_empty))) { + LOG_WARN("failed to serialize empty roaringbitmap", K(ret)); + } else if (OB_FAIL(ObRbExprHelper::pack_rb_res(expr, ctx, res, rb_bin))) { + LOG_WARN("fail to pack roaringbitmap res", K(ret)); + } + ObRbUtils::rb_destroy(rb_empty); + return ret; +} + +int ObExprRbBuildEmpty::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbBuildEmpty::eval_rb_build_empty; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_build_empty.h b/src/sql/engine/expr/ob_expr_rb_build_empty.h new file mode 100644 index 000000000..f7c4a1e0b --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_build_empty.h @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_build_empty. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_BUILD_EMPTY_ +#define OCEANBASE_SQL_OB_EXPR_RB_BUILD_EMPTY_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbBuildEmpty : public ObFuncExprOperator +{ +public: + explicit ObExprRbBuildEmpty(common::ObIAllocator &alloc); + virtual ~ObExprRbBuildEmpty(); + virtual int calc_result_type0(ObExprResType &type, common::ObExprTypeCtx &type_ctx) const; + + static int eval_rb_build_empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbBuildEmpty); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_BUILD_EMPTY_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_build_varbinary.cpp b/src/sql/engine/expr/ob_expr_rb_build_varbinary.cpp new file mode 100644 index 000000000..eb3c48d29 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_build_varbinary.cpp @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_build_varbinary. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_build_varbinary.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "sql/engine/expr/ob_expr_lob_utils.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbBuildVarbinary::ObExprRbBuildVarbinary(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_BUILD_VARBINARY, N_RB_BUILD_VARBINARY, 1, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbBuildVarbinary::~ObExprRbBuildVarbinary() +{ +} + +int ObExprRbBuildVarbinary::calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + int ret = OB_SUCCESS; + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (type1.is_string_type()) { + type1.set_calc_type(ObLongTextType); + type1.set_collation_level(common::CS_LEVEL_IMPLICIT); + type1.set_collation_type(CS_TYPE_BINARY); + } else { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid type provided.", K(ret), K(type1.get_type())); + } + + if (OB_SUCC(ret)) { + type.set_roaringbitmap(); + type.set_length((ObAccuracy::DDL_DEFAULT_ACCURACY[ObRoaringBitmapType]).get_length()); + } + return ret; +} + +int ObExprRbBuildVarbinary::eval_rb_build_varbinary(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res) +{ + int ret = OB_SUCCESS; + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObDatum *datum = NULL; + bool is_null_result = false; + ObString rb_bin; + + // get roaring string + if (OB_FAIL(expr.args_[0]->eval(ctx, datum))) { + LOG_WARN("failed to eval argument", K(ret)); + } else if (datum->is_null()) { + is_null_result = true; + } else { + rb_bin = datum->get_string(); + ObRbBinType bin_type; + if (OB_FAIL(ObTextStringHelper::read_real_string_data(tmp_allocator, *datum, + expr.args_[0]->datum_meta_, expr.args_[0]->obj_meta_.has_lob_header(), rb_bin))) { + LOG_WARN("fail to get real string data", K(ret), K(rb_bin)); + } else if (OB_FAIL(ObRbUtils::check_get_bin_type(rb_bin, bin_type))) { + LOG_WARN("invalid roaringbitmap binary", K(ret), K(rb_bin)); + } + } + if (OB_FAIL(ret)) { + } else if (is_null_result) { + res.set_null(); + } else if (OB_FAIL(ObRbExprHelper::pack_rb_res(expr, ctx, res, rb_bin))) { + LOG_WARN("fail to pack roaringbitmap res", K(ret)); + } + return ret; +} + +int ObExprRbBuildVarbinary::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbBuildVarbinary::eval_rb_build_varbinary; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_build_varbinary.h b/src/sql/engine/expr/ob_expr_rb_build_varbinary.h new file mode 100644 index 000000000..e6546b967 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_build_varbinary.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_build_varbinary. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_BUILD_VARBINARY_ +#define OCEANBASE_SQL_OB_EXPR_RB_BUILD_VARBINARY_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbBuildVarbinary : public ObFuncExprOperator +{ +public: + explicit ObExprRbBuildVarbinary(common::ObIAllocator &alloc); + virtual ~ObExprRbBuildVarbinary(); + virtual int calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_build_varbinary(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbBuildVarbinary); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_BUILD_VARBINARY_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_calc.cpp b/src/sql/engine/expr/ob_expr_rb_calc.cpp new file mode 100644 index 000000000..71f2495ea --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_calc.cpp @@ -0,0 +1,289 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_and, rb_or, rb_xor, rb_andnot, + * rb_and_null2empty,rb_or_null2empty, rb_andnot_null2empty. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_calc.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbCalc::ObExprRbCalc(common::ObIAllocator &alloc, ObExprOperatorType type, const char *name) + : ObFuncExprOperator(alloc, type, name, 2, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} +ObExprRbCalc::~ObExprRbCalc() +{ +} + +int ObExprRbCalc::calc_result_type2(ObExprResType &type, + ObExprResType &type1, + ObExprResType &type2, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + INIT_SUCC(ret); + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (!(type1.is_roaringbitmap() || type1.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid left roaringbitmap data type provided.", K(ret), K(type1.get_type()), K(type1.get_collation_type())); + } + if (OB_FAIL(ret)) { + } else if (ob_is_null(type2.get_type())) { + // do nothing + } else if (!(type2.is_roaringbitmap() || type2.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid right roaringbitmap data type provided.", K(ret), K(type2.get_type()), K(type2.get_collation_type())); + } + if (OB_SUCC(ret)) { + type.set_roaringbitmap(); + type.set_length((ObAccuracy::DDL_DEFAULT_ACCURACY[ObRoaringBitmapType]).get_length()); + } + return ret; +} + +int ObExprRbCalc::eval_rb_calc(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res, ObRbOperation op, bool is_null2empty) +{ + INIT_SUCC(ret); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObExpr *rb1_arg = expr.args_[0]; + ObExpr *rb2_arg = expr.args_[1]; + bool is_rb1_null = false; + bool is_rb2_null = false; + bool is_res_null = false; + ObRoaringBitmap *rb1 = nullptr; + ObRoaringBitmap *rb2 = nullptr; + ObString rb_res; + if (OB_FAIL(ObRbExprHelper::get_input_roaringbitmap(ctx, rb1_arg, rb1, is_rb1_null))) { + LOG_WARN("failed to get left input roaringbitmap", K(ret)); + } else if (is_rb1_null && !is_null2empty) { + is_res_null = true; + } else if (is_rb1_null && is_null2empty + && OB_ISNULL(rb1 = OB_NEWx(ObRoaringBitmap, &tmp_allocator, (&tmp_allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(ObRbExprHelper::get_input_roaringbitmap(ctx, rb2_arg, rb2, is_rb2_null))) { + LOG_WARN("failed to get right input roaringbitmap", K(ret)); + } else if (is_rb2_null && !is_null2empty) { + is_res_null = true; + } else if (is_rb2_null && is_null2empty + && OB_ISNULL(rb2 = OB_NEWx(ObRoaringBitmap, &tmp_allocator, (&tmp_allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(rb1->value_calc(rb2, op))) { + LOG_WARN("failed to calcutlate roaringbitmap value_and", K(ret)); + } + + if (OB_FAIL(ret)) { + } else if (is_res_null) { + res.set_null(); + } else if (OB_FAIL(ObRbUtils::rb_serialize(tmp_allocator, rb_res, rb1))) { + LOG_WARN("failed to serialize roaringbitmap", K(ret)); + } else if (OB_FAIL(ObRbExprHelper::pack_rb_res(expr, ctx, res, rb_res))) { + LOG_WARN("fail to pack roaringbitmap res", K(ret)); + } + ObRbUtils::rb_destroy(rb1); + ObRbUtils::rb_destroy(rb2); + return ret; +} + +ObExprRbAnd::ObExprRbAnd(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_AND, N_RB_AND) +{ +} +ObExprRbAnd::~ObExprRbAnd() +{ +} +int ObExprRbAnd::eval_rb_and(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::AND))) { + LOG_WARN("failed to eval roaringbitmap and calculation", K(ret)); + } + return ret; +} +int ObExprRbAnd::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAnd::eval_rb_and; + return OB_SUCCESS; +} + +ObExprRbOr::ObExprRbOr(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_OR, N_RB_OR) +{ +} +ObExprRbOr::~ObExprRbOr() +{ +} +int ObExprRbOr::eval_rb_or(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::OR))) { + LOG_WARN("failed to eval roaringbitmap or calculation", K(ret)); + } + return ret; +} +int ObExprRbOr::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbOr::eval_rb_or; + return OB_SUCCESS; +} + +ObExprRbXor::ObExprRbXor(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_XOR, N_RB_XOR) +{ +} +ObExprRbXor::~ObExprRbXor() +{ +} +int ObExprRbXor::eval_rb_xor(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::XOR))) { + LOG_WARN("failed to eval roaringbitmap xor calculation", K(ret)); + } + return ret; +} +int ObExprRbXor::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbXor::eval_rb_xor; + return OB_SUCCESS; +} + +ObExprRbAndnot::ObExprRbAndnot(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_ANDNOT, N_RB_ANDNOT) +{ +} +ObExprRbAndnot::~ObExprRbAndnot() +{ +} +int ObExprRbAndnot::eval_rb_andnot(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::ANDNOT))) { + LOG_WARN("failed to eval roaringbitmap andnot calculation", K(ret)); + } + return ret; +} +int ObExprRbAndnot::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndnot::eval_rb_andnot; + return OB_SUCCESS; +} + +ObExprRbAndNull2empty::ObExprRbAndNull2empty(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_AND_NULL2EMPTY, N_RB_AND_NULL2EMPTY) +{ +} +ObExprRbAndNull2empty::~ObExprRbAndNull2empty() +{ +} +int ObExprRbAndNull2empty::eval_rb_and_null2empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::AND, true))) { + LOG_WARN("failed to eval roaringbitmap and calculation", K(ret)); + } + return ret; +} +int ObExprRbAndNull2empty::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndNull2empty::eval_rb_and_null2empty; + return OB_SUCCESS; +} + +ObExprRbOrNull2empty::ObExprRbOrNull2empty(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_OR_NULL2EMPTY, N_RB_OR_NULL2EMPTY) +{ +} +ObExprRbOrNull2empty::~ObExprRbOrNull2empty() +{ +} +int ObExprRbOrNull2empty::eval_rb_or_null2empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::OR, true))) { + LOG_WARN("failed to eval roaringbitmap or calculation", K(ret)); + } + return ret; +} +int ObExprRbOrNull2empty::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbOrNull2empty::eval_rb_or_null2empty; + return OB_SUCCESS; +} + +ObExprRbAndnotNull2empty::ObExprRbAndnotNull2empty(common::ObIAllocator &alloc) + : ObExprRbCalc(alloc, T_FUN_SYS_RB_ANDNOT_NULL2EMPTY, N_RB_ANDNOT_NULL2EMPTY) +{ +} +ObExprRbAndnotNull2empty::~ObExprRbAndnotNull2empty() +{ +} +int ObExprRbAndnotNull2empty::eval_rb_andnot_null2empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc(expr, ctx, res, ObRbOperation::ANDNOT, true))) { + LOG_WARN("failed to eval roaringbitmap andnot calculation", K(ret)); + } + return ret; +} +int ObExprRbAndnotNull2empty::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndnotNull2empty::eval_rb_andnot_null2empty; + return OB_SUCCESS; +} + + + + + + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_calc.h b/src/sql/engine/expr/ob_expr_rb_calc.h new file mode 100644 index 000000000..70e8d73de --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_calc.h @@ -0,0 +1,138 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_and, rb_or, rb_xor, rb_andnot, + * rb_and_null2empty,rb_or_null2empty, rb_andnot_null2empty. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_CALC_ +#define OCEANBASE_SQL_OB_EXPR_RB_CALC_ + +#include "sql/engine/expr/ob_expr_operator.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbCalc : public ObFuncExprOperator +{ +public: + explicit ObExprRbCalc(common::ObIAllocator &alloc, ObExprOperatorType type, const char *name); + virtual ~ObExprRbCalc(); + virtual int calc_result_type2(ObExprResType &type, + ObExprResType &type1, + ObExprResType &type2, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_calc(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res, + ObRbOperation op, + bool is_null2empty = false); +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbCalc); +}; + +class ObExprRbAnd : public ObExprRbCalc +{ +public: + explicit ObExprRbAnd(common::ObIAllocator &alloc); + virtual ~ObExprRbAnd(); + static int eval_rb_and(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAnd); +}; + +class ObExprRbOr : public ObExprRbCalc +{ +public: + explicit ObExprRbOr(common::ObIAllocator &alloc); + virtual ~ObExprRbOr(); + static int eval_rb_or(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbOr); +}; + +class ObExprRbXor : public ObExprRbCalc +{ +public: + explicit ObExprRbXor(common::ObIAllocator &alloc); + virtual ~ObExprRbXor(); + static int eval_rb_xor(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbXor); +}; + +class ObExprRbAndnot : public ObExprRbCalc +{ +public: + explicit ObExprRbAndnot(common::ObIAllocator &alloc); + virtual ~ObExprRbAndnot(); + static int eval_rb_andnot(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndnot); +}; + +class ObExprRbAndNull2empty : public ObExprRbCalc +{ +public: + explicit ObExprRbAndNull2empty(common::ObIAllocator &alloc); + virtual ~ObExprRbAndNull2empty(); + static int eval_rb_and_null2empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndNull2empty); +}; + +class ObExprRbOrNull2empty : public ObExprRbCalc +{ +public: + explicit ObExprRbOrNull2empty(common::ObIAllocator &alloc); + virtual ~ObExprRbOrNull2empty(); + static int eval_rb_or_null2empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbOrNull2empty); +}; + +class ObExprRbAndnotNull2empty : public ObExprRbCalc +{ +public: + explicit ObExprRbAndnotNull2empty(common::ObIAllocator &alloc); + virtual ~ObExprRbAndnotNull2empty(); + static int eval_rb_andnot_null2empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndnotNull2empty); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_CALC_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_calc_cardinality.cpp b/src/sql/engine/expr/ob_expr_rb_calc_cardinality.cpp new file mode 100644 index 000000000..dfb1734f3 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_calc_cardinality.cpp @@ -0,0 +1,282 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_and_cardinality, rb_or_cardinality, rb_xor_cardinality, + * rb_andnot_cardinality, rb_and_null2empty_cardinality, rb_or_null2empty_cardinality, + * rb_andnot_null2empty_cardinality. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_calc_cardinality.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" + + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbCalcCardinality::ObExprRbCalcCardinality(common::ObIAllocator &alloc, ObExprOperatorType type, const char *name) + : ObFuncExprOperator(alloc, type, name, 2, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} +ObExprRbCalcCardinality::~ObExprRbCalcCardinality() +{ +} +int ObExprRbCalcCardinality::calc_result_type2(ObExprResType &type, + ObExprResType &type1, + ObExprResType &type2, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + INIT_SUCC(ret); + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (!(type1.is_roaringbitmap() || type1.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid left roaringbitmap data type provided.", K(ret), K(type1.get_type()), K(type1.get_collation_type())); + } + if (OB_FAIL(ret)) { + } else if (ob_is_null(type2.get_type())) { + // do nothing + } else if (!(type2.is_roaringbitmap() || type2.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid right roaringbitmap data type provided.", K(ret), K(type2.get_type()), K(type2.get_collation_type())); + } + if (OB_SUCC(ret)) { + type.set_uint64(); + type.set_scale(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObUInt64Type].scale_); + type.set_precision(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObUInt64Type].precision_); + } + return ret; +} +int ObExprRbCalcCardinality::eval_rb_calc_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res, ObRbOperation op, bool is_null2empty) +{ + INIT_SUCC(ret); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObExpr *rb1_arg = expr.args_[0]; + ObExpr *rb2_arg = expr.args_[1]; + bool is_rb1_null = false; + bool is_rb2_null = false; + bool is_res_null = false; + ObRoaringBitmap *rb1 = nullptr; + ObRoaringBitmap *rb2 = nullptr; + uint64_t cardinality = 0; + if (OB_FAIL(ObRbExprHelper::get_input_roaringbitmap(ctx, rb1_arg, rb1, is_rb1_null))) { + LOG_WARN("failed to get left input roaringbitmap", K(ret)); + } else if (is_rb1_null && !is_null2empty) { + is_res_null = true; + } else if (is_rb1_null && is_null2empty + && OB_ISNULL(rb1 = OB_NEWx(ObRoaringBitmap, &tmp_allocator, (&tmp_allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } else if (OB_FAIL(ObRbExprHelper::get_input_roaringbitmap(ctx, rb2_arg, rb2, is_rb2_null))) { + LOG_WARN("failed to get right input roaringbitmap", K(ret)); + } else if (is_rb2_null && !is_null2empty) { + is_res_null = true; + } else if (is_rb2_null && is_null2empty + && OB_ISNULL(rb2 = OB_NEWx(ObRoaringBitmap, &tmp_allocator, (&tmp_allocator)))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("failed to create alloc memory to roaringbitmap", K(ret)); + } + + if (OB_FAIL(ret)) { + } else if (is_res_null) { + res.set_null(); + } else { + ObRbUtils::calc_cardinality(rb1, rb2, cardinality, op); + res.set_uint(cardinality); + } + ObRbUtils::rb_destroy(rb1); + ObRbUtils::rb_destroy(rb2); + return ret; +} + +ObExprRbAndCardinality::ObExprRbAndCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_AND_CARDINALITY, N_RB_AND_CARDINALITY) +{ +} +ObExprRbAndCardinality::~ObExprRbAndCardinality() +{ +} +int ObExprRbAndCardinality::eval_rb_and_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::AND))) { + LOG_WARN("failed to eval roaringbitmap and cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbAndCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndCardinality::eval_rb_and_cardinality; + return OB_SUCCESS; +} + +ObExprRbOrCardinality::ObExprRbOrCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_OR_CARDINALITY, N_RB_OR_CARDINALITY) +{ +} +ObExprRbOrCardinality::~ObExprRbOrCardinality() +{ +} +int ObExprRbOrCardinality::eval_rb_or_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::OR))) { + LOG_WARN("failed to eval roaringbitmap or cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbOrCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbOrCardinality::eval_rb_or_cardinality; + return OB_SUCCESS; +} + +ObExprRbXorCardinality::ObExprRbXorCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_XOR_CARDINALITY, N_RB_XOR_CARDINALITY) +{ +} +ObExprRbXorCardinality::~ObExprRbXorCardinality() +{ +} +int ObExprRbXorCardinality::eval_rb_xor_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::XOR))) { + LOG_WARN("failed to eval roaringbitmap xor cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbXorCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbXorCardinality::eval_rb_xor_cardinality; + return OB_SUCCESS; +} + +ObExprRbAndnotCardinality::ObExprRbAndnotCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_ANDNOT_CARDINALITY, N_RB_ANDNOT_CARDINALITY) +{ +} +ObExprRbAndnotCardinality::~ObExprRbAndnotCardinality() +{ +} +int ObExprRbAndnotCardinality::eval_rb_andnot_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::ANDNOT))) { + LOG_WARN("failed to eval roaringbitmap andnot cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbAndnotCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndnotCardinality::eval_rb_andnot_cardinality; + return OB_SUCCESS; +} + +ObExprRbAndNull2emptyCardinality::ObExprRbAndNull2emptyCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_AND_NULL2EMPTY_CARDINALITY, N_RB_AND_NULL2EMPTY_CARDINALITY) +{ +} +ObExprRbAndNull2emptyCardinality::~ObExprRbAndNull2emptyCardinality() +{ +} +int ObExprRbAndNull2emptyCardinality::eval_rb_and_null2empty_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::AND, true))) { + LOG_WARN("failed to eval roaringbitmap and cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbAndNull2emptyCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndNull2emptyCardinality::eval_rb_and_null2empty_cardinality; + return OB_SUCCESS; +} + +ObExprRbOrNull2emptyCardinality::ObExprRbOrNull2emptyCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_OR_NULL2EMPTY_CARDINALITY, N_RB_OR_NULL2EMPTY_CARDINALITY) +{ +} +ObExprRbOrNull2emptyCardinality::~ObExprRbOrNull2emptyCardinality() +{ +} +int ObExprRbOrNull2emptyCardinality::eval_rb_or_null2empty_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::OR, true))) { + LOG_WARN("failed to eval roaringbitmap or cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbOrNull2emptyCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbOrNull2emptyCardinality::eval_rb_or_null2empty_cardinality; + return OB_SUCCESS; +} + +ObExprRbAndnotNull2emptyCardinality::ObExprRbAndnotNull2emptyCardinality(common::ObIAllocator &alloc) + : ObExprRbCalcCardinality(alloc, T_FUN_SYS_RB_ANDNOT_NULL2EMPTY_CARDINALITY, N_RB_ANDNOT_NULL2EMPTY_CARDINALITY) +{ +} +ObExprRbAndnotNull2emptyCardinality::~ObExprRbAndnotNull2emptyCardinality() +{ +} +int ObExprRbAndnotNull2emptyCardinality::eval_rb_andnot_null2empty_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(eval_rb_calc_cardinality(expr, ctx, res, ObRbOperation::ANDNOT, true))) { + LOG_WARN("failed to eval roaringbitmap andnot cardinality calculation", K(ret)); + } + return ret; +} +int ObExprRbAndnotNull2emptyCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbAndnotNull2emptyCardinality::eval_rb_andnot_null2empty_cardinality; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_calc_cardinality.h b/src/sql/engine/expr/ob_expr_rb_calc_cardinality.h new file mode 100644 index 000000000..1d1c15cf2 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_calc_cardinality.h @@ -0,0 +1,139 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_and_cardinality, rb_or_cardinality, rb_xor_cardinality, + * rb_andnot_cardinality, rb_and_null2empty_cardinality, rb_or_null2empty_cardinality, + * rb_andnot_null2empty_cardinality. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_CALC_CARDINALITY_ +#define OCEANBASE_SQL_OB_EXPR_RB_CALC_CARDINALITY_ + +#include "sql/engine/expr/ob_expr_operator.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbCalcCardinality : public ObFuncExprOperator +{ +public: + explicit ObExprRbCalcCardinality(common::ObIAllocator &alloc, ObExprOperatorType type, const char *name); + virtual ~ObExprRbCalcCardinality(); + virtual int calc_result_type2(ObExprResType &type, + ObExprResType &type1, + ObExprResType &type2, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_calc_cardinality(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res, + ObRbOperation op, + bool is_null2empty = false); +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbCalcCardinality); +}; + +class ObExprRbAndCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbAndCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbAndCardinality(); + static int eval_rb_and_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndCardinality); +}; + +class ObExprRbOrCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbOrCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbOrCardinality(); + static int eval_rb_or_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbOrCardinality); +}; + +class ObExprRbXorCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbXorCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbXorCardinality(); + static int eval_rb_xor_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbXorCardinality); +}; + +class ObExprRbAndnotCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbAndnotCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbAndnotCardinality(); + static int eval_rb_andnot_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndnotCardinality); +}; + +class ObExprRbAndNull2emptyCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbAndNull2emptyCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbAndNull2emptyCardinality(); + static int eval_rb_and_null2empty_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndNull2emptyCardinality); +}; + +class ObExprRbOrNull2emptyCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbOrNull2emptyCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbOrNull2emptyCardinality(); + static int eval_rb_or_null2empty_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbOrNull2emptyCardinality); +}; + +class ObExprRbAndnotNull2emptyCardinality : public ObExprRbCalcCardinality +{ +public: + explicit ObExprRbAndnotNull2emptyCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbAndnotNull2emptyCardinality(); + static int eval_rb_andnot_null2empty_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbAndnotNull2emptyCardinality); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_CALC_CARDINALITY_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_cardinality.cpp b/src/sql/engine/expr/ob_expr_rb_cardinality.cpp new file mode 100644 index 000000000..8654be87b --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_cardinality.cpp @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_cardinality. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_cardinality.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "lib/roaringbitmap/ob_rb_bin.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbCardinality::ObExprRbCardinality(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_CARDINALITY, N_RB_CARDINALITY, 1, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbCardinality::~ObExprRbCardinality() +{ +} + +int ObExprRbCardinality::calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + INIT_SUCC(ret); + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (!(type1.is_roaringbitmap() || type1.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid roaringbitmap data type provided.", K(ret), K(type1.get_type()), K(type1.get_collation_type())); + } + if (OB_SUCC(ret)) { + type.set_uint64(); + type.set_scale(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObUInt64Type].scale_); + type.set_precision(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObUInt64Type].precision_); + } + return ret; +} + +int ObExprRbCardinality::eval_rb_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + INIT_SUCC(ret); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObExpr *rb_arg = expr.args_[0]; + bool is_rb_null = false; + ObString rb_bin; + uint64_t cardinality = 0; + if (OB_FAIL(ObRbExprHelper::get_input_roaringbitmap_bin(ctx, rb_arg, rb_bin, is_rb_null))) { + LOG_WARN("fail to get input roaringbitmap", K(ret)); + } else if (is_rb_null || rb_bin == nullptr) { + res.set_null(); + } else if (OB_FAIL(ObRbUtils::get_cardinality(tmp_allocator, rb_bin, cardinality))){ + LOG_WARN("failed to get cardinality from roaringbitmap binary", K(ret)); + } else { + res.set_uint(cardinality); + } + return ret; +} + +int ObExprRbCardinality::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbCardinality::eval_rb_cardinality; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_cardinality.h b/src/sql/engine/expr/ob_expr_rb_cardinality.h new file mode 100644 index 000000000..867292489 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_cardinality.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_cardinality. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_CARDINALITY_ +#define OCEANBASE_SQL_OB_EXPR_RB_CARDINALITY_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbCardinality : public ObFuncExprOperator +{ +public: + explicit ObExprRbCardinality(common::ObIAllocator &alloc); + virtual ~ObExprRbCardinality(); + virtual int calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_cardinality(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbCardinality); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_CARDINALITY_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_from_string.cpp b/src/sql/engine/expr/ob_expr_rb_from_string.cpp new file mode 100644 index 000000000..ba85617c8 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_from_string.cpp @@ -0,0 +1,113 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_from_string. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_from_string.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "sql/engine/expr/ob_expr_lob_utils.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbFromString::ObExprRbFromString(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_FROM_STRING, N_RB_FROM_STRING, 1, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbFromString::~ObExprRbFromString() +{ +} + +int ObExprRbFromString::calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + int ret = OB_SUCCESS; + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (!ob_is_string_type(type1.get_type()) + || ObCharset::is_cs_nonascii(type1.get_collation_type()) + || ObHexStringType == type1.get_type()) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid type provided.", K(ret), K(type1.get_type())); + } + + if (OB_SUCC(ret)) { + type.set_roaringbitmap(); + type.set_length((ObAccuracy::DDL_DEFAULT_ACCURACY[ObRoaringBitmapType]).get_length()); + } + return ret; +} + +int ObExprRbFromString::eval_rb_from_string(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res) +{ + int ret = OB_SUCCESS; + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObDatum *datum = NULL; + bool is_null_result = false; + ObString rb_str; + ObString rb_bin; + ObRoaringBitmap *rb = NULL; + + if (OB_FAIL(expr.args_[0]->eval(ctx, datum))) { + LOG_WARN("failed to eval argument", K(ret)); + } else if (datum->is_null()) { + is_null_result = true; + } else { + rb_str = datum->get_string(); + if (OB_FAIL(ObTextStringHelper::read_real_string_data(tmp_allocator, + *datum, + expr.args_[0]->datum_meta_, + expr.args_[0]->obj_meta_.has_lob_header(), + rb_str))) { + LOG_WARN("failed to get real string data", K(ret), K(rb_str)); + } else if (OB_FAIL(ObRbUtils::rb_from_string(tmp_allocator, rb_str, rb))) { + LOG_WARN("failed to build roaringbitmap from string", K(ret), K(rb_str)); + } else if (OB_FAIL(ObRbUtils::rb_serialize(tmp_allocator, rb_bin, rb))) { + LOG_WARN("failed to serialize roaringbitmap", K(ret)); + } + ObRbUtils::rb_destroy(rb); + } + if (OB_FAIL(ret)) { + } else if (is_null_result) { + res.set_null(); + } else if (OB_FAIL(ObRbExprHelper::pack_rb_res(expr, ctx, res, rb_bin))) { + LOG_WARN("fail to pack roaringbitmap res", K(ret)); + } + + return ret; +} + +int ObExprRbFromString::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbFromString::eval_rb_from_string; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_from_string.h b/src/sql/engine/expr/ob_expr_rb_from_string.h new file mode 100644 index 000000000..13518fc28 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_from_string.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_from_string. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_FROM_STRING_ +#define OCEANBASE_SQL_OB_EXPR_RB_FROM_STRING_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbFromString : public ObFuncExprOperator +{ +public: + explicit ObExprRbFromString(common::ObIAllocator &alloc); + virtual ~ObExprRbFromString(); + virtual int calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_from_string(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbFromString); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_FROM_STRING_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_func_helper.cpp b/src/sql/engine/expr/ob_expr_rb_func_helper.cpp new file mode 100644 index 000000000..0697ecb9a --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_func_helper.cpp @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file is for implement of func json expr helper + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "lib/ob_errno.h" +#include "sql/engine/expr/ob_expr_cast.h" +#include "sql/engine/expr/ob_datum_cast.h" +#include "ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_rb_utils.h" + +// #include "lib/encode/ob_base64_encode.h" // for ObBase64Encoder +// #include "lib/utility/ob_fast_convert.h" // ObFastFormatInt::format_unsigned +// #include "rpc/obmysql/ob_mysql_global.h" // DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ + +int ObRbExprHelper::get_input_roaringbitmap_bin(ObEvalCtx &ctx, ObExpr *rb_arg, ObString &rb_bin, bool &is_rb_null) +{ + INIT_SUCC(ret); + ObDatum *rb_datum; + ObEvalCtx::TempAllocGuard ctx_alloc_g(ctx); + common::ObArenaAllocator &allocator = ctx_alloc_g.get_allocator(); + if (OB_FAIL(rb_arg->eval(ctx, rb_datum))) { + LOG_WARN("eval roaringbitmap args failed", K(ret)); + } else if (rb_datum->is_null()) { + is_rb_null = true; + } else if (OB_FALSE_IT(rb_bin = rb_datum->get_string())) { + } else if (OB_FAIL(ObTextStringHelper::read_real_string_data( + allocator, + *rb_datum, + rb_arg->datum_meta_, + rb_arg->obj_meta_.has_lob_header(), + rb_bin))) { + LOG_WARN("fail to get real string data", K(ret), K(rb_bin)); + } else if (rb_bin.empty()) { + ret = OB_INVALID_DATA; + LOG_WARN("roaringbitmap binary is empty", K(ret), K(rb_bin)); + } + return ret; +} + +int ObRbExprHelper::get_input_roaringbitmap(ObEvalCtx &ctx, ObExpr *rb_arg, ObRoaringBitmap *&rb, bool &is_rb_null) +{ + INIT_SUCC(ret); + ObString rb_bin = nullptr; + ObEvalCtx::TempAllocGuard ctx_alloc_g(ctx); + common::ObArenaAllocator &allocator = ctx_alloc_g.get_allocator(); if (OB_FAIL(get_input_roaringbitmap_bin(ctx, rb_arg, rb_bin, is_rb_null))) { + LOG_WARN("failed to get input roaringbitmap binary", K(ret)); + } else if (!is_rb_null && OB_FAIL(ObRbUtils::rb_deserialize(allocator, rb_bin, rb))) { + LOG_WARN("failed to deserialize roaringbitmap", K(ret)); + } + return ret; +} + +int ObRbExprHelper::pack_rb_res(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res, const ObString &str) +{ + int ret = OB_SUCCESS; + ObTextStringDatumResult text_result(expr.datum_meta_.type_, &expr, &ctx, &res); + if (OB_FAIL(text_result.init(str.length()))) { + LOG_WARN("init lob result failed"); + } else if (OB_FAIL(text_result.append(str.ptr(), str.length()))) { + LOG_WARN("failed to append realdata", K(ret), K(text_result)); + } else { + text_result.set_result(); + } + return ret; +} + +uint64_t ObRbExprHelper::get_tenant_id(ObSQLSessionInfo *session) +{ + uint64_t tenant_id = 0; + if (OB_ISNULL(session)) { + } else if (session->get_ddl_info().is_ddl_check_default_value()) { + tenant_id = OB_SERVER_TENANT_ID; + } else { + tenant_id = session->get_effective_tenant_id(); + } + return tenant_id; +} + +} // namespace sql +} // namespace oceanbase diff --git a/src/sql/engine/expr/ob_expr_rb_func_helper.h b/src/sql/engine/expr/ob_expr_rb_func_helper.h new file mode 100644 index 000000000..4b8727e19 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_func_helper.h @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file is for define of func rb expr helper + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_FUNC_HELPER_ +#define OCEANBASE_SQL_OB_EXPR_RB_FUNC_HELPER_ + +#include "sql/engine/expr/ob_expr_util.h" +#include "sql/engine/expr/ob_expr_lob_utils.h" +#include "sql/engine/expr/ob_expr_result_type_util.h" +#include "sql/engine/ob_exec_context.h" +#include "share/object/ob_obj_cast.h" +#include "objit/common/ob_item_type.h" +#include "sql/session/ob_sql_session_info.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" + +using namespace oceanbase::common; + +namespace oceanbase +{ +namespace sql +{ +class ObRbExprHelper final +{ +public: + + static int get_input_roaringbitmap_bin(ObEvalCtx &ctx, ObExpr *rb_arg, ObString &rb_bin, bool &is_rb_null); + static int get_input_roaringbitmap(ObEvalCtx &ctx, ObExpr *rb_arg, ObRoaringBitmap *&rb, bool &is_rb_null); + static int pack_rb_res(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res, const ObString &str); + static uint64_t get_tenant_id(ObSQLSessionInfo *session); + +private: + // const static uint32_t RESERVE_MIN_BUFF_SIZE = 32; + DISALLOW_COPY_AND_ASSIGN(ObRbExprHelper); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_FUNC_HELPER_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_is_empty.cpp b/src/sql/engine/expr/ob_expr_rb_is_empty.cpp new file mode 100644 index 000000000..ff5f0daf3 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_is_empty.cpp @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_is_empty. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_is_empty.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbIsEmpty::ObExprRbIsEmpty(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_IS_EMPTY, N_RB_IS_EMPTY, 1, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbIsEmpty::~ObExprRbIsEmpty() +{ +} + +int ObExprRbIsEmpty::calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + INIT_SUCC(ret); + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (!(type1.is_roaringbitmap() || type1.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid roaringbitmap data type provided.", K(ret), K(type1.get_type()), K(type1.get_collation_type())); + } + if (OB_SUCC(ret)) { + type.set_int(); + type.set_scale(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType].scale_); + type.set_precision(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType].precision_); + } + return ret; +} + +int ObExprRbIsEmpty::eval_rb_is_empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) +{ + INIT_SUCC(ret); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObExpr *rb_arg = expr.args_[0]; + bool is_rb_null = false; + ObRoaringBitmap *rb = nullptr; + ObDatum *rb_datum = nullptr; + if (OB_FAIL(ObRbExprHelper::get_input_roaringbitmap(ctx, rb_arg, rb, is_rb_null))) { + LOG_WARN("fail to get input roaringbitmap", K(ret)); + } else if (is_rb_null) { + res.set_null(); + } else { + uint64_t cardinality = rb->get_cardinality(); + if (cardinality == 0) { + res.set_bool(true); + } else { + res.set_bool(false); + } + } + ObRbUtils::rb_destroy(rb); + return ret; +} + +int ObExprRbIsEmpty::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbIsEmpty::eval_rb_is_empty; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_is_empty.h b/src/sql/engine/expr/ob_expr_rb_is_empty.h new file mode 100644 index 000000000..aa8cfb495 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_is_empty.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_is_empty. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_IS_EMPTY_ +#define OCEANBASE_SQL_OB_EXPR_RB_IS_EMPTY_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbIsEmpty : public ObFuncExprOperator +{ +public: + explicit ObExprRbIsEmpty(common::ObIAllocator &alloc); + virtual ~ObExprRbIsEmpty(); + virtual int calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_is_empty(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbIsEmpty); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_IS_EMPTY_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_to_string.cpp b/src/sql/engine/expr/ob_expr_rb_to_string.cpp new file mode 100644 index 000000000..a09bca071 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_to_string.cpp @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_to_string. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_to_string.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "sql/engine/expr/ob_expr_lob_utils.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbToString::ObExprRbToString(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_TO_STRING, N_RB_TO_STRING, 1, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbToString::~ObExprRbToString() +{ +} + + +int ObExprRbToString::calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + INIT_SUCC(ret); + if (ob_is_null(type1.get_type())) { + // do nothing + } else if (!(type1.is_roaringbitmap() || type1.is_hex_string())) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid roaringbitmap data type provided.", K(ret), K(type1.get_type()), K(type1.get_collation_type())); + } + if (OB_SUCC(ret)) { + type.set_type(ObLongTextType); + type.set_collation_type(CS_TYPE_UTF8MB4_GENERAL_CI); + type.set_collation_level(CS_LEVEL_IMPLICIT); + type.set_accuracy(ObAccuracy::DDL_DEFAULT_ACCURACY[ObLongTextType]); + } + return ret; +} + +int ObExprRbToString::eval_rb_to_string(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res) +{ + INIT_SUCC(ret); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObExpr *arg = expr.args_[0]; + bool is_rb_null = false; + ObDatum *datum = nullptr; + ObString rb_bin; + ObString rb_str; + + if (OB_FAIL(arg->eval(ctx, datum))) { + LOG_WARN("eval roaringbitmap args failed", K(ret)); + } else if (datum->is_null()) { + is_rb_null = true; + } else if (OB_FALSE_IT(rb_bin = datum->get_string())) { + } else if (OB_FAIL(ObTextStringHelper::read_real_string_data(tmp_allocator, + *datum, + arg->datum_meta_, + arg->obj_meta_.has_lob_header(), + rb_bin))) { + LOG_WARN("failed to get real string data", K(ret), K(rb_bin)); + } + + if (OB_FAIL(ret)) { + } else if (is_rb_null) { + res.set_null(); + } else if (OB_FAIL(ObRbUtils::rb_to_string(tmp_allocator, rb_bin, rb_str))) { + LOG_WARN("failed to print roaringbitmap to string", K(ret)); + } else { + ObTextStringDatumResult str_result(expr.datum_meta_.type_, &expr, &ctx, &res); + if (OB_FAIL(str_result.init(rb_str.length()))) { + LOG_WARN("failed to init result", K(ret), K(rb_str.length())); + } else if (OB_FAIL(str_result.append(rb_str.ptr(), rb_str.length()))) { + LOG_WARN("failed to append realdata", K(ret), K(rb_str)); + } else { + str_result.set_result(); + } + } + return ret; +} + +int ObExprRbToString::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbToString::eval_rb_to_string; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_to_string.h b/src/sql/engine/expr/ob_expr_rb_to_string.h new file mode 100644 index 000000000..7dc198ff7 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_to_string.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_to_string. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_TO_STRING_ +#define OCEANBASE_SQL_OB_EXPR_RB_TO_STRING_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbToString : public ObFuncExprOperator +{ +public: + explicit ObExprRbToString(common::ObIAllocator &alloc); + virtual ~ObExprRbToString(); + virtual int calc_result_type1(ObExprResType &type, + ObExprResType &type1, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_to_string(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbToString); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_TO_STRING_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_to_varbinary.cpp b/src/sql/engine/expr/ob_expr_rb_to_varbinary.cpp new file mode 100644 index 000000000..4b0ee5462 --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_to_varbinary.cpp @@ -0,0 +1,148 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_to_varbinary. + */ + +#define USING_LOG_PREFIX SQL_ENG +#include "sql/engine/expr/ob_expr_rb_to_varbinary.h" +#include "sql/engine/expr/ob_expr_rb_func_helper.h" +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "sql/engine/expr/ob_expr_lob_utils.h" + +using namespace oceanbase::common; +using namespace oceanbase::sql; + +namespace oceanbase +{ +namespace sql +{ +ObExprRbToVarbinary::ObExprRbToVarbinary(common::ObIAllocator &alloc) + : ObFuncExprOperator(alloc, T_FUN_SYS_RB_TO_VARBINARY, N_RB_TO_VARBINARY, ONE_OR_TWO, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION) +{ +} + +ObExprRbToVarbinary::~ObExprRbToVarbinary() +{ +} + + +int ObExprRbToVarbinary::calc_result_typeN(ObExprResType &type, + ObExprResType *types, + int64_t param_num, + common::ObExprTypeCtx &type_ctx) const +{ + UNUSED(type_ctx); + INIT_SUCC(ret); + if (ob_is_null(types[0].get_type())) { + // do nothing + } else if (types[0].is_roaringbitmap()) { + types[0].set_calc_collation_type(CS_TYPE_BINARY); + types[0].set_calc_collation_level(CS_LEVEL_IMPLICIT); + } else { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("invalid roaringbitmap data type provided.", K(ret), K(types[0].get_type()), K(types[0].get_collation_type())); + } + if (OB_SUCC(ret) && param_num == 2 && !types[1].is_string_type()) { + ret = OB_ERR_INVALID_TYPE_FOR_ARGUMENT; + LOG_WARN("second argument should be string type", K(ret), K(types[1])); + } + if (OB_SUCC(ret)) { + type.set_type(ObLongTextType); + type.set_collation_level(common::CS_LEVEL_IMPLICIT); + type.set_collation_type(CS_TYPE_BINARY); + type.set_accuracy(ObAccuracy::DDL_DEFAULT_ACCURACY[ObLongTextType]); + } + return ret; +} + +int ObExprRbToVarbinary::eval_rb_to_varbinary(const ObExpr &expr, + ObEvalCtx &ctx, + ObDatum &res) +{ + INIT_SUCC(ret); + ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx); + common::ObArenaAllocator &tmp_allocator = tmp_alloc_g.get_allocator(); + lib::ObMallocHookAttrGuard malloc_guard(lib::ObMemAttr(ObRbExprHelper::get_tenant_id(ctx.exec_ctx_.get_my_session()), "ROARINGBITMAP")); + ObExpr *arg = expr.args_[0]; + bool is_rb_null = false; + ObDatum *datum = nullptr; + ObString rb_bin; + ObString expected_format; + ObString res_bin; + + if (OB_FAIL(arg->eval(ctx, datum))) { + LOG_WARN("eval roaringbitmap args failed", K(ret)); + } else if (datum->is_null()) { + is_rb_null = true; + } else if (OB_FALSE_IT(rb_bin = datum->get_string())) { + } else if (OB_FAIL(ObTextStringHelper::read_real_string_data( + tmp_allocator, + *datum, + arg->datum_meta_, + arg->obj_meta_.has_lob_header(), + rb_bin))) { + LOG_WARN("fail to get real string data", K(ret), K(rb_bin)); + } else if (expr.arg_cnt_ == 1) { + res_bin = rb_bin; + } else { + ObExpr *format_arg = expr.args_[1]; + ObDatum *format_datum = nullptr; + if (OB_FAIL(format_arg->eval(ctx, format_datum))) { + LOG_WARN("eval roaringbitmap args failed", K(ret)); + } else if (format_datum->is_null()) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("not supported expected format", K(ret), K(expected_format)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "expected format expect 'roaring' is"); } else if (OB_FALSE_IT(expected_format = format_datum->get_string())) { + } else if (OB_FAIL(ObTextStringHelper::read_real_string_data( + tmp_allocator, + *format_datum, + format_arg->datum_meta_, + format_arg->obj_meta_.has_lob_header(), + expected_format))) { + LOG_WARN("fail to get real string data", K(ret), K(expected_format)); + } else if (expected_format.case_compare("roaring") != 0) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("not supported expected format", K(ret), K(expected_format)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "expected format expect 'roaring' is"); + } else if (OB_FAIL(ObRbUtils::binary_format_convert(tmp_allocator, rb_bin, res_bin))) { + LOG_WARN("failed to convert binary to roaring format", K(ret), K(rb_bin)); + } + } + + if (OB_FAIL(ret)) { + } else if (is_rb_null) { + res.set_null(); + } else { + ObTextStringDatumResult str_result(expr.datum_meta_.type_, &expr, &ctx, &res); + if (OB_FAIL(str_result.init(res_bin.length()))) { + LOG_WARN("fail to init result", K(ret), K(res_bin.length())); + } else if (OB_FAIL(str_result.append(res_bin.ptr(), res_bin.length()))) { + LOG_WARN("failed to append realdata", K(ret), K(res_bin)); + } else { + str_result.set_result(); + } + } + return ret; +} + +int ObExprRbToVarbinary::cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const +{ + UNUSED(expr_cg_ctx); + UNUSED(raw_expr); + rt_expr.eval_func_ = ObExprRbToVarbinary::eval_rb_to_varbinary; + return OB_SUCCESS; +} + +} // namespace sql +} // namespace oceanbase \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_rb_to_varbinary.h b/src/sql/engine/expr/ob_expr_rb_to_varbinary.h new file mode 100644 index 000000000..7b0d4fd1a --- /dev/null +++ b/src/sql/engine/expr/ob_expr_rb_to_varbinary.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2021 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + * This file contains implementation for rb_to_varbinary. + */ + +#ifndef OCEANBASE_SQL_OB_EXPR_RB_TO_VARBINARY_ +#define OCEANBASE_SQL_OB_EXPR_RB_TO_VARBINARY_ + +#include "sql/engine/expr/ob_expr_operator.h" + +namespace oceanbase +{ +namespace sql +{ +class ObExprRbToVarbinary : public ObFuncExprOperator +{ +public: + explicit ObExprRbToVarbinary(common::ObIAllocator &alloc); + virtual ~ObExprRbToVarbinary(); + virtual int calc_result_typeN(ObExprResType &type, + ObExprResType *types, + int64_t param_num, + common::ObExprTypeCtx &type_ctx) + const override; + static int eval_rb_to_varbinary(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res); + virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, + const ObRawExpr &raw_expr, + ObExpr &rt_expr) const override; +private: + DISALLOW_COPY_AND_ASSIGN(ObExprRbToVarbinary); +}; + +} // sql +} // oceanbase +#endif // OCEANBASE_SQL_OB_EXPR_RB_TO_VARBINARY_ \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_relational_cmp_type.map b/src/sql/engine/expr/ob_expr_relational_cmp_type.map index ace4f284c..8fbec62b7 100644 --- a/src/sql/engine/expr/ob_expr_relational_cmp_type.map +++ b/src/sql/engine/expr/ob_expr_relational_cmp_type.map @@ -74,6 +74,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObHexStringType, /* RoaringBitmap */ }, /*TinyIntType*/ @@ -132,6 +133,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*SmallIntType*/ @@ -190,6 +192,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*MediumIntType*/ @@ -248,6 +251,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*Int32Type*/ @@ -306,6 +310,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*IntType*/ @@ -364,6 +369,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, // for all uint cmp int, we must set cmp type to unsigned, @@ -424,6 +430,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*USmallIntType*/ @@ -482,6 +489,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UMediumIntType*/ @@ -540,6 +548,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UInt32Type*/ @@ -598,6 +607,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UInt64Type*/ @@ -656,6 +666,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*FloatType*/ @@ -714,6 +725,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*DoubleType*/ @@ -772,6 +784,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UFloatType*/ @@ -830,6 +843,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UDoubleType*/ @@ -888,6 +902,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*NumberType*/ @@ -946,6 +961,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UNumberType*/ @@ -1004,6 +1020,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*DateTimeType*/ @@ -1062,6 +1079,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TimestampType*/ @@ -1120,6 +1138,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObTimestampType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*DateType*/ @@ -1178,6 +1197,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TimeType*/ @@ -1236,6 +1256,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*YearType*/ @@ -1294,6 +1315,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObVarcharType, /* MySQLDateType */ ObVarcharType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*VarcharType*/ @@ -1352,6 +1374,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObHexStringType, /* RoaringBitmap */ }, /*CharType*/ @@ -1410,6 +1433,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObHexStringType, /* RoaringBitmap */ }, /*HexStringType*/ @@ -1468,6 +1492,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObHexStringType, /* RoaringBitmap */ }, /*ExtendType*/ @@ -1526,6 +1551,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UnknownType*/ @@ -1584,6 +1610,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObIntType, /* MySQLDateType */ ObIntType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TinyTextType*/ { @@ -1641,6 +1668,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TextType*/ { @@ -1698,6 +1726,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*MediumTextType*/ { @@ -1755,6 +1784,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*LongTextType*/ { @@ -1812,6 +1842,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*BitType*/ { @@ -1869,6 +1900,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObNumberType, /* MySQLDateType */ ObNumberType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*EnumType*/ @@ -1927,6 +1959,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*SetType*/ { @@ -1984,6 +2017,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*EnumInnerType*/ { @@ -2041,6 +2075,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*SetInnerType*/ { @@ -2098,6 +2133,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObTimestampTZType*/ { @@ -2155,6 +2191,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObTimestampTZType, /* MySQLDateType */ ObTimestampTZType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObTimestampLTZType*/ { @@ -2212,6 +2249,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObTimestampLTZType, /* MySQLDateType */ ObTimestampLTZType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObTimestampNanoType*/ { @@ -2269,6 +2307,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObTimestampNanoType, /* MySQLDateType */ ObTimestampNanoType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObRawType*/ { @@ -2326,6 +2365,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObRawType, /* MySQLDateType */ ObRawType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObIntervalYMType*/ { @@ -2383,6 +2423,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObIntervalYMType, /* MySQLDateType */ ObIntervalYMType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObIntervalDSType*/ { @@ -2440,6 +2481,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObIntervalDSType, /* MySQLDateType */ ObIntervalDSType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*NumberFloatType*/ @@ -2498,6 +2540,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObNVarchar2Type*/ { @@ -2555,6 +2598,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*CharType*/ @@ -2613,6 +2657,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObURowIDType*/ { @@ -2670,6 +2715,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObLobType*/ { @@ -2727,6 +2773,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObJsonType*/ { @@ -2784,6 +2831,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObJsonType, /* MySQLDateType */ ObJsonType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObGeometryType*/ { @@ -2841,6 +2889,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*User Defined Sql Type*/ { @@ -2898,6 +2947,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObDecimalIntType*/ { @@ -2955,6 +3005,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObCollectionSQLType*/ { @@ -3012,6 +3063,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* MySQLDateType */ ObMaxType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObMySQLDateType*/ { @@ -3069,6 +3121,7 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObMySQLDateTimeType*/ { @@ -3126,6 +3179,65 @@ static constexpr ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMySQLDateTimeType, /* MySQLDateType */ ObMySQLDateTimeType, /* MySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ + }, + /*ObRoaringBitmapType*/ + { + ObHexStringType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UIntType */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObHexStringType, /* VarcharType */ + ObHexStringType, /* CharType */ + ObHexStringType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* TinyTextType*/ + ObMaxType, /* TextType*/ + ObMaxType, /* MediumTextType*/ + ObMaxType, /* LongTextType*/ + ObMaxType, /* BitType*/ + ObMaxType, /* EnumType */ + ObMaxType, /* SetType */ + ObMaxType, /* EnumInnerType */ + ObMaxType, /* SetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* UDT */ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* COLLECTION */ + ObMaxType, /* MySQLDateType */ + ObMaxType, /* MySQLDateTimeType */ + ObHexStringType, /* RoaringBitmap */ }, }; @@ -3189,6 +3301,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* UDT */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TinyIntType*/ @@ -3247,6 +3360,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*SmallIntType*/ @@ -3305,6 +3419,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*MediumIntType*/ @@ -3363,6 +3478,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*Int32Type*/ @@ -3421,6 +3537,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*IntType*/ @@ -3479,6 +3596,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, // for all uint cmp int, we must set cmp type to unsigned, @@ -3539,6 +3657,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*USmallIntType*/ @@ -3597,6 +3716,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UMediumIntType*/ @@ -3655,6 +3775,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UInt32Type*/ @@ -3713,6 +3834,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UInt64Type*/ @@ -3771,6 +3893,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*FloatType*/ @@ -3829,6 +3952,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*DoubleType*/ @@ -3887,6 +4011,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UFloatType*/ @@ -3945,6 +4070,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UDoubleType*/ @@ -4003,6 +4129,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*NumberType*/ @@ -4061,6 +4188,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UNumberType*/ @@ -4119,6 +4247,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*DateTimeType*/ @@ -4177,6 +4306,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TimestampType*/ @@ -4235,6 +4365,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*DateType*/ @@ -4293,6 +4424,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TimeType*/ @@ -4351,6 +4483,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*YearType*/ @@ -4409,6 +4542,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*VarcharType*/ @@ -4467,6 +4601,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*CharType*/ @@ -4525,6 +4660,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*HexStringType*/ @@ -4583,6 +4719,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ExtendType*/ @@ -4641,6 +4778,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*UnknownType*/ @@ -4699,6 +4837,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TinyTextType*/ { @@ -4756,6 +4895,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*TextType*/ { @@ -4813,6 +4953,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*MediumTextType*/ { @@ -4870,6 +5011,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*LongTextType*/ { @@ -4927,6 +5069,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*BitType*/ { @@ -4984,6 +5127,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*EnumType*/ @@ -5042,6 +5186,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*SetType*/ { @@ -5099,6 +5244,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*EnumInnerType*/ { @@ -5156,6 +5302,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*SetInnerType*/ { @@ -5213,6 +5360,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObTimestampTZType*/ { @@ -5270,6 +5418,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObTimestampLTZType*/ { @@ -5327,6 +5476,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObTimestampNanoType*/ { @@ -5384,6 +5534,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObRawType*/ { @@ -5441,6 +5592,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObIntervalYMType*/ { @@ -5498,6 +5650,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObIntervalDSType*/ { @@ -5555,6 +5708,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*NumberFloatType*/ @@ -5613,6 +5767,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*ObNVarchar2Type*/ { @@ -5670,6 +5825,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /*NCharType*/ @@ -5728,6 +5884,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObURowIDType */ @@ -5786,6 +5943,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObLobType */ { @@ -5843,6 +6001,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObJsonType */ { @@ -5900,6 +6059,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObGeometryType */ { @@ -5957,6 +6117,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* UDT */ { @@ -6014,6 +6175,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObDecimalIntType */ { @@ -6071,6 +6233,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* COLLECTION */ { @@ -6128,6 +6291,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObMySQLDateType */ { @@ -6185,6 +6349,7 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, /* ObMySQLDateTimeType */ { @@ -6242,6 +6407,65 @@ static constexpr ObObjType ORACLE_RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* COLLECTION */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UIntType */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* TinyTextType*/ + ObMaxType, /* TextType*/ + ObMaxType, /* MediumTextType*/ + ObMaxType, /* LongTextType*/ + ObMaxType, /* BitType*/ + ObMaxType, /* EnumType */ + ObMaxType, /* SetType */ + ObMaxType, /* EnumInnerType */ + ObMaxType, /* SetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* UDT */ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* COLLECTION */ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* RoaringBitmap */ }, }; diff --git a/src/sql/engine/expr/ob_expr_relational_equal_type.map b/src/sql/engine/expr/ob_expr_relational_equal_type.map index 0271f41dd..0a8c1700e 100644 --- a/src/sql/engine/expr/ob_expr_relational_equal_type.map +++ b/src/sql/engine/expr/ob_expr_relational_equal_type.map @@ -56,6 +56,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyIntType*/ @@ -114,6 +115,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SmallIntType*/ @@ -172,6 +174,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumIntType*/ @@ -230,6 +233,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*Int32Type*/ @@ -288,6 +292,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntType*/ @@ -346,6 +351,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UTinyIntType*/ { @@ -403,6 +409,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*USmallIntType*/ @@ -461,6 +468,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UMediumIntType*/ @@ -519,6 +527,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt32Type*/ @@ -577,6 +586,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt64Type*/ @@ -635,6 +645,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*FloatType*/ @@ -693,6 +704,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DoubleType*/ @@ -751,6 +763,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UFloatType*/ @@ -809,6 +822,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UDoubleType*/ @@ -867,6 +881,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberType*/ @@ -925,6 +940,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UNumberType*/ @@ -983,6 +999,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateTimeType*/ @@ -1041,6 +1058,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimestampType*/ @@ -1099,6 +1117,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObTimestampType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateType*/ @@ -1157,6 +1176,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimeType*/ @@ -1215,6 +1235,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*YearType*/ @@ -1273,6 +1294,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*VarcharType*/ @@ -1331,6 +1353,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*CharType*/ @@ -1389,6 +1412,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*HexStringType*/ @@ -1447,6 +1471,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ExtendType*/ @@ -1505,6 +1530,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UnknownType*/ @@ -1563,6 +1589,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyTextType*/ { @@ -1620,6 +1647,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TextType*/ { @@ -1677,6 +1705,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumTextType*/ { @@ -1734,6 +1763,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*LongTextType*/ { @@ -1791,6 +1821,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*BitType*/ { @@ -1848,6 +1879,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*EnumType*/ { @@ -1905,6 +1937,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SetType*/ { @@ -1962,6 +1995,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*EnumInnerType*/ { @@ -2019,6 +2053,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SetInnerType*/ { @@ -2076,6 +2111,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampTZType*/ { @@ -2133,6 +2169,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObTimestampTZType, /* ObMySQLDateType */ ObTimestampTZType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampLTZType*/ { @@ -2190,6 +2227,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObTimestampLTZType, /* ObMySQLDateType */ ObTimestampLTZType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampNanoType*/ { @@ -2247,6 +2285,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObTimestampNanoType, /* ObMySQLDateType */ ObTimestampNanoType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObRawType*/ { @@ -2304,6 +2343,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObRawType, /* ObMySQLDateType */ ObRawType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalYMType*/ { @@ -2361,6 +2401,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntervalYMType, /* ObMySQLDateType */ ObIntervalYMType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalDSType*/ { @@ -2418,6 +2459,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObIntervalDSType, /* ObMySQLDateType */ ObIntervalDSType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberFloatType*/ @@ -2476,6 +2518,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NVarchar2Type*/ @@ -2534,6 +2577,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NCharType*/ @@ -2592,6 +2636,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObURowIDType*/ { @@ -2649,6 +2694,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLobType*/ { @@ -2706,6 +2752,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObJsonType*/ { @@ -2763,6 +2810,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObJsonType, /* ObMySQLDateType */ ObJsonType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObGeometryType*/ { @@ -2820,6 +2868,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObUserDefinedSQLType*/ { @@ -2877,6 +2926,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DecimalIntType*/ { @@ -2934,6 +2984,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObCollectionSQLType*/ { @@ -2991,6 +3042,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateType*/ @@ -3049,6 +3101,7 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateTimeType*/ { @@ -3106,7 +3159,66 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UIntType */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* TinyTextType*/ + ObMaxType, /* TextType*/ + ObMaxType, /* MediumTextType*/ + ObMaxType, /* LongTextType*/ + ObMaxType, /* BitType*/ + ObMaxType, /* EnumType*/ + ObMaxType, /* SetType*/ + ObMaxType, /* EnumInnerType*/ + ObMaxType, /* SetInnerType*/ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* ObUserDefinedSQLType */ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* ObCollectionSQLType */ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ + } }; static_assert(is_array_fully_initialized(RELATIONAL_EQUAL_TYPE, ObMaxType), "RELATIONAL_EQUAL_TYPE is partially initlized"); diff --git a/src/sql/engine/expr/ob_expr_relational_result_type.map b/src/sql/engine/expr/ob_expr_relational_result_type.map index 7b712873b..df06fd5c9 100644 --- a/src/sql/engine/expr/ob_expr_relational_result_type.map +++ b/src/sql/engine/expr/ob_expr_relational_result_type.map @@ -56,6 +56,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TinyIntType*/ { @@ -113,6 +114,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*SmallIntType*/ @@ -171,6 +173,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MediumIntType*/ @@ -229,6 +232,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*Int32Type*/ @@ -287,6 +291,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*IntType*/ @@ -345,6 +350,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UTinyIntType*/ @@ -403,6 +409,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*USmallIntType*/ @@ -461,6 +468,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UMediumIntType*/ @@ -519,6 +527,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UInt32Type*/ @@ -577,6 +586,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UIntType*/ @@ -635,6 +645,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObIntType, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*FloatType*/ @@ -693,6 +704,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DoubleType*/ @@ -751,6 +763,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UFloatType*/ @@ -809,6 +822,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UDoubleType*/ @@ -867,6 +881,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberType*/ @@ -925,6 +940,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UNumberType*/ @@ -983,6 +999,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateTimeType*/ @@ -1041,6 +1058,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimestampType*/ @@ -1099,6 +1117,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*DateType*/ @@ -1157,6 +1176,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*TimeType*/ @@ -1215,6 +1235,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*YearType*/ @@ -1273,6 +1294,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*VarcharType*/ @@ -1331,6 +1353,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*CharType*/ @@ -1389,6 +1412,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*HexStringType*/ @@ -1447,6 +1471,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ExtendType*/ @@ -1505,6 +1530,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*UnknownType*/ @@ -1563,6 +1589,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTinyTextType*/ { @@ -1620,6 +1647,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObLongTextType, /* ObMySQLDateType */ ObLongTextType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTextType*/ { @@ -1677,6 +1705,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObLongTextType, /* ObMySQLDateType */ ObLongTextType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObMediumTextType*/ { @@ -1734,6 +1763,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObLongTextType, /* ObMySQLDateType */ ObLongTextType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLongTextType*/ { @@ -1791,6 +1821,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObLongTextType, /* ObMySQLDateType */ ObLongTextType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*BitType*/ { @@ -1848,6 +1879,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObInt32Type, /* ObMySQLDateType */ ObIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumType*/ { @@ -1905,6 +1937,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetType*/ { @@ -1962,6 +1995,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObEnumInnerType*/ { @@ -2019,6 +2053,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObSetInnerType*/ { @@ -2076,6 +2111,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampTZType*/ { @@ -2133,6 +2169,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObTimestampTZType, /* ObMySQLDateType */ ObTimestampTZType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampLTZType*/ { @@ -2190,6 +2227,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObTimestampLTZType, /* ObMySQLDateType */ ObTimestampLTZType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObTimestampNanoType*/ { @@ -2247,6 +2285,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObTimestampNanoType, /* ObMySQLDateType */ ObTimestampNanoType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObRawType*/ { @@ -2304,6 +2343,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalYMType*/ { @@ -2361,6 +2401,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObIntervalDSType*/ { @@ -2418,6 +2459,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NumberFloatType*/ @@ -2476,6 +2518,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NVarchar2Type*/ { @@ -2533,6 +2576,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNVarchar2Type, /* ObMySQLDateType */ ObNVarchar2Type, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*NCharType*/ @@ -2591,6 +2635,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObNCharType, /* ObMySQLDateType */ ObNCharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObURowIDType*/ { @@ -2648,6 +2693,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObLobType*/ { @@ -2705,6 +2751,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObJsonType*/ { @@ -2762,6 +2809,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObVarcharType, /* ObMySQLDateType */ ObVarcharType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObGeometryType*/ { @@ -2819,6 +2867,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObUserDefinedSQLType*/ { @@ -2876,6 +2925,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObDecimalIntType*/ { @@ -2933,6 +2983,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObDecimalIntType, /* ObMySQLDateType */ ObDecimalIntType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*ObCollectionSQLType*/ { @@ -2990,6 +3041,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMaxType, /* ObMySQLDateType */ ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateType*/ { @@ -3047,6 +3099,7 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, /*MySQLDateTimeType*/ { @@ -3104,6 +3157,65 @@ static constexpr ObObjType RELATIONAL_RESULT_TYPE[ObMaxType][ObMaxType] = ObMaxType, /* ObCollectionSQLType*/ ObMySQLDateTimeType, /* ObMySQLDateType */ ObMySQLDateTimeType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ + }, + /*ObRoaringBitmapType*/ + { + ObMaxType, /* NullType */ + ObMaxType, /* TinyIntType */ + ObMaxType, /* SmallIntType */ + ObMaxType, /* MediumIntType */ + ObMaxType, /* Int32Type */ + ObMaxType, /* IntType */ + ObMaxType, /* UTinyIntType */ + ObMaxType, /* USmallIntType */ + ObMaxType, /* UMediumIntType */ + ObMaxType, /* UInt32Type */ + ObMaxType, /* UInt64Type */ + ObMaxType, /* FloatType */ + ObMaxType, /* DoubleType */ + ObMaxType, /* UFloatType */ + ObMaxType, /* UDoubleType */ + ObMaxType, /* NumberType */ + ObMaxType, /* UNumberType */ + ObMaxType, /* DateTimeType */ + ObMaxType, /* TimestampType */ + ObMaxType, /* DateType */ + ObMaxType, /* TimeType */ + ObMaxType, /* YearType */ + ObMaxType, /* VarcharType */ + ObMaxType, /* CharType */ + ObMaxType, /* HexStringType */ + ObMaxType, /* ExtendType */ + ObMaxType, /* UnknownType */ + ObMaxType, /* ObTinyTextType */ + ObMaxType, /* ObTextType */ + ObMaxType, /* ObMediumTextType */ + ObMaxType, /* ObLongTextType */ + ObMaxType, /* ObBitType */ + ObMaxType, /* ObEnumType */ + ObMaxType, /* ObSetType */ + ObMaxType, /* ObEnumInnerType */ + ObMaxType, /* ObSetInnerType */ + ObMaxType, /* ObTimestampTZType */ + ObMaxType, /* ObTimestampLTZType */ + ObMaxType, /* ObTimestampNanoType */ + ObMaxType, /* ObRawType */ + ObMaxType, /* ObIntervalYMType */ + ObMaxType, /* ObIntervalDSType */ + ObMaxType, /* ObNumberFloatType */ + ObMaxType, /* ObNVarchar2Type */ + ObMaxType, /* ObNCharType */ + ObMaxType, /* ObURowIDType */ + ObMaxType, /* ObLobType */ + ObMaxType, /* ObJsonType */ + ObMaxType, /* ObGeometryType */ + ObMaxType, /* ObUserDefinedSQLType*/ + ObMaxType, /* ObDecimalIntType */ + ObMaxType, /* ObCollectionSQLType*/ + ObMaxType, /* ObMySQLDateType */ + ObMaxType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }, }; diff --git a/src/sql/engine/expr/ob_expr_round_result_type.map b/src/sql/engine/expr/ob_expr_round_result_type.map index c4da4e3d5..34ce49890 100644 --- a/src/sql/engine/expr/ob_expr_round_result_type.map +++ b/src/sql/engine/expr/ob_expr_round_result_type.map @@ -54,6 +54,7 @@ static constexpr ObObjType ROUND_RESULT_TYPE[ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObDoubleType, /* ObMySQLDateType */ ObDoubleType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }; static_assert(is_array_fully_initialized(ROUND_RESULT_TYPE), "ROUND_RESULT_TYPE is partially initlized"); \ No newline at end of file diff --git a/src/sql/engine/expr/ob_expr_sum_result_type.map b/src/sql/engine/expr/ob_expr_sum_result_type.map index 219c9db1d..a524daff4 100644 --- a/src/sql/engine/expr/ob_expr_sum_result_type.map +++ b/src/sql/engine/expr/ob_expr_sum_result_type.map @@ -54,6 +54,7 @@ static constexpr ObObjType SUM_RESULT_TYPE[ObMaxType] = ObMaxType, /* ObCollectionSQLType */ ObNumberType, /* ObMySQLDateType */ ObNumberType, /* ObMySQLDateTimeType */ + ObMaxType, /* ObRoaringBitmapType */ }; static_assert(is_array_fully_initialized(SUM_RESULT_TYPE), "SUM_RESULT_TYPE is partially initlized"); \ No newline at end of file diff --git a/src/sql/engine/window_function/ob_window_function_op.cpp b/src/sql/engine/window_function/ob_window_function_op.cpp index d864590c3..2a09f12fc 100644 --- a/src/sql/engine/window_function/ob_window_function_op.cpp +++ b/src/sql/engine/window_function/ob_window_function_op.cpp @@ -1288,7 +1288,10 @@ int ObWindowFunctionOp::init() case T_FUN_ORA_JSON_ARRAYAGG: case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: - case T_FUN_SYS_ST_ASMVT: { + case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { void *tmp_ptr = local_allocator_.alloc(sizeof(AggrCell)); void *tmp_array = local_allocator_.alloc(sizeof(AggrInfoFixedArray)); ObIArray *aggr_infos = NULL; diff --git a/src/sql/ob_sql_define.h b/src/sql/ob_sql_define.h index 964513337..96cc79b51 100644 --- a/src/sql/ob_sql_define.h +++ b/src/sql/ob_sql_define.h @@ -689,7 +689,8 @@ static bool is_fixed_length(ObObjType type) { || ObJsonTC == tc || ObGeometryTC == tc || ObUserDefinedSQLTC == tc - || ObDecimalIntTC == tc) { + || ObDecimalIntTC == tc + || ObRoaringBitmapTC == tc) { is_fixed = false; } return is_fixed; diff --git a/src/sql/optimizer/ob_opt_est_parameter_normal.h b/src/sql/optimizer/ob_opt_est_parameter_normal.h index e502e995d..8b459dfc4 100644 --- a/src/sql/optimizer/ob_opt_est_parameter_normal.h +++ b/src/sql/optimizer/ob_opt_est_parameter_normal.h @@ -122,6 +122,7 @@ const static double comparison_params_normal[ObMaxTC+1] = { NORMAL_CMP_CHAR_COST, // collection sql type NORMAL_CMP_INT_COST, // mysql date NORMAL_CMP_INT_COST, // mysql datetime + NORMAL_CMP_CHAR_COST, // roaringbitmap }; const static double hash_params_normal[ObMaxTC+1] = { @@ -154,6 +155,7 @@ const static double hash_params_normal[ObMaxTC+1] = { NORMAL_HASH_CHAR_COST, // collection sql type NORMAL_HASH_INT_COST, // mysql date NORMAL_HASH_INT_COST, // mysql datetime + NORMAL_HASH_CHAR_COST, // roaringbitmap }; const static double project_params_normal[2][2][MAX_PROJECT_TYPE] = { diff --git a/src/sql/optimizer/ob_opt_est_parameter_vector.h b/src/sql/optimizer/ob_opt_est_parameter_vector.h index c6f47ff63..02f32a77f 100644 --- a/src/sql/optimizer/ob_opt_est_parameter_vector.h +++ b/src/sql/optimizer/ob_opt_est_parameter_vector.h @@ -119,6 +119,7 @@ const static double comparison_params_vector[ObMaxTC+1] = { VECTOR_CMP_CHAR_COST, // user defined type VECTOR_CMP_NUMBER_COST, // ObDecimalIntTC VECTOR_CMP_CHAR_COST, // collection sql type + VECTOR_CMP_CHAR_COST, // roaringbitmap }; const static double hash_params_vector[ObMaxTC+1] = { @@ -149,6 +150,7 @@ const static double hash_params_vector[ObMaxTC+1] = { VECTOR_HASH_CHAR_COST, // user defined type VECTOR_HASH_NUMBER_COST, // ObDecimalIntTC VECTOR_HASH_CHAR_COST, // collection sql type + VECTOR_HASH_CHAR_COST, // roaringbitmap }; const static double project_params_vector[2][2][MAX_PROJECT_TYPE] = { diff --git a/src/sql/parser/non_reserved_keywords_mysql_mode.c b/src/sql/parser/non_reserved_keywords_mysql_mode.c index bb7130111..919bf63bd 100644 --- a/src/sql/parser/non_reserved_keywords_mysql_mode.c +++ b/src/sql/parser/non_reserved_keywords_mysql_mode.c @@ -742,6 +742,7 @@ static const NonReservedKeyword Mysql_none_reserved_keywords[] = {"right", RIGHT}, {"rlike", REGEXP}, {"role", ROLE}, + {"roaringbitmap", ROARINGBITMAP}, {"rollback", ROLLBACK}, {"rolling", ROLLING}, {"rollup", ROLLUP}, @@ -1050,6 +1051,9 @@ static const NonReservedKeyword Mysql_none_reserved_keywords[] = {"without", WITHOUT}, {"validation", VALIDATION}, {"_st_asmvt", _ST_ASMVT}, + {"rb_build_agg", RB_BUILD_AGG}, + {"rb_or_agg", RB_OR_AGG}, + {"rb_and_agg", RB_AND_AGG}, }; /** https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-prepared-statements.html diff --git a/src/sql/parser/sql_parser_mysql_mode.y b/src/sql/parser/sql_parser_mysql_mode.y index bc18aa9c3..952c74aad 100644 --- a/src/sql/parser/sql_parser_mysql_mode.y +++ b/src/sql/parser/sql_parser_mysql_mode.y @@ -338,11 +338,11 @@ END_P SET_VAR DELIMITER QUARTER QUERY QUERY_RESPONSE_TIME QUEUE_TIME QUICK - REBUILD RECOVER RECOVERY_WINDOW RECYCLE REDO_BUFFER_SIZE REDOFILE REDUNDANCY REDUNDANT REFRESH REGION RELAY RELAYLOG + RB_AND_AGG RB_BUILD_AGG RB_OR_AGG REBUILD RECOVER RECOVERY_WINDOW RECYCLE REDO_BUFFER_SIZE REDOFILE REDUNDANCY REDUNDANT REFRESH REGION RELAY RELAYLOG RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELOAD REMAP REMOVE REORGANIZE REPAIR REPEATABLE REPLICA REPLICA_NUM REPLICA_TYPE REPLICATION REPORT RESET RESOURCE RESOURCE_POOL RESOURCE_POOL_LIST RESPECT RESTART RESTORE RESUME RETURNED_SQLSTATE RETURNS RETURNING REVERSE REWRITE ROLLBACK ROLLUP ROOT - ROOTTABLE ROOTSERVICE ROOTSERVICE_LIST ROUTINE ROW ROLLING ROWID ROW_COUNT ROW_FORMAT ROWS RTREE RUN + ROARINGBITMAP ROOTTABLE ROOTSERVICE ROOTSERVICE_LIST ROUTINE ROW ROLLING ROWID ROW_COUNT ROW_FORMAT ROWS RTREE RUN RECYCLEBIN ROTATE ROW_NUMBER RUDUNDANT RECURSIVE RANDOM REDO_TRANSPORT_OPTIONS REMOTE_OSS RT RANK READ_ONLY RECOVERY REJECT ROLE @@ -3233,6 +3233,21 @@ MOD '(' expr ',' expr ')' { malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SUM_OPNSIZE, 2, NULL, $3); } +| RB_BUILD_AGG '(' expr ')' +{ + malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS_RB_BUILD_AGG, 1, $3); + $$->reserved_ = 0; +} +| RB_OR_AGG '(' expr ')' +{ + malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS_RB_OR_AGG, 1, $3); + $$->reserved_ = 0; +} +| RB_AND_AGG '(' expr ')' +{ + malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS_RB_AND_AGG, 1, $3); + $$->reserved_ = 0; +} ; mvt_param: @@ -6332,6 +6347,11 @@ int_type_i opt_int_length_i opt_unsigned_i opt_zerofill_i $$->int32_values_[0] = 0; /* length */ $$->int32_values_[1] = 7; /* geometrycollection, geometry uses collation type value convey sub geometry type. */ } +| ROARINGBITMAP +{ + malloc_terminal_node($$, result->malloc_pool_, T_ROARINGBITMAP); + $$->int32_values_[0] = 0; /* length */ +} ; string_list: @@ -22196,6 +22216,7 @@ ACCOUNT | RETURNS | REVERSE | REWRITE +| ROARINGBITMAP | ROLE | ROLLBACK | ROLLING @@ -22445,6 +22466,9 @@ ACCOUNT | TRANSFER | SUM_OPNSIZE | VALIDATION +| RB_BUILD_AGG +| RB_OR_AGG +| RB_AND_AGG | OVERWRITE ; diff --git a/src/sql/printer/ob_dml_stmt_printer.cpp b/src/sql/printer/ob_dml_stmt_printer.cpp index 81a24df08..6a4456d6e 100644 --- a/src/sql/printer/ob_dml_stmt_printer.cpp +++ b/src/sql/printer/ob_dml_stmt_printer.cpp @@ -1236,6 +1236,10 @@ int ObDMLStmtPrinter::print_mysql_json_return_type(int64_t value, ObDataType dat } break; } + case T_ROARINGBITMAP: { + DATA_PRINTF("roaringbitmap "); + break; + } default: { ret = OB_ERR_UNEXPECTED; LOG_WARN("unknown cast type", K(ret), K(cast_type)); diff --git a/src/sql/printer/ob_raw_expr_printer.cpp b/src/sql/printer/ob_raw_expr_printer.cpp index e3402b9d5..c348ab025 100644 --- a/src/sql/printer/ob_raw_expr_printer.cpp +++ b/src/sql/printer/ob_raw_expr_printer.cpp @@ -1185,6 +1185,39 @@ int ObRawExprPrinter::print(ObAggFunRawExpr *expr) } break; } + case T_FUN_SYS_RB_BUILD_AGG: { + if (1 != expr->get_param_count()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("param count should be equal 1", K(ret), K(expr->get_param_count())); + } else { + DATA_PRINTF("rb_build_agg("); + PRINT_EXPR(expr->get_param_expr(0)); + DATA_PRINTF(")"); + } + break; + } + case T_FUN_SYS_RB_OR_AGG: { + if (1 != expr->get_param_count()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("param count should be equal 1", K(ret), K(expr->get_param_count())); + } else { + DATA_PRINTF("rb_or_agg("); + PRINT_EXPR(expr->get_param_expr(0)); + DATA_PRINTF(")"); + } + break; + } + case T_FUN_SYS_RB_AND_AGG: { + if (1 != expr->get_param_count()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("param count should be equal 1", K(ret), K(expr->get_param_count())); + } else { + DATA_PRINTF("rb_and_agg("); + PRINT_EXPR(expr->get_param_expr(0)); + DATA_PRINTF(")"); + } + break; + } case T_FUN_GROUP_RANK: SET_SYMBOL_IF_EMPTY("rank"); case T_FUN_GROUP_DENSE_RANK: @@ -4616,6 +4649,10 @@ int ObRawExprPrinter::print_cast_type(ObRawExpr *expr) } break; } + case T_ROARINGBITMAP: { + DATA_PRINTF("roaringbitmap"); + break; + } default: { ret = OB_ERR_UNEXPECTED; LOG_WARN("unknown cast type", K(ret), K(cast_type)); diff --git a/src/sql/resolver/cmd/ob_show_resolver.cpp b/src/sql/resolver/cmd/ob_show_resolver.cpp index f1e114c2b..856801c26 100644 --- a/src/sql/resolver/cmd/ob_show_resolver.cpp +++ b/src/sql/resolver/cmd/ob_show_resolver.cpp @@ -2457,6 +2457,7 @@ int ObShowResolver::replace_where_clause(ParseNode* node, const ObShowResolverCo case T_LOB: case T_JSON: case T_GEOMETRY: + case T_ROARINGBITMAP: case T_IEEE754_NAN: case T_IEEE754_INFINITE: { break;//do nothing diff --git a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp index be0b81034..a5e59b3c6 100644 --- a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp +++ b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp @@ -6208,8 +6208,37 @@ int ObAlterTableResolver::resolve_modify_column(const ParseNode &node, LOG_WARN("can't set primary key nullable", K(ret)); } else if (OB_FAIL(check_alter_geo_column_allowed(alter_column_schema, *origin_col_schema))) { LOG_WARN("modify geo column not allowed", K(ret)); + } else if (ObGeometryType == origin_col_schema->get_data_type() + && ObGeometryType == alter_column_schema.get_data_type() + && alter_column_schema.get_geo_type() != common::ObGeoType::GEOMETRY + && origin_col_schema->get_geo_type() != common::ObGeoType::GEOMETRY + && origin_col_schema->get_geo_type() != alter_column_schema.get_geo_type()) { + ret = OB_ERR_CANT_CREATE_GEOMETRY_OBJECT; + LOG_USER_ERROR(OB_ERR_CANT_CREATE_GEOMETRY_OBJECT); + LOG_WARN("can't not modify geometry type", K(ret), K(origin_col_schema->get_geo_type()), + K(alter_column_schema.get_geo_type())); + } else if (ObGeometryType == origin_col_schema->get_data_type() + && ObGeometryType == alter_column_schema.get_data_type() + && origin_col_schema->get_srid() != alter_column_schema.get_srid()) { + ret = OB_NOT_SUPPORTED; + LOG_USER_ERROR(OB_NOT_SUPPORTED, "Modify geometry srid"); + LOG_WARN("can't not modify geometry srid", K(ret), + K(origin_col_schema->get_srid()), K(alter_column_schema.get_srid())); } else if (OB_FAIL(check_alter_multivalue_depend_column_allowed(alter_column_schema, *origin_col_schema))) { LOG_WARN("modify geo column not allowed", K(ret)); + } else if (origin_col_schema->get_data_type() == ObRoaringBitmapType + && alter_column_schema.get_data_type() != ObRoaringBitmapType + && !ob_is_string_type(alter_column_schema.get_data_type())) { + ret = OB_NOT_SUPPORTED; + LOG_USER_ERROR(OB_NOT_SUPPORTED, "Modify roaringbitmap to other type except string"); + LOG_WARN("can't not modify roaringbitmap type", K(ret), + K(origin_col_schema->get_data_type()), K(alter_column_schema.get_data_type())); + } else if (alter_column_schema.get_data_type() == ObRoaringBitmapType + && origin_col_schema->get_data_type() != ObRoaringBitmapType) { + ret = OB_NOT_SUPPORTED; + LOG_USER_ERROR(OB_NOT_SUPPORTED, "Modify other type to roaringbitmap"); + LOG_WARN("can't not modify other type to roaringbitmap type", K(ret), + K(origin_col_schema->get_data_type()), K(alter_column_schema.get_data_type())); } } } diff --git a/src/sql/resolver/ddl/ob_ddl_resolver.cpp b/src/sql/resolver/ddl/ob_ddl_resolver.cpp index e386bb8e5..3f077e692 100644 --- a/src/sql/resolver/ddl/ob_ddl_resolver.cpp +++ b/src/sql/resolver/ddl/ob_ddl_resolver.cpp @@ -422,6 +422,10 @@ int ObDDLResolver::check_add_column_as_pk_allowed(const ObColumnSchemaV2 &column ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column_schema.get_column_name_str().length(), column_schema.get_column_name_str().ptr()); SQL_RESV_LOG(WARN, "BLOB, TEXT column can't be primary key", K(ret), K(column_schema)); + } else if (ob_is_roaringbitmap(column_schema.get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column_schema.get_column_name_str().length(), column_schema.get_column_name_str().ptr()); + SQL_RESV_LOG(WARN, "roaringbitmap column can't be primary key", K(ret), K(column_schema)); } else if (ob_is_extend(column_schema.get_data_type()) || ob_is_user_defined_sql_type(column_schema.get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column_schema.get_column_name_str().length(), column_schema.get_column_name_str().ptr()); @@ -1046,6 +1050,9 @@ int ObDDLResolver::add_storing_column(const ObString &column_name, if (ob_is_text_tc(column_schema->get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column_name.length(), column_name.ptr()); + } else if (ob_is_roaringbitmap_tc(column_schema->get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column_name.length(), column_name.ptr()); } else if (ob_is_extend(column_schema->get_data_type()) || ob_is_user_defined_sql_type(column_schema->get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; @@ -3196,7 +3203,13 @@ int ObDDLResolver::resolve_column_definition(ObColumnSchemaV2 &column, } } - + if (OB_SUCC(ret) && tenant_data_version < DATA_VERSION_4_3_2_0) { + if (column.is_roaringbitmap() || data_type.get_meta_type().is_roaringbitmap()) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("tenant version is less than 4.3.2, roaringbitmap type not supported", K(ret), K(tenant_data_version)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "tenant version is less than 4.3.2, roaringbitmap type"); + } + } if (OB_SUCC(ret) && (column.is_string_type() || column.is_json() || column.is_geometry())) { ObCharsetType charset_type = charset_type_; ObCollationType collation_type = collation_type_; @@ -3212,7 +3225,7 @@ int ObDDLResolver::resolve_column_definition(ObColumnSchemaV2 &column, if (OB_FAIL(check_and_fill_column_charset_info(column, charset_type, collation_type))) { SQL_RESV_LOG(WARN, "fail to check and fill column charset info", K(ret)); } else if (data_type.get_meta_type().is_lob() || data_type.get_meta_type().is_json() - || data_type.get_meta_type().is_geometry()) { + || data_type.get_meta_type().is_geometry() || data_type.get_meta_type().is_roaringbitmap()) { if (OB_FAIL(check_text_column_length_and_promote(column, table_id_))) { SQL_RESV_LOG(WARN, "fail to check text or blob column length", K(ret), K(column)); } @@ -3661,6 +3674,10 @@ int ObDDLResolver::resolve_normal_column_attribute(ObColumnSchemaV2 &column, ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); SQL_RESV_LOG(WARN, "BLOB, TEXT column can't be primary key", K(column), K(ret)); + } else if (ob_is_roaringbitmap_tc(column.get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); + SQL_RESV_LOG(WARN, "roaringbitmap column can't be primary key", K(column), K(ret)); } else if (ob_is_extend(column.get_data_type()) || ob_is_user_defined_sql_type(column.get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); @@ -3695,6 +3712,10 @@ int ObDDLResolver::resolve_normal_column_attribute(ObColumnSchemaV2 &column, ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); SQL_RESV_LOG(WARN, "BLOB, TEXT column can't be unique key", K(column), K(ret)); + } else if (ob_is_roaringbitmap_tc(column.get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); + SQL_RESV_LOG(WARN, "roaringbitmap column can't be unique key", K(column), K(ret)); } else if (ob_is_extend(column.get_data_type()) || ob_is_user_defined_sql_type(column.get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); @@ -3729,7 +3750,7 @@ int ObDDLResolver::resolve_normal_column_attribute(ObColumnSchemaV2 &column, } case T_CONSTR_AUTO_INCREMENT: if (ob_is_text_tc(column.get_data_type()) || ob_is_json_tc(column.get_data_type()) - || ob_is_geometry_tc(column.get_data_type())) { + || ob_is_geometry_tc(column.get_data_type()) || ob_is_roaringbitmap_tc(column.get_data_type())) { ret = OB_ERR_COLUMN_SPEC; LOG_USER_ERROR(OB_ERR_COLUMN_SPEC, column.get_column_name_str().length(), column.get_column_name_str().ptr()); SQL_RESV_LOG(WARN, "BLOB, TEXT column can't set autoincrement", K(column), K(default_value), K(ret)); @@ -4615,6 +4636,10 @@ int ObDDLResolver::resolve_identity_column_attribute(ObColumnSchemaV2 &column, ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); SQL_RESV_LOG(WARN, "BLOB, TEXT column can't be primary key", K(column), K(ret)); + } else if (ob_is_roaringbitmap_tc(column.get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); + SQL_RESV_LOG(WARN, "roaringbitmap column can't be primary key", K(column), K(ret)); } else if (ob_is_extend(column.get_data_type()) || ob_is_user_defined_sql_type(column.get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); @@ -4645,6 +4670,10 @@ int ObDDLResolver::resolve_identity_column_attribute(ObColumnSchemaV2 &column, ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); SQL_RESV_LOG(WARN, "BLOB, TEXT column can't be unique key", K(column), K(ret)); + } else if (ob_is_text_tc(column.get_data_type())) { + ret = OB_ERR_WRONG_KEY_COLUMN; + LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); + SQL_RESV_LOG(WARN, "roaringbitmap column can't be unique key", K(column), K(ret)); } else if (ob_is_extend(column.get_data_type()) || ob_is_user_defined_sql_type(column.get_data_type())) { ret = OB_ERR_WRONG_KEY_COLUMN; LOG_USER_ERROR(OB_ERR_WRONG_KEY_COLUMN, column.get_column_name_str().length(), column.get_column_name_str().ptr()); @@ -4884,6 +4913,14 @@ int ObDDLResolver::cast_default_value(ObObj &default_value, *res_obj, default_value, res_obj))) { SQL_RESV_LOG(WARN, "check default value failed on mysql mode", K(ret), K(default_value), K(*res_obj)); } + } else if (ObRoaringBitmapTC == column_schema.get_data_type_class()) { + // remove lob header + ObString real_str; + if (OB_FAIL(sql::ObTextStringHelper::read_real_string_data(&allocator, default_value, real_str))) { + LOG_WARN("fail to get real data.", K(ret), K(real_str)); + } else { + default_value.set_string(ObRoaringBitmapType, real_str); + } } if (OB_FAIL(ret)) { ret = OB_INVALID_DEFAULT; @@ -5205,7 +5242,7 @@ int ObDDLResolver::check_text_length(ObCharsetType cs_type, int ret = OB_SUCCESS; int64_t mbmaxlen = 0; int32_t default_length = ObAccuracy::DDL_DEFAULT_ACCURACY[type].get_length(); - if(!(ob_is_text_tc(type) || ob_is_json_tc(type) || ob_is_geometry_tc(type)) + if(!(ob_is_text_tc(type) || ob_is_json_tc(type) || ob_is_geometry_tc(type) || ob_is_roaringbitmap_tc(type)) || CHARSET_INVALID == cs_type || CS_TYPE_INVALID == co_type) { ret = OB_ERR_UNEXPECTED; SQL_RESV_LOG(ERROR,"column infomation is error", K(cs_type), K(co_type), K(ret)); diff --git a/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp b/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp index 2ec59c983..41c015721 100644 --- a/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp +++ b/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp @@ -1523,6 +1523,14 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr &expr) } break; } + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { + if (OB_FAIL(set_rb_result_type(expr, result_type))) { + LOG_WARN("set rb_agg result type failed", K(ret)); + } + break; + } case T_FUN_GROUP_CONCAT: { need_add_cast = true; if (OB_FAIL(set_agg_group_concat_result_type(expr, result_type))) { @@ -1572,6 +1580,9 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr &expr) } else if (OB_UNLIKELY(ob_is_geometry(child_expr->get_data_type()))) { ret = OB_INVALID_ARGUMENT; LOG_WARN("Incorrect geometry arguments", K(child_expr->get_data_type()), K(ret)); + } else if (OB_UNLIKELY(ob_is_roaringbitmap(child_expr->get_data_type()))) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("Incorrect roaringbitmap arguments", K(child_expr->get_data_type()), K(ret)); } else if (lib::is_oracle_mode()) { ObObjType from_type = child_expr->get_result_type().get_type(); ObCollationType from_cs_type = child_expr->get_result_type().get_collation_type(); @@ -3267,6 +3278,9 @@ int ObRawExprDeduceType::set_agg_min_max_result_type(ObAggFunRawExpr &expr, } else if (OB_UNLIKELY(ob_is_geometry(child_expr->get_data_type()))) { ret = OB_INVALID_ARGUMENT; LOG_WARN("Incorrect geometry arguments", K(child_expr->get_data_type()), K(ret)); + } else if (OB_UNLIKELY(ob_is_roaringbitmap(child_expr->get_data_type()))) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("Incorrect roaringbitmap arguments", K(child_expr->get_data_type()), K(ret)); } else if (OB_UNLIKELY(ob_is_enumset_tc(child_expr->get_data_type()))) { // To compatible with MySQL, we need to add cast expression that enumset to varchar // to evalute MIN/MAX aggregate functions. @@ -3354,6 +3368,23 @@ int ObRawExprDeduceType::set_asmvt_result_type(ObAggFunRawExpr &expr, return ret; } +int ObRawExprDeduceType::set_rb_result_type(ObAggFunRawExpr &expr, + ObExprResType& result_type) +{ + int ret = OB_SUCCESS; + if (OB_UNLIKELY(expr.get_real_param_count() != 1)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("get unexpected error", K(ret), K(expr.get_param_count()), K(expr.get_real_param_count()), K(expr)); + } else { + result_type.set_type(ObRoaringBitmapType); + result_type.set_collation_type(CS_TYPE_BINARY); + result_type.set_collation_level(CS_LEVEL_IMPLICIT); + result_type.set_accuracy(ObAccuracy::DDL_DEFAULT_ACCURACY[ObRoaringBitmapType]); + expr.set_result_type(result_type); + } + return ret; +} + int ObRawExprDeduceType::set_xmlagg_result_type(ObAggFunRawExpr &expr, ObExprResType& result_type) { diff --git a/src/sql/resolver/expr/ob_raw_expr_deduce_type.h b/src/sql/resolver/expr/ob_raw_expr_deduce_type.h index b50b60fc3..621533f88 100644 --- a/src/sql/resolver/expr/ob_raw_expr_deduce_type.h +++ b/src/sql/resolver/expr/ob_raw_expr_deduce_type.h @@ -108,6 +108,7 @@ private: int set_agg_group_concat_result_type(ObAggFunRawExpr &expr, ObExprResType &result_type); int set_json_agg_result_type(ObAggFunRawExpr &expr, ObExprResType& result_type, bool &need_add_cast); int set_asmvt_result_type(ObAggFunRawExpr &expr, ObExprResType& result_type); + int set_rb_result_type(ObAggFunRawExpr &expr, ObExprResType& result_type); int set_agg_json_array_result_type(ObAggFunRawExpr &expr, ObExprResType &result_type); int set_agg_min_max_result_type(ObAggFunRawExpr &expr, ObExprResType &result_type, diff --git a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp index 300fdcdab..8e54f24c9 100644 --- a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp +++ b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp @@ -784,7 +784,10 @@ int ObRawExprResolverImpl::do_recursive_resolve(const ParseNode *node, case T_FUN_ORA_JSON_OBJECTAGG: case T_FUN_ORA_XMLAGG: case T_FUN_SUM_OPNSIZE: - case T_FUN_SYS_ST_ASMVT: { + case T_FUN_SYS_ST_ASMVT: + case T_FUN_SYS_RB_BUILD_AGG: + case T_FUN_SYS_RB_OR_AGG: + case T_FUN_SYS_RB_AND_AGG: { if (OB_FAIL(process_agg_node(node, expr))) { LOG_WARN("fail to process agg node", K(ret), K(node)); } @@ -4812,6 +4815,19 @@ int ObRawExprResolverImpl::process_agg_node(const ParseNode *node, ObRawExpr *&e LOG_WARN("fail to add param expr to agg expr", K(ret)); } } // end for + } else if (T_FUN_SYS_RB_BUILD_AGG == node->type_ + || T_FUN_SYS_RB_OR_AGG == node->type_ + || T_FUN_SYS_RB_AND_AGG == node->type_) { + for (int64_t i = 0; OB_SUCC(ret) && i < node->num_child_; ++i) { + sub_expr = NULL; + if (OB_ISNULL(node->children_[i])) { + // do nothing + } else if (OB_FAIL(SMART_CALL(recursive_resolve(node->children_[i], sub_expr)))) { + LOG_WARN("fail to recursive resolve expr list item", K(ret)); + } else if (OB_FAIL(agg_expr->add_real_param_expr(sub_expr))) { + LOG_WARN("fail to add param expr to agg expr", K(ret)); + } + } // end for } else if (T_FUN_ORA_XMLAGG == node->type_) { sub_expr = NULL; for (int64_t i = 0; OB_SUCC(ret) && i < node->num_child_; ++i) { diff --git a/src/sql/resolver/ob_resolver_utils.cpp b/src/sql/resolver/ob_resolver_utils.cpp index 7e7cb2258..df3c882aa 100644 --- a/src/sql/resolver/ob_resolver_utils.cpp +++ b/src/sql/resolver/ob_resolver_utils.cpp @@ -6461,6 +6461,21 @@ int ObResolverUtils::resolve_data_type(const ParseNode &type_node, } //} break; + case ObRoaringBitmapTC: { + uint64_t tenant_data_version = 0; + if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, tenant_data_version))) { + LOG_WARN("get tenant data version failed", K(ret)); + } else if (tenant_data_version < DATA_VERSION_4_3_2_0) { + ret = OB_NOT_SUPPORTED; + LOG_USER_ERROR(OB_NOT_SUPPORTED, "tenant version is less than 4.3.2, roaringbitmap type"); + } else { + data_type.set_length(length); + data_type.set_scale(default_accuracy.get_scale()); + data_type.set_charset_type(CHARSET_BINARY); + data_type.set_collation_type(CS_TYPE_BINARY); + } + break; + } default: ret = OB_ERR_ILLEGAL_TYPE; SQL_RESV_LOG(WARN, "Unsupport data type of column definiton", K(ident_name), K(data_type), K(ret)); diff --git a/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.cpp b/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.cpp index 59b40fc49..aea7467d4 100644 --- a/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.cpp +++ b/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.cpp @@ -175,7 +175,8 @@ int ObCSEncodingUtil::build_cs_column_encoding_ctx(ObEncodingHashTable *ht, case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { // geometry, json and text storage class have the same behavior currently + case ObGeometrySC: + case ObRoaringBitmapSC: { // geometry, json and text storage class have the same behavior currently col_ctx.fix_data_size_ = -1; col_ctx.max_string_size_ = -1; bool var_store = false; diff --git a/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.h b/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.h index 5506613d1..3b1ef4e5c 100644 --- a/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.h +++ b/src/storage/blocksstable/cs_encoding/ob_cs_encoding_util.h @@ -42,7 +42,7 @@ public: { // ObOTimestampSC and ObIntervalSC are fixed len string return ObNumberSC == sc || ObStringSC == sc || ObTextSC == sc || - ObLobSC == sc || ObJsonSC == sc || ObGeometrySC == sc; + ObLobSC == sc || ObJsonSC == sc || ObGeometrySC == sc || ObRoaringBitmapSC == sc; } static OB_INLINE bool is_integer_store_class(const ObObjTypeStoreClass sc) { @@ -52,7 +52,7 @@ public: { return ObNumberSC == sc || ObStringSC == sc || ObTextSC == sc || sc == ObLobSC || ObJsonSC == sc || ObGeometrySC == sc || - ObOTimestampSC == sc || ObIntervalSC == sc; + ObOTimestampSC == sc || ObIntervalSC == sc || ObRoaringBitmapSC == sc; } // the sql layer does not allow to modify ptr of datums of these store class, @@ -64,7 +64,7 @@ public: static OB_INLINE bool is_no_need_sort_lob(const ObObjTypeStoreClass sc) { // ObTextSC type sorting can speeds up filter, ObLobSC/ObJsonSC/ObGeometrySC sorting is meaningless - return sc == ObLobSC || sc == ObJsonSC || sc == ObGeometrySC; + return sc == ObLobSC || sc == ObJsonSC || sc == ObGeometrySC || ObRoaringBitmapSC == sc; } static int build_cs_column_encoding_ctx(ObEncodingHashTable *ht, diff --git a/src/storage/blocksstable/encoding/ob_column_equal_decoder.cpp b/src/storage/blocksstable/encoding/ob_column_equal_decoder.cpp index be32deacb..3f53f7363 100644 --- a/src/storage/blocksstable/encoding/ob_column_equal_decoder.cpp +++ b/src/storage/blocksstable/encoding/ob_column_equal_decoder.cpp @@ -84,7 +84,8 @@ int ObColumnEqualDecoder::decode(const ObColumnDecoderCtx &ctx, ObDatum &datum, case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { if (OB_FAIL(ObBitMapMetaReader::read( meta_header_->payload_, ctx.micro_block_header_->row_count_, ctx.is_bit_packing(), row_id, diff --git a/src/storage/blocksstable/encoding/ob_column_equal_encoder.cpp b/src/storage/blocksstable/encoding/ob_column_equal_encoder.cpp index bb4c4dcb6..7144cfa4c 100644 --- a/src/storage/blocksstable/encoding/ob_column_equal_encoder.cpp +++ b/src/storage/blocksstable/encoding/ob_column_equal_encoder.cpp @@ -158,7 +158,8 @@ int ObColumnEqualEncoder::traverse(bool &suitable) case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { ObStringBitMapMetaWriter *meta_writer = static_cast(&base_meta_writer_); if (OB_FAIL(meta_writer->init(&exc_row_ids_, ctx_->col_datums_, column_type_))) { @@ -271,7 +272,8 @@ int ObColumnEqualEncoder::store_meta(ObBufferWriter &writer) case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { ObStringBitMapMetaWriter *meta_writer = static_cast(&base_meta_writer_); if (OB_FAIL(meta_writer->write(buf))) { diff --git a/src/storage/blocksstable/encoding/ob_const_decoder.cpp b/src/storage/blocksstable/encoding/ob_const_decoder.cpp index fe9b24783..cf8ed1f5b 100644 --- a/src/storage/blocksstable/encoding/ob_const_decoder.cpp +++ b/src/storage/blocksstable/encoding/ob_const_decoder.cpp @@ -273,7 +273,8 @@ int ObConstDecoder::batch_decode_without_dict( case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { for (int64_t i = 1; i < row_cap; ++i) { datums[i].pack_ = datums[0].pack_; datums[i].ptr_ = datums[0].ptr_; diff --git a/src/storage/blocksstable/encoding/ob_const_encoder.cpp b/src/storage/blocksstable/encoding/ob_const_encoder.cpp index 3d066621e..59851819a 100644 --- a/src/storage/blocksstable/encoding/ob_const_encoder.cpp +++ b/src/storage/blocksstable/encoding/ob_const_encoder.cpp @@ -218,7 +218,8 @@ int ObConstEncoder::get_cell_len(const ObDatum &datum, int64_t &length) const case ObJsonSC: case ObOTimestampSC: case ObIntervalSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { length = datum.len_; break; } @@ -253,7 +254,8 @@ int ObConstEncoder::store_value(const ObDatum &datum, char *buf) case ObJsonSC: case ObOTimestampSC: case ObIntervalSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { MEMCPY(buf, datum.ptr_, datum.len_); break; } diff --git a/src/storage/blocksstable/encoding/ob_dict_encoder.cpp b/src/storage/blocksstable/encoding/ob_dict_encoder.cpp index e2abc00df..aaf92689b 100644 --- a/src/storage/blocksstable/encoding/ob_dict_encoder.cpp +++ b/src/storage/blocksstable/encoding/ob_dict_encoder.cpp @@ -301,6 +301,7 @@ int ObDictEncoder::store_dict(const ObDatum &datum, char *buf, int64_t &len) case ObOTimestampSC: case ObIntervalSC: case ObGeometrySC: + case ObRoaringBitmapSC: MEMCPY(buf, datum.ptr_, datum.len_); len = datum.len_; break; diff --git a/src/storage/blocksstable/encoding/ob_encoding_hash_util.cpp b/src/storage/blocksstable/encoding/ob_encoding_hash_util.cpp index 79c122825..3b5a6ec09 100644 --- a/src/storage/blocksstable/encoding/ob_encoding_hash_util.cpp +++ b/src/storage/blocksstable/encoding/ob_encoding_hash_util.cpp @@ -117,7 +117,7 @@ int ObEncodingHashTableBuilder::build(const ObColDatums &col_datums, const ObCol } else { ObObjTypeStoreClass store_class = get_store_class_map()[col_desc.col_type_.get_type_class()]; const bool need_binary_hash = - (store_class == ObTextSC || store_class == ObJsonSC || store_class == ObLobSC || store_class == ObGeometrySC); + (store_class == ObTextSC || store_class == ObJsonSC || store_class == ObLobSC || store_class == ObGeometrySC || store_class == ObRoaringBitmapSC); bool has_lob_header = col_desc.col_type_.is_lob_storage(); ObPrecision precision = PRECISION_UNKNOWN_YET; if (col_desc.col_type_.is_decimal_int()) { @@ -363,7 +363,8 @@ int build_column_encoding_ctx(ObEncodingHashTable *ht, case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { // geometry, json and text storage class have the same behavior currently + case ObGeometrySC: + case ObRoaringBitmapSC: { // geometry, json and text storage class have the same behavior currently col_ctx.fix_data_size_ = -1; col_ctx.max_string_size_ = -1; bool var_store = false; diff --git a/src/storage/blocksstable/encoding/ob_encoding_query_util.h b/src/storage/blocksstable/encoding/ob_encoding_query_util.h index ecfb30737..800883eb7 100644 --- a/src/storage/blocksstable/encoding/ob_encoding_query_util.h +++ b/src/storage/blocksstable/encoding/ob_encoding_query_util.h @@ -190,6 +190,7 @@ OB_INLINE int32_t *get_store_class_tag_map() -1, // ObLobSC -1, // ObJsonSC -1, // ObGeometrySC + -1, // ObRoaringBitmapSC -1 // ObMaxSC }; return store_class_tag_map; diff --git a/src/storage/blocksstable/encoding/ob_encoding_util.h b/src/storage/blocksstable/encoding/ob_encoding_util.h index 3c1fdf07d..52426f8fb 100644 --- a/src/storage/blocksstable/encoding/ob_encoding_util.h +++ b/src/storage/blocksstable/encoding/ob_encoding_util.h @@ -71,23 +71,24 @@ enum ObObjTypeStoreClass ObLobSC, //lob ObJsonSC, // json ObGeometrySC, // geometry + ObRoaringBitmapSC, // roaringbitmap ObMaxSC, }; OB_INLINE bool is_string_encoding_valid(const ObObjTypeStoreClass sc) { - return (sc == ObStringSC || sc == ObTextSC || sc == ObJsonSC || sc == ObGeometrySC); + return (sc == ObStringSC || sc == ObTextSC || sc == ObJsonSC || sc == ObGeometrySC || sc == ObRoaringBitmapSC); } OB_INLINE bool store_class_might_contain_lob_locator(const ObObjTypeStoreClass sc) { - return (sc == ObTextSC || sc == ObLobSC || sc == ObJsonSC || sc == ObGeometrySC); + return (sc == ObTextSC || sc == ObLobSC || sc == ObJsonSC || sc == ObGeometrySC || sc == ObRoaringBitmapSC); } OB_INLINE bool is_var_length_type(const ObObjTypeStoreClass sc) { return (sc == ObNumberSC || sc == ObDecimalIntSC || sc == ObStringSC || sc == ObTextSC - || sc == ObLobSC || sc == ObJsonSC || sc == ObGeometrySC); + || sc == ObLobSC || sc == ObJsonSC || sc == ObGeometrySC || sc == ObRoaringBitmapSC); } OB_INLINE ObObjTypeStoreClass *get_store_class_map() @@ -122,6 +123,7 @@ OB_INLINE ObObjTypeStoreClass *get_store_class_map() ObTextSC, // ObCollectionSQLTC ObIntSC, // ObMySQLDateTC ObIntSC, // ObMySQLDateTimeTc + ObRoaringBitmapSC, // ObRoaringBitmapTC ObMaxSC // ObMaxTC }; STATIC_ASSERT(ARRAYSIZEOF(store_class_map) == common::ObMaxTC + 1, @@ -186,6 +188,7 @@ OB_INLINE int64_t *get_type_size_map() -1, //ObCollectionSQLType 4, // ObMySQLDateType 8, // ObMySQLDateTimeType + -1, //RoaringBitmap -1 // ObMaxType }; STATIC_ASSERT(ARRAYSIZEOF(type_size_map) == common::ObMaxType + 1, @@ -251,6 +254,7 @@ OB_INLINE int64_t *get_estimate_base_store_size_map() 8, // ObCollectionSQLType 8, // ObMySQLDateType 8, // ObMySQLDateTimeType + 9, // ObRoaringBitmapType -1 // ObMaxType }; STATIC_ASSERT(ARRAYSIZEOF(estimate_base_store_size_map) == common::ObMaxType + 1, @@ -454,7 +458,8 @@ inline static int batch_load_data_to_datum( case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { for (int64_t i = 0; i < row_cap; ++i) { if (!datums[i].is_null()) { datums[i].ptr_ = cell_datas[i]; @@ -536,6 +541,7 @@ inline static int load_data_to_datum( case ObTextSC: case ObJsonSC: case ObGeometrySC: + case ObRoaringBitmapSC: { datum.pack_= static_cast(cell_len); datum.ptr_ = cell_data; diff --git a/src/storage/blocksstable/encoding/ob_raw_encoder.cpp b/src/storage/blocksstable/encoding/ob_raw_encoder.cpp index f92230f70..39a10bd38 100644 --- a/src/storage/blocksstable/encoding/ob_raw_encoder.cpp +++ b/src/storage/blocksstable/encoding/ob_raw_encoder.cpp @@ -129,6 +129,7 @@ int ObRawEncoder::traverse(const bool force_var_store, bool &suitable) case ObTextSC: case ObJsonSC: case ObGeometrySC: + case ObRoaringBitmapSC: case ObOTimestampSC: case ObIntervalSC: { if (force_var_store || fix_data_size_ < 0) { @@ -218,6 +219,7 @@ int ObRawEncoder::get_var_length(const int64_t row_id, int64_t &length) case ObTextSC: case ObJsonSC: case ObGeometrySC: + case ObRoaringBitmapSC: case ObOTimestampSC: case ObIntervalSC: { length = datum.len_; diff --git a/src/storage/blocksstable/encoding/ob_raw_encoder.h b/src/storage/blocksstable/encoding/ob_raw_encoder.h index db949a92c..e7510fdc7 100644 --- a/src/storage/blocksstable/encoding/ob_raw_encoder.h +++ b/src/storage/blocksstable/encoding/ob_raw_encoder.h @@ -104,6 +104,7 @@ OB_INLINE int ObRawEncoder::store_data( case ObTextSC: case ObJsonSC: case ObGeometrySC: + case ObRoaringBitmapSC: case ObOTimestampSC: case ObIntervalSC: { MEMCPY(buf, datum.ptr_, datum.len_); diff --git a/src/storage/blocksstable/encoding/ob_vector_decode_util.cpp b/src/storage/blocksstable/encoding/ob_vector_decode_util.cpp index a2980f28a..e33db1093 100644 --- a/src/storage/blocksstable/encoding/ob_vector_decode_util.cpp +++ b/src/storage/blocksstable/encoding/ob_vector_decode_util.cpp @@ -666,7 +666,8 @@ int ObLoadVarByteAlignedVecDataDispatcher::l case ObStringSC: case ObTextSC: case ObJsonSC: - case ObGeometrySC: { + case ObGeometrySC: + case ObRoaringBitmapSC: { decode_method_type = D_SHALLOW_COPY; break; } diff --git a/src/storage/blocksstable/index_block/ob_index_block_util.h b/src/storage/blocksstable/index_block/ob_index_block_util.h index 7305398d8..c2a807aae 100644 --- a/src/storage/blocksstable/index_block/ob_index_block_util.h +++ b/src/storage/blocksstable/index_block/ob_index_block_util.h @@ -157,7 +157,7 @@ OB_INLINE static int get_skip_index_store_upper_size( OB_INLINE static bool is_skip_index_black_list_type(const ObObjType &obj_type) { return ObNullType == obj_type || ob_is_json_tc(obj_type) || ob_is_geometry_tc(obj_type) - || ob_is_user_defined_sql_type(obj_type); + || ob_is_user_defined_sql_type(obj_type) || ob_is_roaringbitmap_tc(obj_type); } OB_INLINE static bool is_skip_index_while_list_type(const ObObjType &obj_type) diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type.result index b5f5e7e29..1e75119bb 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type.result @@ -55,6 +55,7 @@ data_type data_type_str data_type_class 51 COLLECTION 26 52 MYSQL_DATE 27 53 MYSQL_DATETIME 28 +54 ROARINGBITMAP 29 select data_type, data_type_str, data_type_class from __all_virtual_data_type order by data_type; data_type data_type_str data_type_class 0 NULL 0 @@ -111,6 +112,7 @@ data_type data_type_str data_type_class 51 COLLECTION 26 52 MYSQL_DATE 27 53 MYSQL_DATETIME 28 +54 ROARINGBITMAP 29 select * from __all_virtual_data_type where data_type = 22; data_type data_type_str data_type_class 22 VARCHAR 10 @@ -168,6 +170,7 @@ DECIMAL_INT DECIMAL_INT COLLECTION COLLECTION MYSQL_DATE MYSQL_DATE MYSQL_DATETIME MYSQL_DATETIME +ROARINGBITMAP ROARINGBITMAP show create table __all_virtual_data_type; Table Create Table __all_virtual_data_type CREATE TABLE `__all_virtual_data_type` ( diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type_class.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type_class.result index 2bdbd2ba3..ea4636955 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type_class.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_data_type_class.result @@ -29,6 +29,7 @@ data_type_class data_type_class_str 26 COLLECTION 27 MYSQL_DATE 28 MYSQL_DATETIME +29 ROARINGBITMAP select data_type_class, data_type_class_str from __all_virtual_data_type_class; data_type_class data_type_class_str 0 NULL @@ -59,6 +60,7 @@ data_type_class data_type_class_str 26 COLLECTION 27 MYSQL_DATE 28 MYSQL_DATETIME +29 ROARINGBITMAP select * from __all_virtual_data_type_class where data_type_class = 10; data_type_class data_type_class_str 10 STRING @@ -116,6 +118,7 @@ DECIMAL_INT DECIMAL_INT COLLECTION COLLECTION MYSQL_DATE MYSQL_DATE MYSQL_DATETIME MYSQL_DATETIME +ROARINGBITMAP ROARINGBITMAP show create table __all_virtual_data_type_class; Table Create Table __all_virtual_data_type_class CREATE TABLE `__all_virtual_data_type_class` ( diff --git a/unittest/share/CMakeLists.txt b/unittest/share/CMakeLists.txt index 206b885d4..92f7f730f 100644 --- a/unittest/share/CMakeLists.txt +++ b/unittest/share/CMakeLists.txt @@ -69,6 +69,7 @@ ob_unittest(test_geo_func_difference) ob_unittest(test_geo_func_union) ob_unittest(test_geo_func_box) ob_unittest(test_throttling_utils) +ob_unittest(test_roaringbitmap) ob_unittest(test_json_base) ob_unittest(test_json_bin) diff --git a/unittest/share/test_defined_expr_func_by_type.result b/unittest/share/test_defined_expr_func_by_type.result index 10913af43..d635139ee 100644 --- a/unittest/share/test_defined_expr_func_by_type.result +++ b/unittest/share/test_defined_expr_func_by_type.result @@ -54,6 +54,7 @@ : defined : defined : defined + : defined /**************** TINYINT ****************/ @@ -111,6 +112,7 @@ : not defined : not defined : not defined + : not defined /**************** SMALLINT ****************/ @@ -168,6 +170,7 @@ : not defined : not defined : not defined + : not defined /**************** MEDIUMINT ****************/ @@ -225,6 +228,7 @@ : not defined : not defined : not defined + : not defined /**************** INT ****************/ @@ -282,6 +286,7 @@ : not defined : not defined : not defined + : not defined /**************** BIGINT ****************/ @@ -339,6 +344,7 @@ : not defined : not defined : not defined + : not defined /**************** TINYINT UNSIGNED ****************/ @@ -396,6 +402,7 @@ : not defined : not defined : not defined + : not defined /**************** SMALLINT UNSIGNED ****************/ @@ -453,6 +460,7 @@ : not defined : not defined : not defined + : not defined /**************** MEDIUMINT UNSIGNED ****************/ @@ -510,6 +518,7 @@ : not defined : not defined : not defined + : not defined /**************** INT UNSIGNED ****************/ @@ -567,6 +576,7 @@ : not defined : not defined : not defined + : not defined /**************** BIGINT UNSIGNED ****************/ @@ -624,6 +634,7 @@ : not defined : not defined : not defined + : not defined /**************** FLOAT ****************/ @@ -681,6 +692,7 @@ : not defined : not defined : not defined + : not defined /**************** DOUBLE ****************/ @@ -738,6 +750,7 @@ : not defined : not defined : not defined + : not defined /**************** FLOAT UNSIGNED ****************/ @@ -795,6 +808,7 @@ : not defined : not defined : not defined + : not defined /**************** DOUBLE UNSIGNED ****************/ @@ -852,6 +866,7 @@ : not defined : not defined : not defined + : not defined /**************** DECIMAL ****************/ @@ -909,6 +924,7 @@ : not defined : not defined : not defined + : not defined /**************** DECIMAL UNSIGNED ****************/ @@ -966,6 +982,7 @@ : not defined : not defined : not defined + : not defined /**************** DATETIME ****************/ @@ -1023,6 +1040,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP ****************/ @@ -1080,6 +1098,7 @@ : not defined : not defined : not defined + : not defined /**************** DATE ****************/ @@ -1137,6 +1156,7 @@ : not defined : not defined : not defined + : not defined /**************** TIME ****************/ @@ -1194,6 +1214,7 @@ : not defined : not defined : not defined + : not defined /**************** YEAR ****************/ @@ -1251,6 +1272,7 @@ : not defined : not defined : not defined + : not defined /**************** VARCHAR ****************/ @@ -1308,6 +1330,7 @@ : not defined : not defined : not defined + : not defined /**************** CHAR ****************/ @@ -1365,6 +1388,7 @@ : not defined : not defined : not defined + : not defined /**************** HEX_STRING ****************/ @@ -1422,6 +1446,7 @@ : not defined : not defined : not defined + : not defined /**************** EXT ****************/ @@ -1479,6 +1504,7 @@ : defined : defined : defined + : defined /**************** UNKNOWN ****************/ @@ -1536,6 +1562,7 @@ : not defined : not defined : not defined + : not defined /**************** TINYTEXT ****************/ @@ -1593,6 +1620,7 @@ : not defined : not defined : not defined + : not defined /**************** TEXT ****************/ @@ -1650,6 +1678,7 @@ : not defined : not defined : not defined + : not defined /**************** MEDIUMTEXT ****************/ @@ -1707,6 +1736,7 @@ : not defined : not defined : not defined + : not defined /**************** LONGTEXT ****************/ @@ -1764,6 +1794,7 @@ : not defined : not defined : not defined + : not defined /**************** BIT ****************/ @@ -1821,6 +1852,7 @@ : not defined : not defined : not defined + : not defined /**************** ENUM ****************/ @@ -1878,6 +1910,7 @@ : not defined : not defined : not defined + : not defined /**************** SET ****************/ @@ -1935,6 +1968,7 @@ : not defined : not defined : not defined + : not defined /**************** ENUM_INNER ****************/ @@ -1992,6 +2026,7 @@ : not defined : not defined : not defined + : not defined /**************** SET_INNER ****************/ @@ -2049,6 +2084,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP_WITH_TIME_ZONE ****************/ @@ -2106,6 +2142,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP_WITH_LOCAL_TIME_ZONE ****************/ @@ -2163,6 +2200,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP ****************/ @@ -2220,6 +2258,7 @@ : not defined : not defined : not defined + : not defined /**************** RAW ****************/ @@ -2277,6 +2316,7 @@ : not defined : not defined : not defined + : not defined /**************** INTERVAL_YEAR_TO_MONTH ****************/ @@ -2334,6 +2374,7 @@ : not defined : not defined : not defined + : not defined /**************** INTERVAL_DAY_TO_SECOND ****************/ @@ -2391,6 +2432,7 @@ : not defined : not defined : not defined + : not defined /**************** NUMBER_FLOAT ****************/ @@ -2448,6 +2490,7 @@ : not defined : not defined : not defined + : not defined /**************** NVARCHAR2 ****************/ @@ -2505,6 +2548,7 @@ : not defined : not defined : not defined + : not defined /**************** NCHAR ****************/ @@ -2562,6 +2606,7 @@ : not defined : not defined : not defined + : not defined /**************** ROWID ****************/ @@ -2619,6 +2664,7 @@ : not defined : not defined : not defined + : not defined /**************** LOB ****************/ @@ -2676,6 +2722,7 @@ : not defined : not defined : not defined + : not defined /**************** JSON ****************/ @@ -2733,6 +2780,7 @@ : not defined : not defined : not defined + : not defined /**************** GEOMETRY ****************/ @@ -2790,6 +2838,7 @@ : not defined : not defined : not defined + : not defined /**************** UDT ****************/ @@ -2847,6 +2896,7 @@ : not defined : not defined : not defined + : not defined /**************** DECIMAL_INT ****************/ @@ -2904,6 +2954,7 @@ : not defined : not defined : not defined + : not defined /**************** COLLECTION ****************/ @@ -2961,6 +3012,7 @@ : not defined : not defined : not defined + : not defined /**************** MYSQL_DATE ****************/ @@ -3018,6 +3070,7 @@ : not defined : not defined : not defined + : not defined /**************** MYSQL_DATETIME ****************/ @@ -3075,4 +3128,63 @@ : not defined : not defined : not defined + : not defined + +/**************** ROARINGBITMAP ****************/ + + : defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined diff --git a/unittest/share/test_defined_func_by_type.result b/unittest/share/test_defined_func_by_type.result index 10913af43..d635139ee 100644 --- a/unittest/share/test_defined_func_by_type.result +++ b/unittest/share/test_defined_func_by_type.result @@ -54,6 +54,7 @@ : defined : defined : defined + : defined /**************** TINYINT ****************/ @@ -111,6 +112,7 @@ : not defined : not defined : not defined + : not defined /**************** SMALLINT ****************/ @@ -168,6 +170,7 @@ : not defined : not defined : not defined + : not defined /**************** MEDIUMINT ****************/ @@ -225,6 +228,7 @@ : not defined : not defined : not defined + : not defined /**************** INT ****************/ @@ -282,6 +286,7 @@ : not defined : not defined : not defined + : not defined /**************** BIGINT ****************/ @@ -339,6 +344,7 @@ : not defined : not defined : not defined + : not defined /**************** TINYINT UNSIGNED ****************/ @@ -396,6 +402,7 @@ : not defined : not defined : not defined + : not defined /**************** SMALLINT UNSIGNED ****************/ @@ -453,6 +460,7 @@ : not defined : not defined : not defined + : not defined /**************** MEDIUMINT UNSIGNED ****************/ @@ -510,6 +518,7 @@ : not defined : not defined : not defined + : not defined /**************** INT UNSIGNED ****************/ @@ -567,6 +576,7 @@ : not defined : not defined : not defined + : not defined /**************** BIGINT UNSIGNED ****************/ @@ -624,6 +634,7 @@ : not defined : not defined : not defined + : not defined /**************** FLOAT ****************/ @@ -681,6 +692,7 @@ : not defined : not defined : not defined + : not defined /**************** DOUBLE ****************/ @@ -738,6 +750,7 @@ : not defined : not defined : not defined + : not defined /**************** FLOAT UNSIGNED ****************/ @@ -795,6 +808,7 @@ : not defined : not defined : not defined + : not defined /**************** DOUBLE UNSIGNED ****************/ @@ -852,6 +866,7 @@ : not defined : not defined : not defined + : not defined /**************** DECIMAL ****************/ @@ -909,6 +924,7 @@ : not defined : not defined : not defined + : not defined /**************** DECIMAL UNSIGNED ****************/ @@ -966,6 +982,7 @@ : not defined : not defined : not defined + : not defined /**************** DATETIME ****************/ @@ -1023,6 +1040,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP ****************/ @@ -1080,6 +1098,7 @@ : not defined : not defined : not defined + : not defined /**************** DATE ****************/ @@ -1137,6 +1156,7 @@ : not defined : not defined : not defined + : not defined /**************** TIME ****************/ @@ -1194,6 +1214,7 @@ : not defined : not defined : not defined + : not defined /**************** YEAR ****************/ @@ -1251,6 +1272,7 @@ : not defined : not defined : not defined + : not defined /**************** VARCHAR ****************/ @@ -1308,6 +1330,7 @@ : not defined : not defined : not defined + : not defined /**************** CHAR ****************/ @@ -1365,6 +1388,7 @@ : not defined : not defined : not defined + : not defined /**************** HEX_STRING ****************/ @@ -1422,6 +1446,7 @@ : not defined : not defined : not defined + : not defined /**************** EXT ****************/ @@ -1479,6 +1504,7 @@ : defined : defined : defined + : defined /**************** UNKNOWN ****************/ @@ -1536,6 +1562,7 @@ : not defined : not defined : not defined + : not defined /**************** TINYTEXT ****************/ @@ -1593,6 +1620,7 @@ : not defined : not defined : not defined + : not defined /**************** TEXT ****************/ @@ -1650,6 +1678,7 @@ : not defined : not defined : not defined + : not defined /**************** MEDIUMTEXT ****************/ @@ -1707,6 +1736,7 @@ : not defined : not defined : not defined + : not defined /**************** LONGTEXT ****************/ @@ -1764,6 +1794,7 @@ : not defined : not defined : not defined + : not defined /**************** BIT ****************/ @@ -1821,6 +1852,7 @@ : not defined : not defined : not defined + : not defined /**************** ENUM ****************/ @@ -1878,6 +1910,7 @@ : not defined : not defined : not defined + : not defined /**************** SET ****************/ @@ -1935,6 +1968,7 @@ : not defined : not defined : not defined + : not defined /**************** ENUM_INNER ****************/ @@ -1992,6 +2026,7 @@ : not defined : not defined : not defined + : not defined /**************** SET_INNER ****************/ @@ -2049,6 +2084,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP_WITH_TIME_ZONE ****************/ @@ -2106,6 +2142,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP_WITH_LOCAL_TIME_ZONE ****************/ @@ -2163,6 +2200,7 @@ : not defined : not defined : not defined + : not defined /**************** TIMESTAMP ****************/ @@ -2220,6 +2258,7 @@ : not defined : not defined : not defined + : not defined /**************** RAW ****************/ @@ -2277,6 +2316,7 @@ : not defined : not defined : not defined + : not defined /**************** INTERVAL_YEAR_TO_MONTH ****************/ @@ -2334,6 +2374,7 @@ : not defined : not defined : not defined + : not defined /**************** INTERVAL_DAY_TO_SECOND ****************/ @@ -2391,6 +2432,7 @@ : not defined : not defined : not defined + : not defined /**************** NUMBER_FLOAT ****************/ @@ -2448,6 +2490,7 @@ : not defined : not defined : not defined + : not defined /**************** NVARCHAR2 ****************/ @@ -2505,6 +2548,7 @@ : not defined : not defined : not defined + : not defined /**************** NCHAR ****************/ @@ -2562,6 +2606,7 @@ : not defined : not defined : not defined + : not defined /**************** ROWID ****************/ @@ -2619,6 +2664,7 @@ : not defined : not defined : not defined + : not defined /**************** LOB ****************/ @@ -2676,6 +2722,7 @@ : not defined : not defined : not defined + : not defined /**************** JSON ****************/ @@ -2733,6 +2780,7 @@ : not defined : not defined : not defined + : not defined /**************** GEOMETRY ****************/ @@ -2790,6 +2838,7 @@ : not defined : not defined : not defined + : not defined /**************** UDT ****************/ @@ -2847,6 +2896,7 @@ : not defined : not defined : not defined + : not defined /**************** DECIMAL_INT ****************/ @@ -2904,6 +2954,7 @@ : not defined : not defined : not defined + : not defined /**************** COLLECTION ****************/ @@ -2961,6 +3012,7 @@ : not defined : not defined : not defined + : not defined /**************** MYSQL_DATE ****************/ @@ -3018,6 +3070,7 @@ : not defined : not defined : not defined + : not defined /**************** MYSQL_DATETIME ****************/ @@ -3075,4 +3128,63 @@ : not defined : not defined : not defined + : not defined + +/**************** ROARINGBITMAP ****************/ + + : defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined + : not defined diff --git a/unittest/share/test_roaringbitmap.cpp b/unittest/share/test_roaringbitmap.cpp new file mode 100644 index 000000000..494353ccc --- /dev/null +++ b/unittest/share/test_roaringbitmap.cpp @@ -0,0 +1,390 @@ +/** + * Copyright (c) 2023 OceanBase + * OceanBase CE is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan PubL v2. + * You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PubL v2 for more details. + */ + +#include +#define private public +#include "lib/roaringbitmap/ob_roaringbitmap.h" +#include "lib/roaringbitmap/ob_rb_utils.h" +#include "lib/utility/ob_macro_utils.h" + +#undef private + +#include +#include +#include +#include + +namespace oceanbase { +namespace common { + +class TestRoaringBitmap : public ::testing::Test { +public: + TestRoaringBitmap() + {} + ~TestRoaringBitmap() + {} + virtual void SetUp() + {} + virtual void TearDown() + {} + + static void SetUpTestCase() + {} + + static void TearDownTestCase() + {} + +private: + // disallow copy + DISALLOW_COPY_AND_ASSIGN(TestRoaringBitmap); + +}; + + +TEST_F(TestRoaringBitmap, serialize_deserialize) +{ + ObArenaAllocator allocator(ObModIds::TEST); + ModulePageAllocator page_allocator_(allocator, common::ObModIds::OB_MODULE_PAGE_ALLOCATOR); + ObRoaringBitmap *rb = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)); + ObRoaringBitmap *rb_64 = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)); + + // EMPTY Type + ASSERT_EQ(rb->get_version(), BITMAP_VESION_1); + ASSERT_EQ(rb->get_type(), ObRbType::EMPTY); + ASSERT_EQ(rb->get_cardinality(), 0); + ObString bin_empty; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_empty, rb)); + ASSERT_EQ(ObRbBinType::EMPTY, static_cast(*(bin_empty.ptr() + 1))); + ObRoaringBitmap *rb_empty; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_empty, rb_empty)); + ASSERT_EQ(rb->get_version(), rb_empty->get_version()); + ASSERT_EQ(rb->get_type(), rb_empty->get_type()); + ASSERT_EQ(rb->get_cardinality(), rb_empty->get_cardinality()); + + // SINGLE_32 Type + ASSERT_EQ(OB_SUCCESS, rb->value_add(100)); + ASSERT_EQ(rb->get_type(), ObRbType::SINGLE); + ASSERT_EQ(rb->get_cardinality(), 1); + ASSERT_TRUE(rb->is_contains(100)); + ObString bin_single; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_single, rb)); + ASSERT_EQ(ObRbBinType::SINGLE_32, static_cast(*(bin_single.ptr() + 1))); + ObRoaringBitmap *rb_single; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_single, rb_single)); + ASSERT_EQ(rb->get_version(), rb_single->get_version()); + ASSERT_EQ(rb->get_type(), rb_single->get_type()); + ASSERT_EQ(rb->get_cardinality(), rb_single->get_cardinality()); + ASSERT_TRUE(rb_single->is_contains(100)); + + // SET_32 Type + ASSERT_EQ(OB_SUCCESS, rb->value_add(200)); + ASSERT_EQ(rb->get_type(), ObRbType::SET); + ASSERT_EQ(rb->get_cardinality(), 2); + ASSERT_TRUE(rb->is_contains(100)); + ASSERT_TRUE(rb->is_contains(200)); + ObString bin_set; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_set, rb)); + ASSERT_EQ(ObRbBinType::SET_32, static_cast(*(bin_set.ptr() + 1))); + ObRoaringBitmap *rb_set; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_set, rb_set)); + ASSERT_EQ(rb->get_version(), rb_set->get_version()); + ASSERT_EQ(rb->get_type(), rb_set->get_type()); + ASSERT_EQ(rb->get_cardinality(), rb_set->get_cardinality()); + ASSERT_TRUE(rb_set->is_contains(100)); + ASSERT_TRUE(rb_set->is_contains(200)); + + // BITMAP_32 Type + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(OB_SUCCESS, rb->value_add(300 + i)); + } + ASSERT_EQ(rb->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb->get_cardinality(), 34); + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_TRUE(rb->is_contains(300 + i)); + } + ObString bin_bitmap; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_bitmap, rb)); + ASSERT_EQ(ObRbBinType::BITMAP_32, static_cast(*(bin_bitmap.ptr() + 1))); + ObRoaringBitmap *rb_bitmap; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_bitmap, rb_bitmap)); + ASSERT_EQ(rb->get_version(), rb_bitmap->get_version()); + ASSERT_EQ(rb->get_type(), rb_bitmap->get_type()); + ASSERT_EQ(rb->get_cardinality(), rb_bitmap->get_cardinality()); + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_TRUE(rb_bitmap->is_contains(300 + i)); + } + + // SINGLE_64 Type + ASSERT_EQ(OB_SUCCESS, rb_64->value_add(4294967295 + 100)); + ASSERT_EQ(rb_64->get_type(), ObRbType::SINGLE); + ASSERT_EQ(rb_64->get_cardinality(), 1); + ASSERT_TRUE(rb_64->is_contains(4294967295 + 100)); + ObString bin_single_64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_single_64, rb_64)); + ASSERT_EQ(ObRbBinType::SINGLE_64, static_cast(*(bin_single_64.ptr() + 1))); + ObRoaringBitmap *rb_single_64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_single_64, rb_single_64)); + ASSERT_EQ(rb_64->get_version(), rb_single_64->get_version()); + ASSERT_EQ(rb_64->get_type(), rb_single_64->get_type()); + ASSERT_EQ(rb_64->get_cardinality(), rb_single_64->get_cardinality()); + ASSERT_TRUE(rb_single_64->is_contains(4294967295 + 100)); + + // SET_64 Type + ASSERT_EQ(OB_SUCCESS, rb_64->value_add(200)); + ASSERT_EQ(rb_64->get_type(), ObRbType::SET); + ASSERT_EQ(rb_64->get_cardinality(), 2); + ASSERT_TRUE(rb_64->is_contains(4294967295 + 100)); + ASSERT_TRUE(rb_64->is_contains(200)); + ObString bin_set_64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_set_64, rb_64)); + ASSERT_EQ(ObRbBinType::SET_64, static_cast(*(bin_set_64.ptr() + 1))); + ObRoaringBitmap *rb_set_64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_set_64, rb_set_64)); + ASSERT_EQ(rb_64->get_version(), rb_set_64->get_version()); + ASSERT_EQ(rb_64->get_type(), rb_set_64->get_type()); + ASSERT_EQ(rb_64->get_cardinality(), rb_set_64->get_cardinality()); + ASSERT_TRUE(rb_set_64->is_contains(4294967295 + 100)); + ASSERT_TRUE(rb_set_64->is_contains(200)); + + // BITMAP_64 Type + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(OB_SUCCESS, rb_64->value_add(i * 4294967295 + i)); + } + ASSERT_EQ(rb_64->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_64->get_cardinality(), 34); + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_TRUE(rb_64->is_contains(i * 4294967295 + i)); + } + ObString bin_bitmap_64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_bitmap_64, rb_64)); + ASSERT_EQ(ObRbBinType::BITMAP_64, static_cast(*(bin_bitmap_64.ptr() + 1))); + ObRoaringBitmap *rb_bitmap_64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, bin_bitmap_64, rb_bitmap_64)); + ASSERT_EQ(rb_64->get_version(), rb_bitmap_64->get_version()); + ASSERT_EQ(rb_64->get_type(), rb_bitmap_64->get_type()); + ASSERT_EQ(rb_64->get_cardinality(), rb_bitmap_64->get_cardinality()); + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_TRUE(rb_bitmap_64->is_contains(i * 4294967295 + i)); + } +} + +TEST_F(TestRoaringBitmap, optimize) +{ + ObArenaAllocator allocator(ObModIds::TEST); + ModulePageAllocator page_allocator_(allocator, common::ObModIds::OB_MODULE_PAGE_ALLOCATOR); + ObRoaringBitmap *rb = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)); + + // add 33 value, remain 33 value + for (int i = 0; i < MAX_BITMAP_SET_VALUES + 1; i++) { + ASSERT_EQ(OB_SUCCESS, rb->value_add(300 + i)); + } + ASSERT_EQ(rb->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb->get_cardinality(), 33); + ASSERT_EQ(rb->value_remove(300), OB_SUCCESS); + ASSERT_EQ(rb->get_cardinality(), 32); + ASSERT_FALSE(rb->is_contains(300)); + rb->optimize(); + // remove 32 value, remain 1 value + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(rb->value_remove(300 + i), OB_SUCCESS); + } + ASSERT_EQ(rb->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb->get_cardinality(), 1); + rb->optimize(); + ASSERT_EQ(rb->get_type(), ObRbType::SINGLE); + ASSERT_EQ(rb->get_cardinality(), 1); + // remove 1 value, remain 0 value + ASSERT_EQ(rb->value_remove(300 + 32), OB_SUCCESS); + ASSERT_EQ(rb->get_type(), ObRbType::EMPTY); + ASSERT_EQ(rb->get_cardinality(), 0); + // add 32 value, remain 32 value + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(rb->value_add(i), OB_SUCCESS); + } + ASSERT_EQ(rb->get_type(), ObRbType::SET); + ASSERT_EQ(rb->get_cardinality(), 32); + // remove 32 value, remain 0 value + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(rb->value_remove(i), OB_SUCCESS); + } + ASSERT_EQ(rb->get_type(), ObRbType::SET); + ASSERT_EQ(rb->get_cardinality(), 0); + // add 33 value, remain 33 value + for (int i = 0; i < MAX_BITMAP_SET_VALUES + 1; i++) { + ASSERT_EQ(rb->value_add(300 + i), OB_SUCCESS); + } + ASSERT_EQ(rb->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb->get_cardinality(), 33); + // remove 33 value, remain 0 value + for (int i = 0; i < MAX_BITMAP_SET_VALUES + 1; i++) { + ASSERT_EQ(rb->value_remove(300 + i), OB_SUCCESS); + } + ASSERT_EQ(rb->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb->get_cardinality(), 0); + rb->optimize(); + ASSERT_EQ(rb->get_type(), ObRbType::EMPTY); + ASSERT_EQ(rb->get_cardinality(), 0); + // add 2 value, remain 2 value + for (int i = 0; i < 2; i++) { + ASSERT_EQ(rb->value_add(300 + i), OB_SUCCESS); + } + ASSERT_EQ(rb->get_type(), ObRbType::SET); + ASSERT_EQ(rb->get_cardinality(), 2); + // remove 1 value, remain 1 value + ASSERT_EQ(rb->value_remove(300), OB_SUCCESS); + ASSERT_EQ(rb->get_type(), ObRbType::SET); + ASSERT_EQ(rb->get_cardinality(), 1); + rb->optimize(); + ASSERT_EQ(rb->get_type(), ObRbType::SINGLE); + ASSERT_EQ(rb->get_cardinality(), 1); +} + +TEST_F(TestRoaringBitmap, to_roaring_bin) +{ + ObArenaAllocator allocator(ObModIds::TEST); + ModulePageAllocator page_allocator_(allocator, common::ObModIds::OB_MODULE_PAGE_ALLOCATOR); + ObRoaringBitmap *rb = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)); + ObRoaringBitmap *rb64 = OB_NEWx(ObRoaringBitmap, &allocator, (&allocator)); + + // EMPTY + ObString bin_empty; + ObString roaring_bin_empty; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_empty, rb)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_empty, roaring_bin_empty)); + ObRbBinType bin_type_empty; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_empty, bin_type_empty)); + ASSERT_EQ(ObRbBinType::BITMAP_32, bin_type_empty); + ObRoaringBitmap *rb_roaring_empty; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_empty, rb_roaring_empty)); + ASSERT_EQ(rb_roaring_empty->get_version(), 1); + ASSERT_EQ(rb_roaring_empty->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_empty->get_cardinality(), 0); + + // SINGLE_32 + ASSERT_EQ(OB_SUCCESS, rb->value_add(100)); + ObString bin_single; + ObString roaring_bin_single; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_single, rb)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_single, roaring_bin_single)); + ObRbBinType bin_type_single; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_single, bin_type_single)); + ASSERT_EQ(ObRbBinType::BITMAP_32, bin_type_single); + ObRoaringBitmap *rb_roaring_single; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_single, rb_roaring_single)); + ASSERT_EQ(rb_roaring_single->get_version(), 1); + ASSERT_EQ(rb_roaring_single->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_single->get_cardinality(), 1); + ASSERT_TRUE(rb_roaring_single->is_contains(100)); + + // SET_32 + ASSERT_EQ(OB_SUCCESS, rb->value_add(101)); + ObString bin_set; + ObString roaring_bin_set; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_set, rb)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_set, roaring_bin_set)); + ObRbBinType bin_type_set; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_set, bin_type_set)); + ASSERT_EQ(ObRbBinType::BITMAP_32, bin_type_set); + ObRoaringBitmap *rb_roaring_set; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_set, rb_roaring_set)); + ASSERT_EQ(rb_roaring_set->get_version(), 1); + ASSERT_EQ(rb_roaring_set->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_set->get_cardinality(), 2); + ASSERT_TRUE(rb_roaring_set->is_contains(100)); + ASSERT_TRUE(rb_roaring_set->is_contains(101)); + + // BITMAP_32 + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(OB_SUCCESS, rb->value_add(300 + i)); + } + ObString bin_bitmap; + ObString roaring_bin_bitmap; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_bitmap, rb)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_bitmap, roaring_bin_bitmap)); + ObRbBinType bin_type_bitmap; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_bitmap, bin_type_bitmap)); + ASSERT_EQ(ObRbBinType::BITMAP_32, bin_type_bitmap); + ObRoaringBitmap *rb_roaring_bitmap; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_bitmap, rb_roaring_bitmap)); + ASSERT_EQ(rb_roaring_bitmap->get_version(), 1); + ASSERT_EQ(rb_roaring_bitmap->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_bitmap->get_cardinality(), 34); + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_TRUE(rb_roaring_bitmap->is_contains(300 + i)); + } + + // SINGLE_64 + ASSERT_EQ(OB_SUCCESS, rb64->value_add(4294967295 + 100)); + ObString bin_single64; + ObString roaring_bin_single64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_single64, rb64)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_single64, roaring_bin_single64)); + ObRbBinType bin_type_single64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_single64, bin_type_single64)); + ASSERT_EQ(ObRbBinType::BITMAP_64, bin_type_single64); + ObRoaringBitmap *rb_roaring_single64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_single64, rb_roaring_single64)); + ASSERT_EQ(rb_roaring_single64->get_version(), 1); + ASSERT_EQ(rb_roaring_single64->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_single64->get_cardinality(), 1); + ASSERT_TRUE(rb_roaring_single64->is_contains(4294967295 + 100)); + + // SET_64 + ASSERT_EQ(OB_SUCCESS, rb64->value_add(4294967295 + 101)); + ObString bin_set64; + ObString roaring_bin_set64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_set64, rb64)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_set64, roaring_bin_set64)); + ObRbBinType bin_type_set64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_set64, bin_type_set64)); + ASSERT_EQ(ObRbBinType::BITMAP_64, bin_type_set64); + ObRoaringBitmap *rb_roaring_set64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_set64, rb_roaring_set64)); + ASSERT_EQ(rb_roaring_set64->get_version(), 1); + ASSERT_EQ(rb_roaring_set64->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_set64->get_cardinality(), 2); + ASSERT_TRUE(rb_roaring_set64->is_contains(4294967295 + 100)); + ASSERT_TRUE(rb_roaring_set64->is_contains(4294967295 + 101)); + + // BITMAP_64 + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_EQ(OB_SUCCESS, rb64->value_add(4294967295 + 300 + i)); + } + ObString bin_bitmap64; + ObString roaring_bin_bitmap64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_serialize(allocator, bin_bitmap64, rb64)); + ASSERT_EQ(OB_SUCCESS, ObRbUtils::binary_format_convert(allocator, bin_bitmap64, roaring_bin_bitmap64)); + ObRbBinType bin_type_bitmap64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::check_get_bin_type(roaring_bin_bitmap64, bin_type_bitmap64)); + ASSERT_EQ(ObRbBinType::BITMAP_64, bin_type_bitmap64); + ObRoaringBitmap *rb_roaring_bitmap64; + ASSERT_EQ(OB_SUCCESS, ObRbUtils::rb_deserialize(allocator, roaring_bin_bitmap64, rb_roaring_bitmap64)); + ASSERT_EQ(rb_roaring_bitmap64->get_version(), 1); + ASSERT_EQ(rb_roaring_bitmap64->get_type(), ObRbType::BITMAP); + ASSERT_EQ(rb_roaring_bitmap64->get_cardinality(), 34); + for (int i = 0; i < MAX_BITMAP_SET_VALUES; i++) { + ASSERT_TRUE(rb_roaring_bitmap64->is_contains(4294967295 + 300 + i)); + } + +} + +} // namespace common +} // namespace oceanbase + +int main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + // system("rm -f test_geo_tree.log"); + // OB_LOGGER.set_file_name("test_geo_tree.log"); + OB_LOGGER.set_log_level("DEBUG"); + return RUN_ALL_TESTS(); +} diff --git a/unittest/storage/blocksstable/cs_encoding/ob_cs_encoding_test_base.h b/unittest/storage/blocksstable/cs_encoding/ob_cs_encoding_test_base.h index 0b917ccd7..6c74f3874 100644 --- a/unittest/storage/blocksstable/cs_encoding/ob_cs_encoding_test_base.h +++ b/unittest/storage/blocksstable/cs_encoding/ob_cs_encoding_test_base.h @@ -347,7 +347,7 @@ int ObCSEncodingTestBase::check_decode_vector(ObMicroBlockCSDecoder &decoder, } } else if (vector_format == VEC_DISCRETE || vector_format == VEC_UNIFORM) { VecValueTypeClass var_tc_arr[] = {VEC_TC_NUMBER, VEC_TC_EXTEND, VEC_TC_STRING, VEC_TC_ENUM_SET_INNER, - VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT}; + VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT, VEC_TC_ROARINGBITMAP}; VecValueTypeClass *vec = std::find(std::begin(var_tc_arr), std::end(var_tc_arr), vec_tc); if (vec == std::end(var_tc_arr)) { need_test_column = false; @@ -355,7 +355,7 @@ int ObCSEncodingTestBase::check_decode_vector(ObMicroBlockCSDecoder &decoder, } else if (vector_format == VEC_CONTINUOUS) { /* can't test now VecValueTypeClass var_tc_arr[] = {VEC_TC_NUMBER, VEC_TC_EXTEND, VEC_TC_STRING, VEC_TC_ENUM_SET_INNER, - VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT}; + VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT, VEC_TC_ROARINGBITMAP}; VecValueTypeClass *vec = std::find(std::begin(var_tc_arr), std::end(var_tc_arr), vec_tc); if (vec == std::end(var_tc_arr)) { need_test_column = false; diff --git a/unittest/storage/blocksstable/encoding/test_column_decoder.h b/unittest/storage/blocksstable/encoding/test_column_decoder.h index 54c0a84cf..9cd6d7609 100644 --- a/unittest/storage/blocksstable/encoding/test_column_decoder.h +++ b/unittest/storage/blocksstable/encoding/test_column_decoder.h @@ -2258,7 +2258,7 @@ bool VectorDecodeTestUtil::need_test_vec_with_type( } } else if (vector_format == VEC_DISCRETE) { VecValueTypeClass var_tc_arr[] = {VEC_TC_NUMBER, VEC_TC_EXTEND, VEC_TC_STRING, VEC_TC_ENUM_SET_INNER, - VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT}; + VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT, VEC_TC_ROARINGBITMAP}; VecValueTypeClass *vec = std::find(std::begin(var_tc_arr), std::end(var_tc_arr), vec_tc); if (vec == std::end(var_tc_arr)) { need_test_column = false; diff --git a/unittest/storage/blocksstable/encoding/test_raw_decoder.cpp b/unittest/storage/blocksstable/encoding/test_raw_decoder.cpp index b6b21aac9..f0a007234 100644 --- a/unittest/storage/blocksstable/encoding/test_raw_decoder.cpp +++ b/unittest/storage/blocksstable/encoding/test_raw_decoder.cpp @@ -732,7 +732,7 @@ void TestRawDecoder::test_batch_decode_to_vector( } } else if (vector_format == VEC_DISCRETE) { VecValueTypeClass var_tc_arr[] = {VEC_TC_NUMBER, VEC_TC_EXTEND, VEC_TC_STRING, VEC_TC_ENUM_SET_INNER, - VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT}; + VEC_TC_RAW, VEC_TC_ROWID, VEC_TC_LOB, VEC_TC_JSON, VEC_TC_GEO, VEC_TC_UDT, VEC_TC_ROARINGBITMAP}; VecValueTypeClass *vec = std::find(std::begin(var_tc_arr), std::end(var_tc_arr), vec_tc); if (vec == std::end(var_tc_arr)) { need_test_column = false; diff --git a/unittest/storage/blocksstable/ob_row_generate.ipp b/unittest/storage/blocksstable/ob_row_generate.ipp index dde006669..78d0b9a22 100644 --- a/unittest/storage/blocksstable/ob_row_generate.ipp +++ b/unittest/storage/blocksstable/ob_row_generate.ipp @@ -508,7 +508,8 @@ int ObRowGenerate::set_obj(const ObObjType &column_type, case ObMediumTextType: case ObLongTextType: case ObJsonType: - case ObGeometryType: { + case ObGeometryType: + case ObRoaringBitmapType: { ObLobCommon *value = NULL; void *buf = NULL; if (OB_ISNULL(buf = p_allocator_->alloc(sizeof(ObLobCommon) + 10))) { @@ -521,7 +522,7 @@ int ObRowGenerate::set_obj(const ObObjType &column_type, if (column_type == ObTinyTextType) { byte_size = 2; } - obj.meta_.set_collation_type(column_type == ObGeometryType ? CS_TYPE_BINARY + obj.meta_.set_collation_type(column_type == (ObGeometryType || ObRoaringBitmapType) ? CS_TYPE_BINARY :CS_TYPE_UTF8MB4_GENERAL_CI); obj.meta_.set_collation_level(CS_LEVEL_IMPLICIT); obj.set_type(column_type); @@ -771,7 +772,8 @@ int ObRowGenerate::compare_obj(const ObObjType &column_type, const int64_t value case ObMediumTextType: case ObLongTextType: case ObJsonType: - case ObGeometryType: { + case ObGeometryType: + case ObRoaringBitmapType: { break; } case ObBitType: {