提交 490ce0a9 编写于 作者: X xf0 提交者: wangzelin.wzl

fix bugs of INET expr

上级 72122fbe
......@@ -49,7 +49,7 @@ int ObExprCase::calc_result_typeN(
} else { // param_num >=3 and param_num is odd
/* in order to be compatible with mysql
* both in ob_expr_cae.cpp and ob_expr_arg_case.cpp
* both in ob_expr_case.cpp and ob_expr_arg_case.cpp
* types_stack includes the condition exprs.
* In expr_case, there is no arg param expr compared with expr_arg_case
*/
......
......@@ -52,7 +52,7 @@ int ObExprExportSet::calc_result_typeN(ObExprResType& type, ObExprResType* types
int64_t str_num = 2;
const uint64_t max_len = std::max(on_len, off_len);
// when bits exceed uint_max or int_min, ob is not compatible to mysql.
types_array[0].set_calc_type(common::ObBitType);
types_array[0].set_calc_type(common::ObUInt64Type);
types_array[1].set_calc_type(common::ObVarcharType);
types_array[2].set_calc_type(common::ObVarcharType);
if (3 < param_num) {
......@@ -130,7 +130,7 @@ int ObExprExportSet::calc_export_set(ObObj& result, const ObObj& bits, const ObO
local_on = on.get_string();
local_off = off.get_string();
local_sep = sep.get_string();
if (OB_FAIL(bits.get_bit(local_bits))) {
if (OB_FAIL(bits.get_uint64(local_bits))) {
LOG_WARN("fail to get bit", K(ret), K(bits));
} else if (OB_FAIL(n_bits.get_int(local_n_bits))) {
LOG_WARN("fail to get int", K(ret), K(n_bits));
......
......@@ -468,7 +468,7 @@ inline int ObExprInet6Ntoa::calc_result_type1(
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is null",K(ret));
} else {
type.set_collation_type(session->get_nls_collation());
type.set_collation_type(get_default_collation_type(type.get_type(), *type_ctx.get_session()));
}
return ret;
}
......
......@@ -39,16 +39,15 @@ private:
inline int ObExprInt2ip::calc_result_type1(
ObExprResType& type, ObExprResType& text, common::ObExprTypeCtx& type_ctx) const
{
UNUSED(type_ctx);
UNUSED(text);
type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_STRING_INTEGER_TRUNC);
text.set_calc_type(common::ObIntType);
type.set_varchar();
type.set_length(common::MAX_IP_ADDR_LENGTH);
type.set_collation_level(common::CS_LEVEL_COERCIBLE);
type.set_default_collation_type();
// set calc type
text.set_calc_type(common::ObIntType);
return common::OB_SUCCESS;
}
} // namespace sql
} // namespace oceanbase
}
}
#endif /* OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_INT2IP_ */
......@@ -3362,7 +3362,7 @@ int ObTransformPreProcess::create_equal_expr_for_case_expr(ObRawExprFactory& exp
int ret = OB_SUCCESS;
ObObjType obj_type = ObMaxType;
const ObExprResType& arg_type = arg_expr->get_result_type();
const ObExprResType& when_type = arg_expr->get_result_type();
const ObExprResType& when_type = when_expr->get_result_type();
ObRawExpr* new_when_expr = NULL; // cast expr may added
ObRawExpr* new_arg_expr = NULL;
if (OB_ISNULL(arg_expr) || OB_ISNULL(when_expr)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册