Fix row comparison wrong result of decimal int type

This commit is contained in:
hezuojiao
2024-02-09 18:04:52 +00:00
committed by ob-robot
parent d16aab8060
commit dbba584bb9
20 changed files with 542 additions and 7 deletions

View File

@ -417,6 +417,17 @@ int ObSQLUtils::calc_const_or_calculable_expr(
// do nothing
} else if (OB_FAIL(calc_const_expr(*exec_ctx, raw_expr,
result, allocator, *params))) {
if (T_FUN_SYS_INNER_ROW_CMP_VALUE == raw_expr->get_expr_type()) {
if (ret == OB_ERR_MIN_VALUE) {
result.set_min_value();
is_valid = true;
ret = OB_SUCCESS;
} else if (ret == OB_ERR_MAX_VALUE) {
result.set_max_value();
is_valid = true;
ret = OB_SUCCESS;
}
}
if (ignore_failure && !IS_SPATIAL_EXPR(raw_expr->get_expr_type())) {
LOG_TRACE("failed to calc const expr, ignore the failure", K(ret));
ret = OB_SUCCESS;
@ -429,7 +440,13 @@ int ObSQLUtils::calc_const_or_calculable_expr(
LOG_WARN("failed to store result to ctx", K(ret));
}
}
if (OB_SUCC(ret) && !is_valid) {
bool add_calc_failure_cons = false;
if (OB_SUCC(ret) && T_FUN_SYS_INNER_ROW_CMP_VALUE == raw_expr->get_expr_type()) {
if (result.is_min_value() || result.is_max_value()) {
add_calc_failure_cons = true;
}
}
if (OB_SUCC(ret) && (!is_valid || add_calc_failure_cons)) {
if (NULL == constraints) {
// do nothing
} else if (OB_FAIL(add_calc_failure_constraint(raw_expr, *constraints))) {