diff --git a/src/sql/engine/expr/ob_expr.cpp b/src/sql/engine/expr/ob_expr.cpp index 2cc00675a963bfd22e736ba5b5f6d9f7350e9f38..46f2bf8e6bc2de91a0130b013d18a7d8c0ef1fc2 100644 --- a/src/sql/engine/expr/ob_expr.cpp +++ b/src/sql/engine/expr/ob_expr.cpp @@ -40,7 +40,7 @@ ObEvalCtx::ObEvalCtx(ObExecContext &exec_ctx) exec_ctx_(exec_ctx), tmp_alloc_(exec_ctx.get_eval_tmp_allocator()), datum_caster_(NULL), - tmp_alloc_used_(false), + tmp_alloc_used_(exec_ctx.get_tmp_alloc_used()), batch_idx_(0), batch_size_(0), expr_res_alloc_(exec_ctx.get_eval_res_allocator()) diff --git a/src/sql/engine/expr/ob_expr.h b/src/sql/engine/expr/ob_expr.h index fea3a77c73df5e5be932aed11b68cda87cb00526..b51ff2b05baaac860cac121221970880b01f425d 100644 --- a/src/sql/engine/expr/ob_expr.h +++ b/src/sql/engine/expr/ob_expr.h @@ -255,7 +255,7 @@ public: // Can not use allocator for expression result. (ObExpr::get_str_res_mem() is used for result). common::ObArenaAllocator &tmp_alloc_; ObDatumCaster *datum_caster_; - bool tmp_alloc_used_; + bool &tmp_alloc_used_; private: int64_t batch_idx_; int64_t batch_size_; diff --git a/src/sql/engine/ob_exec_context.cpp b/src/sql/engine/ob_exec_context.cpp index beeaf4be7470dc3f48d9911549221b1125766a1b..19cf0059ba45ef95ae5029623ef6b8d6e722dba6 100644 --- a/src/sql/engine/ob_exec_context.cpp +++ b/src/sql/engine/ob_exec_context.cpp @@ -121,7 +121,8 @@ ObExecContext::ObExecContext(ObIAllocator &allocator) parent_ctx_(nullptr), nested_level_(0), is_ps_prepare_stage_(false), - register_op_id_(OB_INVALID_ID) + register_op_id_(OB_INVALID_ID), + tmp_alloc_used_(false) { } @@ -294,6 +295,7 @@ void ObExecContext::destroy_eval_allocator() { eval_res_allocator_.reset(); eval_tmp_allocator_.reset(); + tmp_alloc_used_ = false; } int ObExecContext::get_temp_expr_eval_ctx(const ObTempExpr &temp_expr, diff --git a/src/sql/engine/ob_exec_context.h b/src/sql/engine/ob_exec_context.h index 4509b9179bdd45218a15eeade0654675eb5443f3..aa5155a3248ceca00419895891d65df6f05a1689 100644 --- a/src/sql/engine/ob_exec_context.h +++ b/src/sql/engine/ob_exec_context.h @@ -286,6 +286,7 @@ public: bool has_non_trivial_expr_op_ctx() const { return has_non_trivial_expr_op_ctx_; } void set_non_trivial_expr_op_ctx(bool v) { has_non_trivial_expr_op_ctx_ = v; } + inline bool &get_tmp_alloc_used() { return tmp_alloc_used_; } VIRTUAL_NEED_SERIALIZE_AND_DESERIALIZE; protected: @@ -613,6 +614,8 @@ protected: bool is_ps_prepare_stage_; // for sql plan monitor int64_t register_op_id_; + // indicate if eval_tmp_allocator_ is used + bool tmp_alloc_used_; // ------------------- private: DISALLOW_COPY_AND_ASSIGN(ObExecContext);