Fix row comparison wrong result of decimal int type

This commit is contained in:
hezuojiao
2024-01-19 02:42:37 +00:00
committed by ob-robot
parent e8bde18018
commit 658c51919f
20 changed files with 542 additions and 7 deletions

View File

@ -7710,6 +7710,8 @@ int ObRawExprUtils::create_real_cast_expr(ObRawExprFactory &expr_factory,
}
if (OB_FAIL(func_expr->add_param_expr(dst_expr))) {
LOG_WARN("add dest type expr failed", K(ret));
} else {
func_expr->set_result_type(dst_type);
}
LOG_DEBUG("create_cast_expr debug", K(ret), K(*src_expr), K(dst_type),
K(*func_expr), K(lbt()), K(func_expr));
@ -8493,6 +8495,40 @@ int ObRawExprUtils::build_pack_expr(ObRawExprFactory &expr_factory,
return ret;
}
int ObRawExprUtils::build_inner_row_cmp_expr(ObRawExprFactory &expr_factory,
const ObSQLSessionInfo *session_info,
ObRawExpr *cast_expr,
ObRawExpr *input_expr,
ObRawExpr *next_expr,
const uint64_t ret_code,
ObSysFunRawExpr *&new_expr)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(session_info) || OB_ISNULL(cast_expr) ||
OB_ISNULL(input_expr) || OB_ISNULL(next_expr)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("get unexpected null", K(ret), K(session_info), K(cast_expr), K(input_expr),
K(next_expr));
} else if (OB_FAIL(expr_factory.create_raw_expr(T_FUN_SYS_INNER_ROW_CMP_VALUE, new_expr))) {
LOG_WARN("create inner row cmp value expr failed", K(ret));
} else if (OB_ISNULL(new_expr)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("inner row cmp value expr is null", K(ret));
} else if (OB_FAIL(new_expr->add_param_expr(cast_expr))) {
LOG_WARN("fail to add param expr", K(ret));
} else if (OB_FAIL(new_expr->add_param_expr(input_expr))) {
LOG_WARN("fail to add param expr", K(ret));
} else if (OB_FAIL(new_expr->add_param_expr(next_expr))) {
LOG_WARN("fail to add param expr", K(ret));
} else if (OB_FAIL(new_expr->formalize(session_info))) {
LOG_WARN("fail to formalize expr", K(*new_expr), K(ret));
} else {
new_expr->set_func_name("INTERNAL_FUNCTION");
new_expr->set_extra(ret_code);
}
return ret;
}
// 这个函数只会在 pl 里被调到,会设置 ObRawExpr 的被调用模式,用于区分是在 pl 还是 sql 中被调用
int ObRawExprUtils::set_call_in_pl(ObRawExpr *&raw_expr)
{