From a7bd5725da04fb5d7ff689ff987dca7f6686cc28 Mon Sep 17 00:00:00 2001 From: obdev Date: Thu, 8 Feb 2024 22:01:53 +0000 Subject: [PATCH] [CP] [to #53934515] Fix decode expression does not support returning complex types --- src/sql/engine/expr/ob_expr_oracle_decode.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sql/engine/expr/ob_expr_oracle_decode.cpp b/src/sql/engine/expr/ob_expr_oracle_decode.cpp index 2590668b4f..fc4396cfa5 100644 --- a/src/sql/engine/expr/ob_expr_oracle_decode.cpp +++ b/src/sql/engine/expr/ob_expr_oracle_decode.cpp @@ -234,7 +234,14 @@ int ObExprOracleDecode::calc_result_typeN(ObExprResType &type, } } 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)) { ret = OB_ERR_UNEXPECTED; 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); } } + 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)) { types_stack[0].set_calc_meta(type.get_calc_meta());