fix error code of count(distinct roaringbitmap)

This commit is contained in:
qijiax
2024-07-12 10:32:14 +00:00
committed by ob-robot
parent 90584a3814
commit 02e684c3a2
9 changed files with 35 additions and 9 deletions

View File

@ -1814,6 +1814,9 @@ int ObStaticEngineCG::generate_hash_set_spec(ObLogSet &op, ObHashSetSpec &spec)
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (ob_is_roaringbitmap(expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("invalid operation for roaringbitmap", K(ret));
} else if (OB_FAIL(spec.sort_collations_.push_back(field_collation))) {
LOG_WARN("failed to push back sort collation", K(ret));
} else {
@ -1992,6 +1995,9 @@ int ObStaticEngineCG::generate_merge_set_spec(ObLogSet &op, ObMergeSetSpec &spec
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (ob_is_roaringbitmap(expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("invalid operation for roaringbitmap", K(ret));
} else {
ObSortCmpFunc cmp_func;
cmp_func.cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(expr->datum_meta_.type_,
@ -2234,6 +2240,9 @@ int ObStaticEngineCG::check_not_support_cmp_type(
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (ob_is_roaringbitmap(expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("invalid operation for roaringbitmap", K(ret));
}
}
return ret;
@ -5599,6 +5608,9 @@ int ObStaticEngineCG::generate_pump_exprs(ObLogJoin &op, ObNLConnectBySpecBase &
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (ob_is_roaringbitmap(expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("invalid operation for roaringbitmap", K(ret));
} else {
cmp_func.cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(
expr->datum_meta_.type_,
@ -7167,6 +7179,9 @@ int ObStaticEngineCG::fill_aggr_info(ObAggFunRawExpr &raw_expr,
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (ob_is_roaringbitmap(expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("invalid operation for roaringbitmap", K(ret));
} else {
ObSortFieldCollation field_collation(i, expr->datum_meta_.cs_type_, is_ascending, null_pos);
ObSortCmpFunc cmp_func;
@ -7846,6 +7861,9 @@ int ObStaticEngineCG::fil_sort_info(const ObIArray<OrderItem> &sort_keys,
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (ob_is_roaringbitmap(expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("invalid operation for roaringbitmap", K(ret));
} else if (sort_exprs != NULL && OB_FAIL(sort_exprs->push_back(expr))) {
LOG_WARN("failed to push back expr", K(ret));
} else if (has_exist_in_array(all_exprs, expr, &idx)) {

View File

@ -489,6 +489,7 @@ public:
inline bool is_param_lazy_eval() const { return param_lazy_eval_; }
inline static bool is_type_valid(const common::ObObjType &type);
inline static bool is_type_valid_regexp(const common::ObObjType &type);
virtual bool need_charset_convert() const { return need_charset_convert_; }
virtual int64_t to_string(char *buf, const int64_t buf_len) const
{
@ -1025,6 +1026,11 @@ inline bool ObExprOperator::is_type_valid(const common::ObObjType &type)
return (common::ob_is_castable_type_class(type_class) || common::ObUnknownTC == type_class);
}
inline bool ObExprOperator::is_type_valid_regexp(const common::ObObjType &type)
{
return (is_type_valid(type) && type != ObRoaringBitmapType);
}
inline void ObExprOperator::calc_result_flag1(ObExprResType &type,
const ObExprResType &type1)
{

View File

@ -56,8 +56,8 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
LOG_WARN("invalid params", K(param_num), K(RESULT_TYPE_INDEX), K(LEAST_PARAM_NUMS), K(CALC_TYPE_INDEX));
ret = OB_INVALID_ARGUMENT;
} else {
//除了返回值, 其他参数不能为lob类型
if (types_stack[0].is_lob()) {
//除了返回值, 其他参数不能为lob或roaringbitmap类型
if (types_stack[0].is_lob() || types_stack[0].is_roaringbitmap()) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_USER_ERROR(OB_ERR_INVALID_TYPE_FOR_OP, "-",
ob_obj_type_str(types_stack[0].get_type()));
@ -78,7 +78,7 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
for (int64_t i = 1; OB_SUCC(ret) && i < param_num; i += 2) {
if (has_default && i == param_num - 1) {
// ignore default expr when calc calc_type
} else if (types_stack[i].is_lob()) {
} else if (types_stack[i].is_lob() || types_stack[i].is_roaringbitmap()) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_USER_ERROR(OB_ERR_INVALID_TYPE_FOR_OP, "-",
ob_obj_type_str(types_stack[i].get_type()));
@ -143,6 +143,8 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
}
} else {
type.set_type(types_stack[RESULT_TYPE_INDEX].get_type());
type.set_collation_level(types_stack[RESULT_TYPE_INDEX].get_collation_level());
type.set_collation_type(types_stack[RESULT_TYPE_INDEX].get_collation_type());
}
if (type.is_decimal_int()) { // decode expr's result type is ObNumberType
type.set_type(ObNumberType);

View File

@ -73,7 +73,7 @@ int ObExprRegexp::calc_result_type2(ObExprResType &type,
type.set_int32();
type.set_precision(DEFAULT_PRECISION_FOR_BOOL);
type.set_scale(DEFAULT_SCALE_FOR_INTEGER);
} else if (OB_UNLIKELY(!is_type_valid(type1.get_type()) || !is_type_valid(type2.get_type()))) {
} else if (OB_UNLIKELY(!is_type_valid_regexp(type1.get_type()) || !is_type_valid_regexp(type2.get_type()))) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("the param is not castable", K(ret), K(type1), K(type2));
} else if ((ObExprRegexContext::is_binary_string(type1) || ObExprRegexContext::is_binary_string(type2))

View File

@ -51,7 +51,7 @@ int ObExprRegexpCount::calc_result_typeN(ObExprResType &type,
LOG_WARN("param number of regexp_count at least 2 and at most 4", K(ret), K(param_num));
} else {
for (int i = 0; OB_SUCC(ret) && i < param_num; i++) {
if (!types[i].is_null() && !is_type_valid(types[i].get_type())) {
if (!types[i].is_null() && !is_type_valid_regexp(types[i].get_type())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("the parameter is not castable", K(ret), K(i));
}

View File

@ -52,7 +52,7 @@ int ObExprRegexpInstr::calc_result_typeN(ObExprResType &type,
} else {
bool is_case_sensitive = types[0].get_calc_collation_type();
for (int i = 0; OB_SUCC(ret) && i < param_num; i++) {
if (!types[i].is_null() && !is_type_valid(types[i].get_type())) {
if (!types[i].is_null() && !is_type_valid_regexp(types[i].get_type())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("the parameter is not castable", K(ret), K(i));
}

View File

@ -53,7 +53,7 @@ int ObExprRegexpLike::calc_result_typeN(ObExprResType &type,
} else {
bool is_case_sensitive = ObCharset::is_bin_sort(types[0].get_collation_type());
for (int i = 0; OB_SUCC(ret) && i < param_num; i++) {
if (!types[i].is_null() && !is_type_valid(types[i].get_type())) {
if (!types[i].is_null() && !is_type_valid_regexp(types[i].get_type())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("the parameter is not castable", K(ret), K(i));
}

View File

@ -71,7 +71,7 @@ int ObExprRegexpReplace::calc_result_typeN(ObExprResType &type,
} else {
const ObExprResType &text = real_text->get_result_type();
for (int i = 0; OB_SUCC(ret) && i < param_num; i++) {
if (!types[i].is_null() && !is_type_valid(types[i].get_type())) {
if (!types[i].is_null() && !is_type_valid_regexp(types[i].get_type())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("the parameter is not castable", K(ret), K(i));
}

View File

@ -65,7 +65,7 @@ int ObExprRegexpSubstr::calc_result_typeN(ObExprResType &type,
const ObExprResType &pattern = real_pattern->get_result_type();
bool is_case_sensitive = false;
for (int i = 0; OB_SUCC(ret) && i < param_num; i++) {
if (!types[i].is_null() && !is_type_valid(types[i].get_type())) {
if (!types[i].is_null() && !is_type_valid_regexp(types[i].get_type())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("the parameter is not castable", K(ret), K(i));
}