fix not null judgement bug with cast expr

This commit is contained in:
yinyj17 2024-12-12 11:44:39 +00:00 committed by ob-robot
parent 93321e2a31
commit 317b7c456f
2 changed files with 8 additions and 3 deletions

View File

@ -211,7 +211,7 @@ int ObPredicateDeduce::choose_unequal_preds(ObTransformerCtx &ctx,
if (OB_FAIL(topo_sort(topo_order_))) {
LOG_WARN("failed to topo sort", K(ret));
}
for (int64_t i = 0; i < topo_order_.count(); ++i) {
for (int64_t i = 0; OB_SUCC(ret) && i < topo_order_.count(); ++i) {
// if a variable A equal with a const B,
// there is no need to deduce unequal predicates like A > c1 for A
// because, it is better to replace that with B > c1

View File

@ -2489,8 +2489,13 @@ int ObTransformUtils::is_general_expr_not_null(ObNotNullContext &ctx,
}
}
} else if (T_FUN_SYS_CAST == expr->get_expr_type()) {
if (OB_FAIL(check_list.push_back(expr->get_param_expr(0)))) {
LOG_WARN("failed to append check list", K(ret));
const ObExprResType &res_type = expr->get_result_type();
if (res_type.is_numeric_type()
|| res_type.is_string_or_lob_locator_type()
|| res_type.is_oracle_temporal_type()) {
if (OB_FAIL(check_list.push_back(expr->get_param_expr(0)))) {
LOG_WARN("failed to append check list", K(ret));
}
}
} else if (T_FUN_SYS_NVL == expr->get_expr_type()) {
if (OB_FAIL(check_list.push_back(expr->get_param_expr(1)))) {