Do not report ERROR when sample rate equals 100

This commit is contained in:
ZenoWang
2024-02-06 14:49:31 +00:00
committed by ob-robot
parent 1f1d5c08ae
commit c8ef409bf3
3710 changed files with 486984 additions and 3083329 deletions

View File

@ -19,7 +19,6 @@
#include "sql/session/ob_sql_session_info.h"
#include "sql/engine/ob_exec_context.h"
#include "sql/engine/expr/ob_datum_cast.h"
#include "sql/engine/expr/ob_expr_util.h"
using namespace oceanbase::share;
using namespace oceanbase::sql;
@ -64,9 +63,6 @@ int ObExprWeekOfYear::calc_weekofyear(const ObExpr &expr, ObEvalCtx &ctx, ObDatu
ObTime ot;
ObDateSqlMode date_sql_mode;
const ObSQLSessionInfo *session = NULL;
ObSolidifiedVarsGetter helper(expr, ctx, ctx.exec_ctx_.get_my_session());
ObSQLMode sql_mode = 0;
const common::ObTimeZoneInfo *tz_info = NULL;
if (OB_ISNULL(session = ctx.exec_ctx_.get_my_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is null", K(ret));
@ -74,23 +70,16 @@ int ObExprWeekOfYear::calc_weekofyear(const ObExpr &expr, ObEvalCtx &ctx, ObDatu
LOG_WARN("eval param value failed");
} else if (OB_UNLIKELY(param_datum->is_null())) {
expr_datum.set_null();
} else if (OB_FAIL(helper.get_sql_mode(sql_mode))) {
LOG_WARN("get sql mode failed", K(ret));
} else if (OB_FAIL(helper.get_time_zone_info(tz_info))) {
LOG_WARN("get tz info failed", K(ret));
} else if (FALSE_IT(date_sql_mode.init(sql_mode))) {
} else if (FALSE_IT(date_sql_mode.init(session->get_sql_mode()))) {
} else if (OB_FAIL(ob_datum_to_ob_time_with_date(
*param_datum, expr.args_[0]->datum_meta_.type_,
expr.args_[0]->datum_meta_.scale_,
tz_info,
get_timezone_info(session),
ot, get_cur_time(ctx.exec_ctx_.get_physical_plan_ctx()), date_sql_mode,
expr.args_[0]->obj_meta_.has_lob_header()))) {
LOG_WARN("cast to ob time failed", K(ret));
uint64_t cast_mode = 0;
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(),
session->is_ignore_stmt(),
sql_mode,
cast_mode);
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(), session, cast_mode);
if (CM_IS_WARN_ON_FAIL(cast_mode)) {
ret = OB_SUCCESS;
}
@ -112,14 +101,6 @@ int ObExprWeekOfYear::is_valid_for_generated_column(const ObRawExpr*expr, const
return ret;
}
DEF_SET_LOCAL_SESSION_VARS(ObExprWeekOfYear, raw_expr) {
int ret = OB_SUCCESS;
SET_LOCAL_SYSVAR_CAPACITY(2);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_SQL_MODE);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_TIME_ZONE);
return ret;
}
ObExprWeekDay::ObExprWeekDay(ObIAllocator& alloc)
: ObFuncExprOperator(alloc,
T_FUN_SYS_WEEKDAY_OF_DATE,
@ -155,9 +136,6 @@ int ObExprWeekDay::calc_weekday(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &exp
ObTime ot;
ObDateSqlMode date_sql_mode;
const ObSQLSessionInfo *session = NULL;
ObSolidifiedVarsGetter helper(expr, ctx, ctx.exec_ctx_.get_my_session());
ObSQLMode sql_mode = 0;
const common::ObTimeZoneInfo *tz_info = NULL;
if (OB_ISNULL(session = ctx.exec_ctx_.get_my_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is null", K(ret));
@ -165,23 +143,16 @@ int ObExprWeekDay::calc_weekday(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &exp
LOG_WARN("eval param value failed");
} else if (OB_UNLIKELY(param_datum->is_null())) {
expr_datum.set_null();
} else if (OB_FAIL(helper.get_sql_mode(sql_mode))) {
LOG_WARN("get sql mode failed", K(ret));
} else if (OB_FAIL(helper.get_time_zone_info(tz_info))) {
LOG_WARN("get tz info failed", K(ret));
} else if (FALSE_IT(date_sql_mode.init(sql_mode))) {
} else if (FALSE_IT(date_sql_mode.init(session->get_sql_mode()))) {
} else if (OB_FAIL(ob_datum_to_ob_time_with_date(
*param_datum, expr.args_[0]->datum_meta_.type_,
expr.args_[0]->datum_meta_.scale_,
tz_info,
get_timezone_info(session),
ot, get_cur_time(ctx.exec_ctx_.get_physical_plan_ctx()), date_sql_mode,
expr.args_[0]->obj_meta_.has_lob_header()))) {
LOG_WARN("cast to ob time failed", K(ret));
uint64_t cast_mode = 0;
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(),
session->is_ignore_stmt(),
sql_mode,
cast_mode);
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(), session, cast_mode);
if (CM_IS_WARN_ON_FAIL(cast_mode)) {
ret = OB_SUCCESS;
}
@ -203,14 +174,6 @@ int ObExprWeekDay::is_valid_for_generated_column(const ObRawExpr*expr, const com
return ret;
}
DEF_SET_LOCAL_SESSION_VARS(ObExprWeekDay, raw_expr) {
int ret = OB_SUCCESS;
SET_LOCAL_SYSVAR_CAPACITY(2);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_SQL_MODE);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_TIME_ZONE);
return ret;
}
ObExprYearWeek::ObExprYearWeek(ObIAllocator& alloc)
: ObFuncExprOperator(alloc,
T_FUN_SYS_YEARWEEK_OF_DATE,
@ -341,9 +304,6 @@ int ObExprYearWeek::calc_yearweek(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &e
ObTime ot;
ObDateSqlMode date_sql_mode;
const ObSQLSessionInfo *session = NULL;
ObSolidifiedVarsGetter helper(expr, ctx, ctx.exec_ctx_.get_my_session());
ObSQLMode sql_mode = 0;
const common::ObTimeZoneInfo *tz_info = NULL;
if (OB_ISNULL(session = ctx.exec_ctx_.get_my_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is null", K(ret));
@ -351,22 +311,16 @@ int ObExprYearWeek::calc_yearweek(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &e
LOG_WARN("eval param value failed");
} else if (OB_UNLIKELY(param_datum->is_null())) {
expr_datum.set_null();
} else if (OB_FAIL(helper.get_sql_mode(sql_mode))) {
LOG_WARN("get sql mode failed", K(ret));
} else if (OB_FAIL(helper.get_time_zone_info(tz_info))) {
LOG_WARN("get tz info failed", K(ret));
} else if (FALSE_IT(date_sql_mode.init(sql_mode))) {
} else if (FALSE_IT(date_sql_mode.init(session->get_sql_mode()))) {
} else if (OB_FAIL(ob_datum_to_ob_time_with_date(
*param_datum, expr.args_[0]->datum_meta_.type_,
expr.args_[0]->datum_meta_.scale_,
tz_info,
get_timezone_info(session),
ot, get_cur_time(ctx.exec_ctx_.get_physical_plan_ctx()),
date_sql_mode, expr.args_[0]->obj_meta_.has_lob_header()))) {
LOG_WARN("cast to ob time failed", K(ret));
uint64_t cast_mode = 0;
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(),
session->is_ignore_stmt(),
sql_mode, cast_mode);
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(), session, cast_mode);
if (CM_IS_WARN_ON_FAIL(cast_mode)) {
ret = OB_SUCCESS;
}
@ -398,14 +352,6 @@ int ObExprYearWeek::is_valid_for_generated_column(const ObRawExpr*expr, const co
return ret;
}
DEF_SET_LOCAL_SESSION_VARS(ObExprYearWeek, raw_expr) {
int ret = OB_SUCCESS;
SET_LOCAL_SYSVAR_CAPACITY(2);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_SQL_MODE);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_TIME_ZONE);
return ret;
}
ObExprWeek::ObExprWeek(ObIAllocator& alloc)
: ObFuncExprOperator(alloc,
T_FUN_SYS_WEEK,
@ -476,9 +422,6 @@ int ObExprWeek::calc_week(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datu
ObTime ot;
ObDateSqlMode date_sql_mode;
const ObSQLSessionInfo *session = NULL;
ObSolidifiedVarsGetter helper(expr, ctx, ctx.exec_ctx_.get_my_session());
ObSQLMode sql_mode = 0;
const common::ObTimeZoneInfo *tz_info = NULL;
if (OB_ISNULL(session = ctx.exec_ctx_.get_my_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is null", K(ret));
@ -486,23 +429,16 @@ int ObExprWeek::calc_week(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datu
LOG_WARN("eval param value failed");
} else if (OB_UNLIKELY(param_datum->is_null())) {
expr_datum.set_null();
} else if (OB_FAIL(helper.get_sql_mode(sql_mode))) {
LOG_WARN("get sql mode failed", K(ret));
} else if (OB_FAIL(helper.get_time_zone_info(tz_info))) {
LOG_WARN("get tz info failed", K(ret));
} else if (FALSE_IT(date_sql_mode.init(sql_mode))) {
} else if (FALSE_IT(date_sql_mode.init(session->get_sql_mode()))) {
} else if (OB_FAIL(ob_datum_to_ob_time_with_date(
*param_datum, expr.args_[0]->datum_meta_.type_,
expr.args_[0]->datum_meta_.scale_,
tz_info,
get_timezone_info(session),
ot, get_cur_time(ctx.exec_ctx_.get_physical_plan_ctx()), date_sql_mode,
expr.args_[0]->obj_meta_.has_lob_header()))) {
LOG_WARN("cast to ob time failed", K(ret));
uint64_t cast_mode = 0;
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(),
session->is_ignore_stmt(),
sql_mode,
cast_mode);
ObSQLUtils::get_default_cast_mode(session->get_stmt_type(), session, cast_mode);
if (CM_IS_WARN_ON_FAIL(cast_mode)) {
LOG_WARN("cast to ob time failed", K(ret));
LOG_USER_WARN(OB_ERR_CAST_VARCHAR_TO_TIME);
@ -540,13 +476,5 @@ int ObExprWeek::is_valid_for_generated_column(const ObRawExpr*expr, const common
return ret;
}
DEF_SET_LOCAL_SESSION_VARS(ObExprWeek, raw_expr) {
int ret = OB_SUCCESS;
SET_LOCAL_SYSVAR_CAPACITY(2);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_SQL_MODE);
EXPR_ADD_LOCAL_SYSVAR(share::SYS_VAR_TIME_ZONE);
return ret;
}
}
}