[CP] [to #53934515] Fix decode expression does not support returning complex types

This commit is contained in:
obdev
2024-02-08 22:01:53 +00:00
committed by ob-robot
parent abac97250c
commit a7bd5725da

View File

@ -234,7 +234,14 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
} }
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
ObObjType result_type = enumset_calc_types_[OBJ_TYPE_TO_CLASS[type.get_type()]]; ObObjType result_type = ObMaxType;
if(OBJ_TYPE_TO_CLASS[type.get_type()] == ObExtendTC) {
result_type = ObExtendType;
}
else {
// 这里针对calc的转换是不是可以直接用在result上??
result_type = enumset_calc_types_[OBJ_TYPE_TO_CLASS[type.get_type()]];
}
if (OB_UNLIKELY(ObMaxType == result_type)) { if (OB_UNLIKELY(ObMaxType == result_type)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
SQL_ENG_LOG(WARN, "invalid type of parameter ", K(type), K(ret)); SQL_ENG_LOG(WARN, "invalid type of parameter ", K(type), K(ret));
@ -350,6 +357,10 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type,
type.set_length(len); type.set_length(len);
} }
} }
if(ob_is_extend(type.get_type())) {
type.set_extend_type(types_stack[RESULT_TYPE_INDEX].get_extend_type());
type.set_accuracy(types_stack[RESULT_TYPE_INDEX].get_accuracy().get_accuracy());
}
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
types_stack[0].set_calc_meta(type.get_calc_meta()); types_stack[0].set_calc_meta(type.get_calc_meta());