to issue<38211687><49782442><36841844><33833762>:fix serveral bugs

This commit is contained in:
hanr881
2023-05-29 09:11:05 +00:00
committed by ob-robot
parent 7ab18a630b
commit 3f332fa853
10 changed files with 59 additions and 30 deletions

View File

@ -127,7 +127,7 @@ int ObExprObjAccess::assign(const ObExprOperator &other)
return ret;
}
#define GET_VALID_INT64_PARAM(obj) \
#define GET_VALID_INT64_PARAM(obj, skip_check_error) \
do { \
if (OB_SUCC(ret)) { \
int64_t param_value = 0; \
@ -144,9 +144,13 @@ int ObExprObjAccess::assign(const ObExprOperator &other)
} \
} \
} else if (obj.is_null()) { \
ret = OB_ERR_NUMERIC_OR_VALUE_ERROR; \
LOG_WARN("ORA-06502: PL/SQL: numeric or value error: NULL index table key value",\
if (!skip_check_error) { \
ret = OB_ERR_NUMERIC_OR_VALUE_ERROR; \
LOG_WARN("ORA-06502: PL/SQL: numeric or value error: NULL index table key value",\
K(ret), K(obj), K(i)); \
} else { \
param_value = OB_INVALID_INDEX; \
} \
} else { \
ret = OB_ERR_UNEXPECTED; \
LOG_WARN("obj param is invalid type", K(obj), K(i)); \
@ -167,12 +171,12 @@ int ObExprObjAccess::ExtraInfo::init_param_array(const ParamStore &param_store,
CK (param_idxs_.at(i) >= 0 && param_idxs_.at(i) < param_store.count());
if (OB_SUCC(ret)) {
const ObObjParam &obj_param = param_store.at(param_idxs_.at(i));
GET_VALID_INT64_PARAM(obj_param);
GET_VALID_INT64_PARAM(obj_param, false);
}
}
for (int64_t i = 0; OB_SUCC(ret) && i < param_num; ++i) {
const ObObj &obj = objs_stack[i];
GET_VALID_INT64_PARAM(obj);
GET_VALID_INT64_PARAM(obj, (i == param_num - 1 && pl::ObCollectionType::NEXT_PROPERTY == property_type_));
}
return ret;
}

View File

@ -23,7 +23,8 @@ namespace sql
OB_SERIALIZE_MEMBER((ObExprPLAssocIndex, ObExprOperator),
info_.for_write_,
info_.out_of_range_set_err_,
info_.parent_expr_type_);
info_.parent_expr_type_,
info_.is_index_by_varchar_);
ObExprPLAssocIndex::ObExprPLAssocIndex(ObIAllocator &alloc)
: ObExprOperator(alloc, T_FUN_PL_ASSOCIATIVE_INDEX, N_PL_ASSOCIATIVE_INDEX, 2, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION,
@ -85,6 +86,7 @@ int ObExprPLAssocIndex::cg_expr(ObExprCGCtx &op_cg_ctx,
info.for_write_ = assoc_idx_expr.get_write();
info.out_of_range_set_err_ = assoc_idx_expr.get_out_of_range_set_err();
info.parent_expr_type_ = assoc_idx_expr.get_parent_type();
info.is_index_by_varchar_ = assoc_idx_expr.is_index_by_varchar();
rt_expr.extra_ = info.v_;
rt_expr.eval_func_ = &eval_assoc_idx;

View File

@ -36,6 +36,7 @@ public:
inline void set_write(bool for_write) { info_.for_write_ = for_write; }
inline void set_out_of_range_set_err(bool v) { info_.out_of_range_set_err_ = v; }
inline void set_parent_expr_type(pl::parent_expr_type type) { info_.parent_expr_type_ = type; }
inline void set_is_index_by_varchar(bool v) { info_.is_index_by_varchar_ = v; }
VIRTUAL_TO_STRING_KV(N_EXPR_TYPE, get_type_name(type_),
@ -45,7 +46,8 @@ public:
N_REAL_PARAM_NUM, real_param_num_,
K_(info_.for_write),
K_(info_.out_of_range_set_err),
K_(info_.parent_expr_type));
K_(info_.parent_expr_type),
K_(info_.is_index_by_varchar));
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
const ObRawExpr &raw_expr, ObExpr &rt_expr) const override;
@ -55,17 +57,19 @@ private:
Info()
: for_write_(false),
out_of_range_set_err_(true),
parent_expr_type_(pl::parent_expr_type::EXPR_UNKNOWN)
parent_expr_type_(pl::parent_expr_type::EXPR_UNKNOWN),
is_index_by_varchar_(false)
{
}
TO_STRING_KV(K(for_write_), K(out_of_range_set_err_), K(parent_expr_type_));
TO_STRING_KV(K(for_write_), K(out_of_range_set_err_), K(parent_expr_type_), K(is_index_by_varchar_));
union {
struct {
bool for_write_;
bool out_of_range_set_err_;
pl::parent_expr_type parent_expr_type_;
bool is_index_by_varchar_;
} __attribute__((packed));
uint64_t v_;
};