[BUGFIX] fix enum to str typr error

This commit is contained in:
obdev
2023-03-07 10:11:25 +00:00
committed by ob-robot
parent cc7b6e8574
commit b354b4f0bf
3 changed files with 16 additions and 6 deletions

View File

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