[xml bugfix] Compatible error codes related to xml type

This commit is contained in:
obdev
2023-07-24 03:42:40 +00:00
committed by ob-robot
parent 3d29e4f19f
commit 0e36eb2f3b
3 changed files with 19 additions and 5 deletions

View File

@ -323,8 +323,13 @@ int ObExprFuncPartHash::eval_oracle_part_hash(
} else if (d->is_null()) {
// do nothing
} else if (!is_oracle_supported_type(arg.datum_meta_.type_)) {
if (ob_is_user_defined_sql_type(arg.datum_meta_.type_)) {
ret = OB_ERR_INVALID_XML_DATATYPE;
LOG_USER_ERROR(OB_ERR_INVALID_XML_DATATYPE, "-", "ANYDATA");
} else {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("wrong type", K(ret), K(arg.datum_meta_));
}
} else {
if (ObCharType == arg.datum_meta_.type_
|| ObNCharType == arg.datum_meta_.type_) {

View File

@ -804,7 +804,12 @@ int ObExprOperator::aggregate_charsets(
ObObjMeta coll;
for (int i = 0; OB_SUCC(ret) && i < param_num; ++i) {
coll.reset();
// issue:49962420 The xml type calls get_collation_type() to return the result of binary, here is set to utf8
if (type.is_string_type() && types[i].is_xml_sql_type()) {
coll.set_collation_type(ObCollationType::CS_TYPE_UTF8MB4_BIN);
} else {
coll.set_collation_type(types[i].get_collation_type());
}
coll.set_collation_level(types[i].get_collation_level());
ret = coll_types.push_back(coll);
} // end for

View File

@ -1920,7 +1920,10 @@ int ObRawExprDeduceType::check_median_percentile_param(ObAggFunRawExpr &expr)
LOG_WARN("get unexpected null", K(ret), K(expr));
} else if (T_FUN_GROUP_PERCENTILE_CONT == expr_type ||
T_FUN_GROUP_PERCENTILE_DISC == expr_type) {
if (!expr.get_param_expr(0)->is_const_expr()) {
if (expr.get_param_expr(0)->get_result_type().is_user_defined_sql_type()) {
ret = OB_ERR_INVALID_XML_DATATYPE;
LOG_USER_ERROR(OB_ERR_INVALID_XML_DATATYPE, "NUMBER", "ANYDATA");
} else if (!expr.get_param_expr(0)->is_const_expr()) {
ret = OB_ERR_ARGUMENT_SHOULD_CONSTANT;
LOG_WARN("Argument should be a constant.", K(ret));
} else if (!ob_is_numeric_type(expr.get_param_expr(0)->get_result_type().get_type())) {
@ -1985,7 +1988,8 @@ int ObRawExprDeduceType::check_group_aggr_param(ObAggFunRawExpr &expr)
} else if ((ob_is_user_defined_sql_type(param_expr->get_data_type())
|| ob_is_user_defined_pl_type(param_expr->get_data_type()))
&& (expr.get_expr_type() == T_FUN_MAX
|| expr.get_expr_type() == T_FUN_MIN)) {
|| expr.get_expr_type() == T_FUN_MIN
|| expr.get_expr_type() == T_FUN_GROUPING)) {
// other udt types not run here, xmltype does not have order or map member function for compare
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("does not have order or map member function for compare",