diff --git a/src/sql/rewrite/ob_predicate_deduce.cpp b/src/sql/rewrite/ob_predicate_deduce.cpp index 968550695..ab848c274 100644 --- a/src/sql/rewrite/ob_predicate_deduce.cpp +++ b/src/sql/rewrite/ob_predicate_deduce.cpp @@ -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 diff --git a/src/sql/rewrite/ob_transform_utils.cpp b/src/sql/rewrite/ob_transform_utils.cpp index 007124237..993ee5fb2 100644 --- a/src/sql/rewrite/ob_transform_utils.cpp +++ b/src/sql/rewrite/ob_transform_utils.cpp @@ -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)))) {