[FEAT MERGE][435bp1] sql execution improvements

Co-authored-by: Cerdore <khn64@163.com>
Co-authored-by: qingsuijiu <642782632@qq.com>
Co-authored-by: JasonZhang10086 <zsding101@gmail.com>
This commit is contained in:
obdev
2025-02-10 07:15:36 +00:00
committed by ob-robot
parent e96d0698c8
commit 2ea249f441
150 changed files with 810984 additions and 204633 deletions

View File

@ -550,8 +550,9 @@ int ObSqlParameterization::transform_tree(TransformTreeCtx &ctx,
is_fixed = false;
}
// int constants in div/mul/add/sub
bool formalize_int_prec =
node->type_ == T_INT
bool fmt_int_or_ch_decint =
((lib::is_mysql_mode() && node->type_ == T_INT)
|| (lib::is_oracle_mode() && (node->type_ == T_NUMBER || node->type_ == T_INT)))
&& (ctx.parent_type_ == T_OP_DIV
|| ctx.parent_type_ == T_OP_MUL
|| ctx.parent_type_ == T_OP_ADD
@ -564,8 +565,8 @@ int ObSqlParameterization::transform_tree(TransformTreeCtx &ctx,
LOG_WARN("get sys variable failed", K(ret));
} else if (OB_FAIL(add_param_flag(ctx.tree_, *ctx.sql_info_))) {
SQL_PC_LOG(WARN, "fail to get neg flag", K(ret));
} else if (formalize_int_prec
&& OB_FAIL(ctx.sql_info_->formalize_prec_index_.add_member(ctx.sql_info_->total_))) {
} else if (fmt_int_or_ch_decint
&& OB_FAIL(ctx.sql_info_->fmt_int_or_ch_decint_idx_.add_member(ctx.sql_info_->total_))) {
LOG_WARN("add bitset member failed", K(ret));
} else if (OB_FAIL(ObResolverUtils::resolve_const(node,
static_cast<stmt::StmtType>(ctx.sql_info_->sql_traits_.stmt_type_),
@ -582,9 +583,8 @@ int ObSqlParameterization::transform_tree(TransformTreeCtx &ctx,
enable_decimal_int,
compat_type,
enable_mysql_compatible_dates,
session_info.get_local_ob_enable_plan_cache(),
ctx.is_from_pl_,
formalize_int_prec))) {
fmt_int_or_ch_decint))) {
SQL_PC_LOG(WARN, "fail to resolve const", K(ret));
} else {
//对于字符串值,其T_VARCHAR型的parse node有一个T_VARCHAR类型的子node,该子node描述字符串的charset等信息。
@ -1217,7 +1217,7 @@ int ObSqlParameterization::gen_special_param_info(SqlInfo &sql_info, ObPlanCache
LOG_WARN("fail to assign fixed param idx", K(ret));
} else if (OB_FAIL(pc_ctx.must_be_positive_index_.add_members2(sql_info.must_be_positive_index_))) {
LOG_WARN("failed to add bitset members", K(ret));
} else if (OB_FAIL(pc_ctx.formalize_prec_index_.add_members2(sql_info.formalize_prec_index_))){
} else if (OB_FAIL(pc_ctx.fmt_int_or_ch_decint_idx_.add_members2(sql_info.fmt_int_or_ch_decint_idx_))){
LOG_WARN("failed to add bitset members", K(ret));
}
}