fix used incorrect cached temp expr ctx bug
This commit is contained in:
@ -1021,6 +1021,8 @@ int ObLoadDataSPImpl::exec_shuffle(int64_t task_id, ObShuffleTaskHandle *handle)
|
||||
LOG_WARN("fail to init buffer", K(ret));
|
||||
} else if (OB_FAIL(parse_result.prepare_allocate(handle->generator.get_field_exprs().count()))) {
|
||||
LOG_WARN("fail to allocate", K(ret));
|
||||
} else {
|
||||
handle->exec_ctx.set_use_temp_expr_ctx_cache(true);
|
||||
}
|
||||
|
||||
while (OB_SUCC(ret) && ptr < end) {
|
||||
|
||||
@ -229,9 +229,9 @@ int ObExprToOutfileRow::extract_fisrt_wchar_from_varhcar(const ObObj &obj, int32
|
||||
// as NULL, not \N.
|
||||
int ObExprToOutfileRow::print_field(char *buf, const int64_t buf_len, int64_t &pos,
|
||||
const ObObj &obj, ObExprOutFileInfo &out_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t tmp_pos = 0;
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t tmp_pos = 0;
|
||||
const bool need_enclose = 0 != out_info.wchar_enclose_ &&
|
||||
(!out_info.is_optional_ || obj.is_string_type());
|
||||
if (need_enclose) {
|
||||
|
||||
@ -216,6 +216,7 @@ DEFINE_DESERIALIZE(ObDesExecContext)
|
||||
LOG_WARN("init exec context expr op failed", K(ret));
|
||||
}
|
||||
}
|
||||
use_temp_expr_ctx_cache_ = true;
|
||||
return ret;
|
||||
}
|
||||
}/* ns sql*/
|
||||
|
||||
@ -112,6 +112,7 @@ ObExecContext::ObExecContext(ObIAllocator &allocator)
|
||||
px_batch_id_(0),
|
||||
admission_version_(UINT64_MAX),
|
||||
admission_addr_map_(),
|
||||
use_temp_expr_ctx_cache_(false),
|
||||
temp_expr_ctx_map_(),
|
||||
dml_event_(ObDmlEventType::DE_INVALID),
|
||||
update_columns_(nullptr),
|
||||
@ -301,25 +302,29 @@ int ObExecContext::get_temp_expr_eval_ctx(const ObTempExpr &temp_expr,
|
||||
ObTempExprCtx *&temp_expr_ctx)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (!temp_expr_ctx_map_.created()) {
|
||||
OZ(temp_expr_ctx_map_.create(8, ObLabel("TempExprCtx")));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
int64_t ctx_ptr = 0;
|
||||
if (OB_FAIL(temp_expr_ctx_map_.get_refactored(reinterpret_cast<int64_t>(&temp_expr),
|
||||
ctx_ptr))) {
|
||||
if (OB_HASH_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
OZ(build_temp_expr_ctx(temp_expr, temp_expr_ctx));
|
||||
CK(OB_NOT_NULL(temp_expr_ctx));
|
||||
OZ(temp_expr_ctx_map_.set_refactored(reinterpret_cast<int64_t>(&temp_expr),
|
||||
reinterpret_cast<int64_t>(temp_expr_ctx)));
|
||||
} else {
|
||||
LOG_WARN("fail to get temp expr ctx", K(temp_expr), K(ret));
|
||||
}
|
||||
} else {
|
||||
temp_expr_ctx = reinterpret_cast<ObTempExprCtx *>(ctx_ptr);
|
||||
if (use_temp_expr_ctx_cache_) {
|
||||
if (!temp_expr_ctx_map_.created()) {
|
||||
OZ(temp_expr_ctx_map_.create(8, ObLabel("TempExprCtx")));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
int64_t ctx_ptr = 0;
|
||||
if (OB_FAIL(temp_expr_ctx_map_.get_refactored(reinterpret_cast<int64_t>(&temp_expr),
|
||||
ctx_ptr))) {
|
||||
if (OB_HASH_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
OZ(build_temp_expr_ctx(temp_expr, temp_expr_ctx));
|
||||
CK(OB_NOT_NULL(temp_expr_ctx));
|
||||
OZ(temp_expr_ctx_map_.set_refactored(reinterpret_cast<int64_t>(&temp_expr),
|
||||
reinterpret_cast<int64_t>(temp_expr_ctx)));
|
||||
} else {
|
||||
LOG_WARN("fail to get temp expr ctx", K(temp_expr), K(ret));
|
||||
}
|
||||
} else {
|
||||
temp_expr_ctx = reinterpret_cast<ObTempExprCtx *>(ctx_ptr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
OZ(build_temp_expr_ctx(temp_expr, temp_expr_ctx));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@ -369,6 +369,8 @@ public:
|
||||
// for granule iterator
|
||||
int get_gi_task_map(GIPrepareTaskMap *&gi_prepare_task_map);
|
||||
|
||||
void set_use_temp_expr_ctx_cache(bool v) { use_temp_expr_ctx_cache_ = v; }
|
||||
|
||||
// for udf
|
||||
int get_udf_ctx_mgr(ObUdfCtxMgr *&udf_ctx_mgr);
|
||||
|
||||
@ -599,6 +601,7 @@ protected:
|
||||
uint64_t admission_version_;
|
||||
hash::ObHashMap<ObAddr, int64_t> admission_addr_map_;
|
||||
// used for temp expr ctx manager
|
||||
bool use_temp_expr_ctx_cache_;
|
||||
hash::ObHashMap<int64_t, int64_t> temp_expr_ctx_map_;
|
||||
// for pl/trigger
|
||||
ObDmlEventType dml_event_;
|
||||
|
||||
Reference in New Issue
Block a user