[BUGFIX] fix enum to str typr error
This commit is contained in:
@ -6038,7 +6038,9 @@ int ObAggregateProcessor::get_json_objectagg_result(const ObAggrInfo &aggr_info,
|
||||
scale1 = (val_type1 == ObBitType) ? aggr_info.param_exprs_.at(1)->datum_meta_.length_semantics_ : scale1;
|
||||
ObCollationType cs_type1 = tmp_obj[1].get_collation_type();
|
||||
ObString key_string = tmp_obj[0].get_string();
|
||||
if (OB_SUCC(ret) && ObCharset::charset_type_by_coll(cs_type0) != CHARSET_UTF8MB4) {
|
||||
if (OB_FAIL(ObTextStringHelper::read_real_string_data(&tmp_alloc, tmp_obj[0], key_string))) {
|
||||
LOG_WARN("fail to read key string", K(ret), K(tmp_obj[0]));
|
||||
} else if (ObCharset::charset_type_by_coll(cs_type0) != CHARSET_UTF8MB4) {
|
||||
ObString converted_key_str;
|
||||
if (OB_FAIL(ObExprUtil::convert_string_collation(key_string, cs_type0, converted_key_str,
|
||||
CS_TYPE_UTF8MB4_BIN, tmp_alloc))) {
|
||||
|
||||
@ -58,10 +58,16 @@ int ObExprTypeToStr::calc_result_type2(ObExprResType &type,
|
||||
UNUSED(type_ctx);
|
||||
UNUSED(type2);
|
||||
int ret = OB_SUCCESS;
|
||||
if (get_raw_expr()->get_extra() == 1) {
|
||||
type.set_type(ObLongTextType);
|
||||
} else {
|
||||
if (get_raw_expr()->get_extra() == 0) {
|
||||
type.set_type(ObVarcharType);
|
||||
} else {
|
||||
ObObjType dst_type = static_cast<ObObjType>(get_raw_expr()->get_extra());
|
||||
if (!ob_is_large_text(dst_type)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid dst type", K(ret), K(dst_type));
|
||||
} else {
|
||||
type.set_type(dst_type);
|
||||
}
|
||||
}
|
||||
type.set_collation_type(type1.get_collation_type());
|
||||
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||
|
||||
@ -3840,8 +3840,10 @@ int ObRawExprUtils::create_type_to_str_expr(ObRawExprFactory &expr_factory,
|
||||
LOG_ERROR("allocate expr operator failed", K(ret));
|
||||
} else {
|
||||
out_expr->set_func_name(ObString::make_string(func_name));
|
||||
if (is_lob_storage(dst_type)) {
|
||||
out_expr->set_extra(1);
|
||||
if (ob_is_large_text(dst_type)) {
|
||||
out_expr->set_extra(static_cast<uint64_t>(dst_type));
|
||||
} else {
|
||||
out_expr->set_extra(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user