to issue<49309819><47913681>:fix serveral bugs

This commit is contained in:
hanr881
2023-05-22 05:22:26 +00:00
committed by ob-robot
parent e4c999f49e
commit a1741c2ed9
3 changed files with 33 additions and 7 deletions

View File

@ -3693,7 +3693,9 @@ int ObPLResolver::check_raw_expr_in_forall(ObRawExpr* expr, int64_t idx, bool &n
LOG_WARN("var index is invalid", K(var_idx), K(obj_access_expr->get_var_indexs()), K(ret)); LOG_WARN("var index is invalid", K(var_idx), K(obj_access_expr->get_var_indexs()), K(ret));
} else if (obj_access_expr->get_var_indexs().at(var_idx) == idx) { } else if (obj_access_expr->get_var_indexs().at(var_idx) == idx) {
need_modify = true; need_modify = true;
if (2 == obj_access_expr->get_access_idxs().count()) { if (obj_access_expr->get_var_indexs().count() != 2) {
can_array_binding = false;
} else if (2 == obj_access_expr->get_access_idxs().count()) {
// do nothing ... // do nothing ...
} else if (obj_access_expr->get_access_idxs().at(2).is_const()) { } else if (obj_access_expr->get_access_idxs().at(2).is_const()) {
can_array_binding = false; can_array_binding = false;

View File

@ -119,16 +119,39 @@ int ObExprCollectionConstruct::cg_expr(ObExprCGCtx &op_cg_ctx,
return ret; return ret;
} }
bool ObExprCollectionConstruct::is_match_type(const ObObj &element_obj, pl::ObPLType type)
int ObExprCollectionConstruct::check_match(const ObObj &element_obj, pl::ObElemDesc &desc, pl::ObPLINS &ns)
{ {
bool is_same = true; int ret = OB_SUCCESS;
pl::ObPLType type = desc.get_pl_type();
bool is_comp = false;
if (pl::PL_NESTED_TABLE_TYPE == element_obj.get_meta().get_extend_type() || if (pl::PL_NESTED_TABLE_TYPE == element_obj.get_meta().get_extend_type() ||
pl::PL_VARRAY_TYPE == element_obj.get_meta().get_extend_type()) { pl::PL_VARRAY_TYPE == element_obj.get_meta().get_extend_type()) {
is_same = pl::PL_NESTED_TABLE_TYPE == type || pl::PL_VARRAY_TYPE == type; is_comp = pl::PL_NESTED_TABLE_TYPE == type || pl::PL_VARRAY_TYPE == type;
} else { } else {
is_same = element_obj.get_meta().get_extend_type() == type; is_comp = element_obj.get_meta().get_extend_type() == type;
} }
return is_same;
if (is_comp) {
pl::ObPLComposite *composite = reinterpret_cast<pl::ObPLComposite*>(element_obj.get_ext());
CK (OB_NOT_NULL(composite));
if (OB_FAIL(ret)) {
} else if (composite->get_id() != desc.get_udt_id()) {
if (composite->is_record()) {
OZ (pl::ObPLResolver::check_composite_compatible(ns, composite->get_id(),
desc.get_udt_id(),
is_comp));
} else {
is_comp = false;
}
}
}
if (OB_SUCC(ret) && !is_comp) {
ret = OB_ERR_CALL_WRONG_ARG;
LOG_WARN("invalid argument. unexpected composite value", K(ret));
}
return ret;
} }
int ObExprCollectionConstruct::eval_collection_construct(const ObExpr &expr, int ObExprCollectionConstruct::eval_collection_construct(const ObExpr &expr,

View File

@ -17,6 +17,7 @@
#include "sql/engine/expr/ob_expr_operator.h" #include "sql/engine/expr/ob_expr_operator.h"
#include "pl/ob_pl_type.h" #include "pl/ob_pl_type.h"
#include "sql/engine/expr/ob_i_expr_extra_info.h" #include "sql/engine/expr/ob_i_expr_extra_info.h"
#include "pl/ob_pl_user_type.h"
namespace oceanbase namespace oceanbase
{ {
@ -50,7 +51,7 @@ public:
const ObRawExpr &raw_expr, ObExpr &rt_expr) const override; const ObRawExpr &raw_expr, ObExpr &rt_expr) const override;
static int eval_collection_construct(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum); static int eval_collection_construct(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
static bool is_match_type(const ObObj &element_obj, pl::ObPLType type); static int check_match(const ObObj &element_obj, pl::ObElemDesc &desc, pl::ObPLINS &ns);
struct ExtraInfo : public ObIExprExtraInfo struct ExtraInfo : public ObIExprExtraInfo
{ {