[to #50047193] fix package dependence & assoc array index parameter

This commit is contained in:
obdev
2023-05-31 07:41:50 +00:00
committed by ob-robot
parent a09b9617bc
commit ccd5cec2e7
2 changed files with 37 additions and 9 deletions

View File

@ -5792,7 +5792,13 @@ int ObPLResolver::resolve_inout_param(ObRawExpr *param_expr, ObPLRoutineParamMod
OZ (obj_expr->formalize(&get_resolve_ctx().session_info_));
for (int64_t i = 0; OB_SUCC(ret) && i < obj_expr->get_param_count(); ++i) {
if (T_FUN_PL_ASSOCIATIVE_INDEX == obj_expr->get_param_expr(i)->get_expr_type()) {
static_cast<ObPLAssocIndexRawExpr*>(obj_expr->get_param_expr(i))->set_write(true);
ObPLAssocIndexRawExpr* index_expr = static_cast<ObPLAssocIndexRawExpr*>(obj_expr->get_param_expr(i));
CK (OB_NOT_NULL(index_expr));
OX (index_expr->set_write(true));
if (OB_SUCC(ret) && index_expr->get_param_expr(0)->is_obj_access_expr()) {
CK (OB_NOT_NULL(static_cast<ObObjAccessRawExpr*>(index_expr->get_param_expr(0))));
OX (static_cast<ObObjAccessRawExpr*>(index_expr->get_param_expr(0))->set_write(true));
}
}
}
} else if (param_expr->is_const_raw_expr()) { // 本地变量做出参
@ -8926,7 +8932,14 @@ int ObPLResolver::resolve_raw_expr(const ParseNode &node,
OZ(expr->formalize(&ns.get_external_ns()->get_resolve_ctx().session_info_));
for (int64_t i = 0; OB_SUCC(ret) && i < expr->get_param_count(); ++i) {
if (T_FUN_PL_ASSOCIATIVE_INDEX == expr->get_param_expr(i)->get_expr_type()) {
static_cast<ObPLAssocIndexRawExpr*>(expr->get_param_expr(i))->set_write(for_write);
ObPLAssocIndexRawExpr* index_expr = static_cast<ObPLAssocIndexRawExpr*>(expr->get_param_expr(i));
CK (OB_NOT_NULL(index_expr));
OX (index_expr->set_write(for_write));
if (OB_SUCC(ret) && index_expr->get_param_expr(0)->is_obj_access_expr()) {
CK (OB_NOT_NULL(static_cast<ObObjAccessRawExpr*>(index_expr->get_param_expr(0))));
OX (static_cast<ObObjAccessRawExpr*>(index_expr->get_param_expr(0))->set_write(for_write));
}
}
}
}
@ -9703,9 +9716,7 @@ int ObPLResolver::resolve_object_construct(const sql::ObQualifiedName &q_name,
{
int ret = OB_SUCCESS;
uint64_t type_id = OB_INVALID_ID;
bool is_sys_type = false;
OX (type_id = user_type->get_user_type_id());
OX (is_sys_type = (OB_SYS_TENANT_ID == get_tenant_id_by_object_id(type_id)));
if (OB_SUCC(ret)) {
ObUDFInfo &uinfo = const_cast<ObUDFInfo &>(udf_info);
if (uinfo.udf_package_.empty()) {
@ -9722,7 +9733,7 @@ int ObPLResolver::resolve_object_construct(const sql::ObQualifiedName &q_name,
} else {
// do nothing
}
if (OB_SUCC(ret) && (!is_sys_type || user_type->is_opaque_type())) {
if (OB_SUCC(ret)) {
SMART_VAR(ObPLFunctionAST, dummy_ast, resolve_ctx_.allocator_) {
ObSEArray<ObObjAccessIdx, 1> access_idxs;
OZ (resolve_udf_info(uinfo, access_idxs, dummy_ast));
@ -9736,10 +9747,9 @@ int ObPLResolver::resolve_object_construct(const sql::ObQualifiedName &q_name,
// on the other side: object(a number, constructor(a number) constructor object(a varchar));
// resolve_udf will pick the right one, we dont need to resolve record_construct.
bool use_buildin_default_constructor = is_sys_type ? (user_type->is_opaque_type() ? false : true) : false;
bool use_buildin_default_constructor = false;
if (OB_SUCC(ret)
&& !uinfo.is_udt_overload_default_cons()
&& !is_sys_type
&& !user_type->is_opaque_type()) { // opaque type has no member, do not check
const ObRecordType *object_type = NULL;
CK (OB_NOT_NULL(object_type = dynamic_cast<const ObRecordType *>(user_type)));
@ -11445,8 +11455,13 @@ int ObPLResolver::make_var_from_access(const ObIArray<ObObjAccessIdx> &access_id
CK (OB_NOT_NULL(obj_access_ref->get_param_expr(i)));
if (OB_SUCC(ret)
&& T_FUN_PL_ASSOCIATIVE_INDEX == obj_access_ref->get_param_expr(i)->get_expr_type()) {
static_cast<ObPLAssocIndexRawExpr*>
(obj_access_ref->get_param_expr(i))->set_write(for_write);
ObPLAssocIndexRawExpr* index_expr = static_cast<ObPLAssocIndexRawExpr*>(obj_access_ref->get_param_expr(i));
CK (OB_NOT_NULL(index_expr));
OX (index_expr->set_write(for_write));
if (OB_SUCC(ret) && index_expr->get_param_expr(0)->is_obj_access_expr()) {
CK (OB_NOT_NULL(static_cast<ObObjAccessRawExpr*>(index_expr->get_param_expr(0))));
OX (static_cast<ObObjAccessRawExpr*>(index_expr->get_param_expr(0))->set_write(for_write));
}
}
}
OZ (obj_access_ref->formalize(session_info));