diff --git a/src/sql/executor/ob_slice_calc.cpp b/src/sql/executor/ob_slice_calc.cpp index 6e40f5454..059fe8468 100644 --- a/src/sql/executor/ob_slice_calc.cpp +++ b/src/sql/executor/ob_slice_calc.cpp @@ -178,6 +178,7 @@ int ObRepartSliceIdxCalc::get_partition_id(ObEvalCtx& eval_ctx, int64_t& partiti { int ret = OB_SUCCESS; ObDatum* partition_id_datum = NULL; + CalcTypeGuard calc_type_guard(eval_ctx.exec_ctx_); if (OB_REPARTITION_ONE_SIDE_ONE_LEVEL_FIRST == repart_type_) { eval_ctx.exec_ctx_.set_partition_id_calc_type(CALC_IGNORE_SUB_PART); } else if (OB_REPARTITION_ONE_SIDE_ONE_LEVEL_SUB == repart_type_) { diff --git a/src/sql/executor/ob_slice_calc.h b/src/sql/executor/ob_slice_calc.h index 70cd56eff..4f36d6188 100644 --- a/src/sql/executor/ob_slice_calc.h +++ b/src/sql/executor/ob_slice_calc.h @@ -135,6 +135,19 @@ public: typedef common::hash::ObHashMap PartId2ArrayIdxMap; typedef common::hash::ObHashMap SubPartId2ArrayIdxMap; + class CalcTypeGuard { + public: + CalcTypeGuard(ObExecContext &exec_ctx) : exec_ctx_(exec_ctx) + {} + ~CalcTypeGuard() + { + exec_ctx_.set_partition_id_calc_type(CALC_NORMAL); + } + + private: + ObExecContext &exec_ctx_; + }; + virtual ~ObRepartSliceIdxCalc() {} virtual int get_slice_idx(const common::ObNewRow& row, int64_t& slice_idx) override;