[CP] fix T_OP_STACK_OVERFLOW_CHECK reset child ptr leads core
This commit is contained in:
@ -609,16 +609,20 @@ int ObExpr::eval_one_datum_of_batch(ObEvalCtx &ctx, common::ObDatum *&datum) con
|
||||
}
|
||||
datum = reinterpret_cast<ObDatum *>(frame + datum_off_) + ctx.get_batch_idx();
|
||||
if (need_evaluate) {
|
||||
reset_datum_ptr(frame, ctx.get_batch_size(), ctx.get_batch_idx());
|
||||
ret = eval_func_(*this, ctx, *datum);
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBitVector *evaluated_flags = to_bit_vector(frame + eval_flags_off_);
|
||||
evaluated_flags->set(ctx.get_batch_idx());
|
||||
if (OB_UNLIKELY(need_stack_check_) && OB_FAIL(check_stack_overflow())) {
|
||||
SQL_LOG(WARN, "failed to check stack overflow", K(ret));
|
||||
} else {
|
||||
datum->set_null();
|
||||
}
|
||||
if (datum->is_null()) {
|
||||
info->notnull_ = false;
|
||||
reset_datum_ptr(frame, ctx.get_batch_size(), ctx.get_batch_idx());
|
||||
ret = eval_func_(*this, ctx, *datum);
|
||||
if (OB_SUCC(ret)) {
|
||||
ObBitVector *evaluated_flags = to_bit_vector(frame + eval_flags_off_);
|
||||
evaluated_flags->set(ctx.get_batch_idx());
|
||||
} else {
|
||||
datum->set_null();
|
||||
}
|
||||
if (datum->is_null()) {
|
||||
info->notnull_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,17 +659,21 @@ int ObExpr::do_eval_batch(ObEvalCtx &ctx,
|
||||
info->notnull_ = false;
|
||||
info->point_to_frame_ = true;
|
||||
}
|
||||
ret = (*eval_batch_func_)(*this, ctx, skip, size);
|
||||
if (OB_SUCC(ret)) {
|
||||
if (!info->evaluated_) {
|
||||
info->cnt_ = size;
|
||||
info->evaluated_ = true;
|
||||
}
|
||||
if (OB_UNLIKELY(need_stack_check_) && OB_FAIL(check_stack_overflow())) {
|
||||
SQL_LOG(WARN, "failed to check stack overflow", K(ret));
|
||||
} else {
|
||||
ObDatum *datum = reinterpret_cast<ObDatum *>(frame + datum_off_);
|
||||
ObDatum *datum_end = datum + size;
|
||||
for (; datum < datum_end; datum += 1) {
|
||||
datum->set_null();
|
||||
ret = (*eval_batch_func_)(*this, ctx, skip, size);
|
||||
if (OB_SUCC(ret)) {
|
||||
if (!info->evaluated_) {
|
||||
info->cnt_ = size;
|
||||
info->evaluated_ = true;
|
||||
}
|
||||
} else {
|
||||
ObDatum *datum = reinterpret_cast<ObDatum *>(frame + datum_off_);
|
||||
ObDatum *datum_end = datum + size;
|
||||
for (; datum < datum_end; datum += 1) {
|
||||
datum->set_null();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "sql/engine/ob_serializable_function.h"
|
||||
#include "objit/common/ob_item_type.h"
|
||||
#include "sql/engine/ob_bit_vector.h"
|
||||
#include "common/ob_common_utility.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -610,6 +611,7 @@ public:
|
||||
uint64_t is_static_const_:1; // is const during the whole execution
|
||||
uint64_t is_boolean_:1; // to distinguish result of this expr between and int tc
|
||||
uint64_t is_dynamic_const_:1; // is const during the subplan execution, including exec param
|
||||
uint64_t need_stack_check_:1; // the expression tree depth needs to check whether the stack overflows
|
||||
};
|
||||
uint64_t flag_;
|
||||
};
|
||||
@ -976,7 +978,6 @@ OB_INLINE int ObExpr::eval(ObEvalCtx &ctx, common::ObDatum *&datum) const
|
||||
OB_ASSERT(NULL != frame);
|
||||
datum = (ObDatum *)(frame + datum_off_);
|
||||
ObEvalInfo *eval_info = (ObEvalInfo *)(frame + eval_info_off_);
|
||||
|
||||
if (is_batch_result()) {
|
||||
if (NULL == eval_func_ || eval_info->projected_) {
|
||||
datum = datum + ctx.get_batch_idx();
|
||||
@ -985,14 +986,18 @@ OB_INLINE int ObExpr::eval(ObEvalCtx &ctx, common::ObDatum *&datum) const
|
||||
}
|
||||
} else if (NULL != eval_func_ && !eval_info->evaluated_) {
|
||||
// do nothing for const/column reference expr or already evaluated expr
|
||||
if (datum->ptr_ != frame + res_buf_off_) {
|
||||
datum->ptr_ = frame + res_buf_off_;
|
||||
}
|
||||
ret = eval_func_(*this, ctx, *datum);
|
||||
if (OB_LIKELY(common::OB_SUCCESS == ret)) {
|
||||
eval_info->evaluated_ = true;
|
||||
if (OB_UNLIKELY(need_stack_check_) && OB_FAIL(check_stack_overflow())) {
|
||||
SQL_LOG(WARN, "failed to check stack overflow", K(ret));
|
||||
} else {
|
||||
datum->set_null();
|
||||
if (datum->ptr_ != frame + res_buf_off_) {
|
||||
datum->ptr_ = frame + res_buf_off_;
|
||||
}
|
||||
ret = eval_func_(*this, ctx, *datum);
|
||||
if (OB_LIKELY(common::OB_SUCCESS == ret)) {
|
||||
eval_info->evaluated_ = true;
|
||||
} else {
|
||||
datum->set_null();
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user