[CP] [to #55181624] fix mysqltest

This commit is contained in:
obdev 2024-03-25 13:15:40 +00:00 committed by ob-robot
parent 7e698e0e07
commit e2a201048b
3 changed files with 24 additions and 52 deletions

View File

@ -10363,40 +10363,6 @@ int ObPLResolver::init_udf_info_of_accessidents(ObIArray<ObObjAccessIdent> &acce
return ret;
}
int ObPLResolver::mock_self_param(bool need_rotate,
ObIArray<ObObjAccessIdent> &obj_access_idents,
ObIArray<ObObjAccessIdx> &self_access_idxs,
ObPLFunctionAST &func)
{
int ret = OB_SUCCESS;
uint64_t acc_cnt = obj_access_idents.count();
ObRawExpr *self_arg = NULL;
if (!(self_access_idxs.count() > 0 &&
ObObjAccessIdx::IS_UDT_NS == self_access_idxs.at(self_access_idxs.count() - 1).access_type_)) {
if (self_access_idxs.at(self_access_idxs.count() - 1).is_udf_type()) {
OX (self_arg = self_access_idxs.at(self_access_idxs.count() - 1).get_sysfunc_);
CK (OB_NOT_NULL(self_arg));
} else {
OZ (make_var_from_access(self_access_idxs,
expr_factory_,
&resolve_ctx_.session_info_,
&resolve_ctx_.schema_guard_,
current_block_->get_namespace(),
self_arg), K(obj_access_idents), K(self_access_idxs));
OZ (func.add_obj_access_expr(self_arg));
}
OZ (func.add_expr(self_arg));
OZ (obj_access_idents.at(acc_cnt - 1).params_.push_back(std::make_pair(self_arg, 0)));
if (OB_SUCC(ret) && need_rotate) {
std::rotate(obj_access_idents.at(acc_cnt - 1).params_.begin(),
obj_access_idents.at(acc_cnt - 1).params_.begin()
+ obj_access_idents.at(acc_cnt - 1).params_.count() - 1,
obj_access_idents.at(acc_cnt - 1).params_.end());
}
}
return ret;
}
int ObPLResolver::resolve_inner_call(
const ParseNode *parse_tree, ObPLStmt *&stmt, ObPLFunctionAST &func)
{
@ -11836,6 +11802,10 @@ int ObPLResolver::add_udt_self_argument(const ObIRoutineInfo *routine_info,
OX (last_idx = access_idxs.at(access_idxs.count() - 1));
OX (access_idxs.pop_back());
OZ (add_udt_self_argument(routine_info, local_expr_params, access_idxs, NULL, func));
if (OB_ERR_VARIABLE_IS_READONLY == ret) {
ret = OB_ERR_EXP_NOT_ASSIGNABLE;
LOG_WARN("expression cannot be used as an assignment", K(ret));
}
OZ (access_idxs.push_back(last_idx));
if (OB_SUCC(ret) && local_expr_params.count() > orig_expr_params_cnt) {
OZ (access_ident.params_.push_back(std::make_pair(local_expr_params.at(local_expr_params.count() - 1), 0)));
@ -11877,7 +11847,6 @@ int ObPLResolver::add_udt_self_argument(const ObIRoutineInfo *routine_info,
CK (OB_NOT_NULL(self_argument));
OZ (self_argument->formalize(&resolve_ctx_.session_info_));
OX (udf_info->set_is_udf_udt_cons());
OZ (func.add_expr(self_argument));
} else if (access_idxs.count() > 0) { // Member Self Argument With Prefix.
if (access_idxs.at(access_idxs.count() - 1).is_udf_type()) {
OX (self_argument = access_idxs.at(access_idxs.count() - 1).get_sysfunc_);
@ -11889,7 +11858,6 @@ int ObPLResolver::add_udt_self_argument(const ObIRoutineInfo *routine_info,
&resolve_ctx_.schema_guard_,
current_block_->get_namespace(),
self_argument));
OZ (func.add_expr(self_argument));
if (OB_SUCC(ret) && !ObObjAccessIdx::is_expr_type(access_idxs)) {
bool for_write = false;
ObIRoutineParam *param = nullptr;
@ -11902,9 +11870,9 @@ int ObPLResolver::add_udt_self_argument(const ObIRoutineInfo *routine_info,
}
} else { // Member Self Argument Without Prefix.
OZ (make_self_symbol_expr(func, self_argument));
OZ (func.add_expr(self_argument));
}
CK (OB_NOT_NULL(self_argument));
OZ (func.add_expr(self_argument));
OZ (self_argument->add_flag(IS_UDT_UDF_SELF_PARAM));
if (OB_SUCC(ret) && self_argument->is_obj_access_expr()) {
OZ (func.add_obj_access_expr(self_argument));

View File

@ -335,10 +335,6 @@ public:
sql::ObRawExpr *&expr,
bool for_write = false);
int resolve_inner_call(const ParseNode *parse_tree, ObPLStmt *&stmt, ObPLFunctionAST &func);
int mock_self_param(bool need_rotate,
ObIArray<ObObjAccessIdent> &obj_access_idents,
ObIArray<ObObjAccessIdx> &self_access_idxs,
ObPLFunctionAST &func);
int resolve_sqlcode_or_sqlerrm(sql::ObQualifiedName &q_name,
ObPLCompileUnitAST &unit_ast,
sql::ObRawExpr *&expr);

View File

@ -4343,18 +4343,26 @@ int ObPLCompileUnitAST::check_simple_calc_expr(ObRawExpr *&expr, bool &is_simple
int ObPLCompileUnitAST::add_expr(sql::ObRawExpr* expr, bool is_simple_integer)
{
int ret = OB_SUCCESS;
if (lib::is_oracle_mode()) {
bool is_simple_calc = false;
if (!is_simple_integer && OB_FAIL(check_simple_calc_expr(expr, is_simple_calc))) {
LOG_WARN("failed to check simple calc expr", K(expr), K(ret));
} else if (is_simple_calc || is_simple_integer) {
if (OB_FAIL(add_simple_calc(exprs_.count()))) {
LOG_WARN("failed to check simple calc expr", K(expr), K(ret));
}
} else { /*do nothing*/ }
bool exists = false;
for (int64_t i = 0; !exists && i < exprs_.count(); ++i) {
if (expr == exprs_.at(i)) {
exists = true;
}
}
if (OB_SUCC(ret) && OB_FAIL(exprs_.push_back(expr))) {
LOG_WARN("push back error", K(expr), K(ret));
if (!exists) {
if (lib::is_oracle_mode()) {
bool is_simple_calc = false;
if (!is_simple_integer && OB_FAIL(check_simple_calc_expr(expr, is_simple_calc))) {
LOG_WARN("failed to check simple calc expr", K(expr), K(ret));
} else if (is_simple_calc || is_simple_integer) {
if (OB_FAIL(add_simple_calc(exprs_.count()))) {
LOG_WARN("failed to check simple calc expr", K(expr), K(ret));
}
} else { /*do nothing*/ }
}
if (OB_SUCC(ret) && OB_FAIL(exprs_.push_back(expr))) {
LOG_WARN("push back error", K(expr), K(ret));
}
}
return ret;
}