Do not report ERROR when sample rate equals 100
This commit is contained in:
@ -115,10 +115,8 @@ int ObExprNullif::se_deduce_type(ObExprResType &type,
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (ob_is_decimal_int(cmp_type.get_calc_type())) {
|
||||
ObAccuracy calc_acc;
|
||||
calc_acc.precision_ = MAX(type1.get_precision(), type2.get_precision());
|
||||
calc_acc.scale_ = MAX(type1.get_scale(), type2.get_scale());
|
||||
const int64_t int_len1 = type1.get_precision() - type1.get_scale();
|
||||
const int64_t int_len2 = type2.get_precision() - type2.get_scale();
|
||||
calc_acc.precision_ = MIN(MAX(int_len1, int_len2), OB_MAX_DECIMAL_POSSIBLE_PRECISION);
|
||||
cmp_type.set_calc_accuracy(calc_acc);
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
@ -132,7 +130,7 @@ int ObExprNullif::se_deduce_type(ObExprResType &type,
|
||||
|
||||
int ObExprNullif::set_extra_info(ObExprCGCtx &expr_cg_ctx, const ObObjType cmp_type,
|
||||
const ObCollationType cmp_cs_type,
|
||||
ObSQLMode sql_mode, ObExpr &rt_expr) const
|
||||
ObExpr &rt_expr) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObCastMode cm = CM_NONE;
|
||||
@ -145,11 +143,10 @@ int ObExprNullif::set_extra_info(ObExprCGCtx &expr_cg_ctx, const ObObjType cmp_t
|
||||
} else if (OB_ISNULL(expr_cg_ctx.session_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("ctx.session is null", K(ret));
|
||||
} else if (OB_FAIL(ObSQLUtils::get_default_cast_mode(is_explicit_cast, result_flag,
|
||||
expr_cg_ctx.session_, cm))) {
|
||||
LOG_WARN("get default cast mode failed", K(ret));
|
||||
} else {
|
||||
ObSQLUtils::get_default_cast_mode(is_explicit_cast, result_flag,
|
||||
expr_cg_ctx.session_->get_stmt_type(),
|
||||
expr_cg_ctx.session_->is_ignore_stmt(),
|
||||
sql_mode, cm);
|
||||
info->cmp_meta_.type_ = cmp_type;
|
||||
info->cmp_meta_.cs_type_ = cmp_cs_type;
|
||||
info->cmp_meta_.scale_ = result_type_.get_calc_accuracy().get_scale();
|
||||
@ -169,14 +166,9 @@ int ObExprNullif::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
const uint32_t param_num = rt_expr.arg_cnt_;
|
||||
const ObObjMeta &cmp_meta = result_type_.get_calc_meta();
|
||||
const ObAccuracy &calc_acc = result_type_.get_calc_accuracy();
|
||||
ObSQLMode sql_mode = expr_cg_ctx.session_->get_sql_mode();
|
||||
if (ObNullType == rt_expr.args_[0]->datum_meta_.type_) {
|
||||
OX(rt_expr.eval_func_ = eval_nullif);
|
||||
} else if (OB_FAIL(ObSQLUtils::merge_solidified_var_into_sql_mode(&raw_expr.get_local_session_var(),
|
||||
sql_mode))) {
|
||||
LOG_WARN("try get local sql mode failed", K(ret));
|
||||
} else if (OB_FAIL(set_extra_info(expr_cg_ctx, cmp_meta.get_type(), cmp_meta.get_collation_type(),
|
||||
sql_mode,
|
||||
rt_expr))) {
|
||||
LOG_WARN("set extra info failed", K(ret));
|
||||
} else if (ob_is_enumset_inner_tc(rt_expr.args_[0]->datum_meta_.type_)) {
|
||||
@ -224,7 +216,6 @@ int ObExprNullif::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
// assign null type means can compare directly.
|
||||
info->cmp_meta_.type_ = ObNullType;
|
||||
} else {
|
||||
bool has_lob_header = is_lob_storage(cmp_meta.get_type()) && expr_cg_ctx.cur_cluster_version_ >= CLUSTER_VERSION_4_1_0_0;
|
||||
if (OB_ISNULL(cmp_func = ObExprCmpFuncsHelper::get_datum_expr_cmp_func(
|
||||
cmp_meta.get_type(),
|
||||
cmp_meta.get_type(),
|
||||
@ -234,7 +225,7 @@ int ObExprNullif::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
calc_acc.get_precision(),
|
||||
lib::is_oracle_mode(),
|
||||
cmp_meta.get_collation_type(),
|
||||
has_lob_header))){
|
||||
cmp_meta.has_lob_header()))){
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("cmp func is null", K(ret), K(cmp_meta));
|
||||
} else {
|
||||
@ -420,15 +411,5 @@ int ObExprNullif::eval_nullif_enumset(const ObExpr &expr, ObEvalCtx &ctx, ObDatu
|
||||
return ret;
|
||||
}
|
||||
|
||||
DEF_SET_LOCAL_SESSION_VARS(ObExprNullif, raw_expr) {
|
||||
int ret = OB_SUCCESS;
|
||||
if (is_mysql_mode()) {
|
||||
SET_LOCAL_SYSVAR_CAPACITY(2);
|
||||
EXPR_ADD_LOCAL_SYSVAR(SYS_VAR_SQL_MODE);
|
||||
EXPR_ADD_LOCAL_SYSVAR(SYS_VAR_COLLATION_CONNECTION);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
Reference in New Issue
Block a user