提交 1765522f 编写于 作者: B br0 提交者: wangzelin.wzl

Fix enumset cast to time in static typing engine

上级 b2e66c1c
......@@ -368,7 +368,19 @@ int ObExprCast::calc_result_type2(
OZ(ObRawExprUtils::setup_extra_cast_utf8_type(dst_type, dst_type_utf8));
OX(type1.set_calc_meta(dst_type_utf8.get_obj_meta()));
} else {
type1.set_calc_meta(type1.get_obj_meta());
bool need_warp = false;
if (ob_is_enumset_tc(type1.get_type())) {
// For enum/set type, need to check whether warp to string is required.
if (OB_FAIL(ObRawExprUtils::need_wrap_to_string(type1.get_type(), type1.get_calc_type(), false, need_warp))) {
LOG_WARN("need_wrap_to_string failed", K(ret), K(type1));
}
} else if (OB_LIKELY(need_warp)) {
// need_warp is true, no-op and keep type1's calc_type is dst_type. It will be wrapped
// to string in ObRawExprWrapEnumSet::visit(ObSysFunRawExpr &expr) later.
} else {
// need_warp is false, set calc_type to type1 itself.
type1.set_calc_meta(type1.get_obj_meta());
}
}
} else {
// no need to set cast mode, already setup while deduce type.
......
......@@ -721,6 +721,7 @@ int ObRawExprWrapEnumSet::visit(ObSysFunRawExpr& expr)
} else if (ob_is_enumset_tc(param_expr->get_data_type())) {
ObObjType calc_type = expr.get_input_types().at(i).get_calc_type();
ObSysFunRawExpr* wrapped_expr = NULL;
// Enumset warp to string in CAST expr will be handled here.
if (OB_FAIL(wrap_type_to_str_if_necessary(
param_expr, calc_type, get_current_level(), is_same_need, wrapped_expr))) {
LOG_WARN("failed to wrap_type_to_str_if_necessary", K(i), K(expr), K(ret));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册