diff --git a/src/sql/engine/expr/ob_expr_func_part_hash.cpp b/src/sql/engine/expr/ob_expr_func_part_hash.cpp index 11139f800c..6cf76b5428 100644 --- a/src/sql/engine/expr/ob_expr_func_part_hash.cpp +++ b/src/sql/engine/expr/ob_expr_func_part_hash.cpp @@ -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_)) { - ret = OB_INVALID_ARGUMENT; - LOG_WARN("wrong type", K(ret), K(arg.datum_meta_)); + 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_) { diff --git a/src/sql/engine/expr/ob_expr_operator.cpp b/src/sql/engine/expr/ob_expr_operator.cpp index 674f068b5b..058ce197de 100644 --- a/src/sql/engine/expr/ob_expr_operator.cpp +++ b/src/sql/engine/expr/ob_expr_operator.cpp @@ -804,7 +804,12 @@ int ObExprOperator::aggregate_charsets( ObObjMeta coll; for (int i = 0; OB_SUCC(ret) && i < param_num; ++i) { coll.reset(); - coll.set_collation_type(types[i].get_collation_type()); + // 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 diff --git a/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp b/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp index f7664d0c32..8a8531f3b3 100644 --- a/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp +++ b/src/sql/resolver/expr/ob_raw_expr_deduce_type.cpp @@ -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",