[to #50702943]fixed some define_array/execute_and_fetch bug

This commit is contained in:
LiuYoung00
2023-08-28 11:40:33 +00:00
committed by ob-robot
parent 89d21d42bc
commit 886a2c7275
3 changed files with 47 additions and 60 deletions

View File

@ -78,6 +78,21 @@ int ObExprPLAssocIndex::do_eval_assoc_index(int64_t &assoc_idx,
const Info &info,
pl::ObPLAssocArray &assoc_array_ref,
const common::ObObj &key)
{
return do_eval_assoc_index(assoc_idx,
exec_ctx.get_my_session(),
info,
assoc_array_ref,
key,
exec_ctx.get_allocator());
}
int ObExprPLAssocIndex::do_eval_assoc_index(int64_t &assoc_idx,
ObSQLSessionInfo *session,
const Info &info,
pl::ObPLAssocArray &assoc_array_ref,
const common::ObObj &key,
ObIAllocator &allocator)
{
int ret = OB_SUCCESS;
pl::ObPLAssocArray *assoc_array = &assoc_array_ref;
@ -110,9 +125,9 @@ int ObExprPLAssocIndex::do_eval_assoc_index(int64_t &assoc_idx,
if (OB_SUCC(ret)) {
if (info.for_write_) {
if (OB_INVALID_INDEX == index) {
pl::ObPLExecCtx *pl_exec_ctx = exec_ctx.get_my_session()->get_pl_context()->get_current_ctx();
if (OB_FAIL(ObSPIService::spi_extend_assoc_array(exec_ctx.get_my_session()->get_effective_tenant_id(),
pl_exec_ctx, exec_ctx.get_allocator(), *assoc_array, 1))) {
pl::ObPLExecCtx *pl_exec_ctx = session->get_pl_context()->get_current_ctx();
if (OB_FAIL(ObSPIService::spi_extend_assoc_array(session->get_effective_tenant_id(),
pl_exec_ctx, allocator, *assoc_array, 1))) {
LOG_WARN("failed to spi_set_collection_data", K(*assoc_array), K(ret));
}
}

View File

@ -52,7 +52,7 @@ public:
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
const ObRawExpr &raw_expr, ObExpr &rt_expr) const override;
static int eval_assoc_idx(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
private:
struct Info {
Info()
: for_write_(false),
@ -83,11 +83,17 @@ private:
const Info &info,
pl::ObPLAssocArray &assoc_array,
const common::ObObj &key);
static int do_eval_assoc_index(int64_t &assoc_idx,
ObSQLSessionInfo *session,
const Info &info,
pl::ObPLAssocArray &assoc_array_ref,
const common::ObObj &key,
ObIAllocator &allocator);
static int reserve_assoc_key(pl::ObPLAssocArray &assoc_array);
#endif
DISALLOW_COPY_AND_ASSIGN(ObExprPLAssocIndex);
private:
Info info_;
};