[FEAT MERGE] Add roaringbitmap type and relative expr

Co-authored-by: fkuner <784819644@qq.com>
This commit is contained in:
qijiax 2024-06-21 09:46:20 +00:00 committed by ob-robot
parent 3723b0f580
commit 3bfa3e2070
149 changed files with 7389 additions and 222 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}
$<$<STREQUAL:"${ARCHITECTURE}","x86_64">:${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

View File

@ -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] = {

View File

@ -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

View File

@ -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
},
};

View File

@ -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<ObCollectionSQLType>(const ObObj &obj)
}
DEF_UDT_CS_FUNCS(ObCollectionSQLType);
}
}

View File

@ -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");

View File

@ -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)
{

View File

@ -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) {

View File

@ -138,7 +138,8 @@ public:
&& !ob_is_lob_locator(static_cast<ObObjType>(type_))
&& !ob_is_raw(static_cast<ObObjType>(type_))
&& !ob_is_enum_or_set_type(static_cast<ObObjType>(type_))
&& !ob_is_geometry(static_cast<ObObjType>(type_))) {
&& !ob_is_geometry(static_cast<ObObjType>(type_))
&& !ob_is_roaringbitmap(static_cast<ObObjType>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<char *>(v_.string_);
} else if (ob_is_number_tc(get_type())) {
ret = const_cast<uint32_t *>(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<char*>(data_ptr);
} else if (ob_is_number_tc(get_type())) {
v_.nmb_digits_ = static_cast<uint32_t*>(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_);

View File

@ -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

View File

@ -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 */
};

View File

@ -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 */
};

View File

@ -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); \
} \
} \

View File

@ -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_

View File

@ -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<const int32_t*>(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<const int32_t*>(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<uint16_t *>(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<uint32_t *>(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<uint32_t *>(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<const int32_t*>(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<uint64_t*>(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<uint32_t *>(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<ObRoaringBin **>(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<uint32_t *>(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<uint32_t*>(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

View File

@ -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_

View File

@ -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<uint8_t>(*(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<uint8_t>(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<ObRbBinType>(*(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<uint8_t>(*(rb_bin.ptr() + offset));
cardinality = static_cast<uint64_t>(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<const uint32_t*>(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<const uint64_t*>(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<uint8_t>(*(rb_bin.ptr() + offset));
offset += RB_VALUE_COUNT_SIZE;
if (value_count > 0) {
uint32_t *value_ptr = reinterpret_cast<uint32_t *>(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<const uint32_t*>(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<uint8_t>(*(rb_bin.ptr() + offset));
offset += RB_VALUE_COUNT_SIZE;
if (value_count > 0) {
uint64_t *value_ptr = reinterpret_cast<uint64_t *>(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<const uint64_t*>(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<uint64_t> *set = rb2->get_set();
hash::ObHashSet<uint64_t>::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<uint64_t>(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

View File

@ -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_

View File

@ -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<uint64_t>(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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>::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<uint64_t>(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<ObRbBinType>(*(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<const uint32_t*>(rb_bin.ptr() + offset);
set_single(static_cast<uint64_t>(value_32));
break;
}
case ObRbBinType::SINGLE_64: {
set_single(*reinterpret_cast<const uint64_t*>(rb_bin.ptr() + offset));
break;
}
case ObRbBinType::SET_32: {
uint32_t value_32 = 0;
uint8_t value_count = static_cast<uint8_t>(*(rb_bin.ptr() + offset));
offset += RB_VALUE_COUNT_SIZE;
for (int i = 0; OB_SUCC(ret) && i < value_count; i++) {
value_32 = *reinterpret_cast<const uint32_t*>(rb_bin.ptr() + offset);
offset += sizeof(uint32_t);
if (OB_FAIL(value_add(static_cast<uint64_t>(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<uint8_t>(*(rb_bin.ptr() + offset));
offset += RB_VALUE_COUNT_SIZE;
for (int i = 0; OB_SUCC(ret) && i < value_count; i++) {
value_64 = *reinterpret_cast<const uint64_t*>(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<const char*>(&map_size), sizeof(uint64_t)))) {
LOG_WARN("failed to append map size", K(ret));
} else if (OB_FAIL(tmp_buf.append(reinterpret_cast<const char*>(&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<const char*>(&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<const char*>(&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<uint32_t>(single_value_);
if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&bin_type), RB_BIN_TYPE_SIZE))) {
LOG_WARN("failed to append bin_type", K(ret));
} else if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&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<const char*>(&bin_type), RB_BIN_TYPE_SIZE))) {
LOG_WARN("failed to append bin_type", K(ret));
} else if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&single_value_), sizeof(uint64_t)))) {
LOG_WARN("failed to append single_value", K(ret));
}
}
break;
}
case ObRbType::SET: {
int8_t set_size = static_cast<uint8_t>(set_.size());
if (is_32bits_enough) {
bin_type = ObRbBinType::SET_32;
if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&bin_type), RB_BIN_TYPE_SIZE))) {
LOG_WARN("failed to append bin_type", K(ret));
} else if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&set_size), RB_VALUE_COUNT_SIZE))) {
LOG_WARN("failed to append single_value", K(ret));
} else {
uint32_t value_32 = 0;
hash::ObHashSet<uint64_t>::const_iterator iter;
for (iter = set_.begin(); iter != set_.end(); iter++) {
value_32 = static_cast<uint32_t>(iter->first);
if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&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<const char*>(&bin_type), RB_BIN_TYPE_SIZE))) {
LOG_WARN("failed to append bin_type", K(ret));
} else if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&set_size), RB_VALUE_COUNT_SIZE))) {
LOG_WARN("failed to append single_value", K(ret));
} else {
hash::ObHashSet<uint64_t>::const_iterator iter;
for (iter = set_.begin(); iter != set_.end(); iter++) {
if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&(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<const char*>(&bin_type), RB_BIN_TYPE_SIZE))) {
LOG_WARN("failed to append bin_type", K(ret));
} else if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&roaring32_cookie), sizeof(uint32_t)))) {
LOG_WARN("failed to append roaring32_cookie", K(ret));
} else if (OB_FAIL(res_buf.append(reinterpret_cast<const char*>(&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<uint64_t>(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<const char*>(&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<const char*>(&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<uint64_t>::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

View File

@ -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 <stdint.h>
#include <string.h>
#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<uint64_t>* 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<uint64_t> set_;
roaring::api::roaring64_bitmap_t *bitmap_;
};
} // namespace common
} // namespace oceanbase
#endif // OCEANBASE_LIB_ROARINGBITMAP_OB_ROARINGBITMAP_

View File

@ -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<obj_type>

View File

@ -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;

View File

@ -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:

View File

@ -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);

View File

@ -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());

View File

@ -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_);

View File

@ -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);}

View File

@ -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);

View File

@ -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);

View File

@ -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))) {

View File

@ -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,

View File

@ -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) \

View File

@ -127,7 +127,8 @@ static ObGetIRType OB_IR_TYPE[common::ObMaxType + 1] =
NULL, //51.ObCollectionSQLType
reinterpret_cast<ObGetIRType>(ObIRType::getInt32Ty), //52.ObMySQLDateType
reinterpret_cast<ObGetIRType>(ObIRType::getInt64Ty), //53.ObMySQLDateTimeType
NULL, //54.ObMaxType
NULL, //54.ObRoaringBitmapType
NULL, //55.ObMaxType
};
template<typename T, int64_t N>

View File

@ -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<int32_t>(data.length()));

View File

@ -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()) &&

View File

@ -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());

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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 <typename AggType>

View File

@ -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

View File

@ -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");

View File

@ -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_DATUM_STRING>(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_DATUM_STRING>(obj);
break;
}

File diff suppressed because one or more lines are too long

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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 &params,
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, &params, &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<char*>(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<int32_t>(len));
} else {
obj.set_string(expect_type, buf, static_cast<int32_t>(len));
}
}
}
return ret;
}
static int roaringbitmap_string(const ObObjType expect_type, ObObjCastParams &params,
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<ObLength>(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 &params,
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, &params, &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*/
},
};

View File

@ -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);

View File

@ -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(); }

View File

@ -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

View File

@ -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)
{

View File

@ -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())) {

View File

@ -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();

View File

@ -74,6 +74,7 @@ template class ObContinuousVector<VectorBasicOp<VEC_TC_LOB>>;
template class ObContinuousVector<VectorBasicOp<VEC_TC_JSON>>;
template class ObContinuousVector<VectorBasicOp<VEC_TC_GEO>>;
template class ObContinuousVector<VectorBasicOp<VEC_TC_UDT>>;
template class ObContinuousVector<VectorBasicOp<VEC_TC_ROARINGBITMAP>>;
} // end namespace common
} // end namespace oceanbase

View File

@ -75,5 +75,6 @@ template class ObDiscreteVector<VectorBasicOp<VEC_TC_LOB>>;
template class ObDiscreteVector<VectorBasicOp<VEC_TC_JSON>>;
template class ObDiscreteVector<VectorBasicOp<VEC_TC_GEO>>;
template class ObDiscreteVector<VectorBasicOp<VEC_TC_UDT>>;
template class ObDiscreteVector<VectorBasicOp<VEC_TC_ROARINGBITMAP>>;
} // end namespace common
} // end namespace oceanbase

View File

@ -100,6 +100,7 @@ template class ObUniformVector<true, VectorBasicOp<VEC_TC_DEC_INT64>>;
template class ObUniformVector<true, VectorBasicOp<VEC_TC_DEC_INT128>>;
template class ObUniformVector<true, VectorBasicOp<VEC_TC_DEC_INT256>>;
template class ObUniformVector<true, VectorBasicOp<VEC_TC_DEC_INT512>>;
template class ObUniformVector<true, VectorBasicOp<VEC_TC_ROARINGBITMAP>>;
template class ObUniformVector<false, VectorBasicOp<VEC_TC_NULL>>;
template class ObUniformVector<false, VectorBasicOp<VEC_TC_INTEGER>>;
@ -133,5 +134,6 @@ template class ObUniformVector<false, VectorBasicOp<VEC_TC_DEC_INT64>>;
template class ObUniformVector<false, VectorBasicOp<VEC_TC_DEC_INT128>>;
template class ObUniformVector<false, VectorBasicOp<VEC_TC_DEC_INT256>>;
template class ObUniformVector<false, VectorBasicOp<VEC_TC_DEC_INT512>>;
template class ObUniformVector<false, VectorBasicOp<VEC_TC_ROARINGBITMAP>>;
} // end namespace common
} // end namespace oceanbase

View File

@ -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
}

View File

@ -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

View File

@ -328,6 +328,7 @@ struct VecTCHashCalc<VEC_TC_ROWID, HashMethod, hash_v2>
}
};
template<VecValueTypeClass vec_type, typename HashMethod, bool hash_v2, typename hash_type>
struct VecTCHashCalcWithHashType
{
@ -791,6 +792,7 @@ struct VecTCCmpCalc<VEC_TC_UDT, VEC_TC_UDT>
}
};
// null type comparison
struct VecDummyCmpCalc

View File

@ -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

View File

@ -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));

View File

@ -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<GroupConcatExtraResult *>(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<GroupConcatExtraResult *>(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<GroupConcatExtraResult *>(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<GroupConcatExtraResult *>(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<GroupConcatExtraResult *>(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<GroupConcatExtraResult *>(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<ObObj*>(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<ObObj*>(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,

View File

@ -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<ObString> &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;

View File

@ -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.

View File

@ -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<char*>(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,

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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 */
},
};

View File

@ -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
};

View File

@ -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 */
},
};

View File

@ -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 */

View File

@ -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 */
},
};

File diff suppressed because it is too large Load Diff

View File

@ -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 */
},
};

View File

@ -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");

View File

@ -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*/
},
};

View File

@ -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)) {

View File

@ -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);

View File

@ -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<int32_t>(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())

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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_

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More