提交 865c7006 编写于 作者: L ls0 提交者: LINGuanRen

adjust set op to reentrant

上级 47044f34
......@@ -97,7 +97,9 @@ int ObHashExceptOp::inner_get_next_row()
const ObChunkDatumStore::StoredRow* store_row = nullptr;
const common::ObIArray<ObExpr*>* cur_exprs = nullptr;
clear_evaluated_flag();
if (first_get_left_) {
if (iter_end_) {
ret = OB_ITER_END;
} else if (first_get_left_) {
if (OB_FAIL(is_left_has_row(left_has_row))) {
LOG_WARN("failed to judge left has row", K(ret));
} else if (!left_has_row) {
......@@ -178,6 +180,9 @@ int ObHashExceptOp::inner_get_next_row()
LOG_WARN("copy current row failed", K(ret));
}
}
if (OB_ITER_END == ret) {
iter_end_ = true;
}
return ret;
}
......
......@@ -84,7 +84,9 @@ int ObHashIntersectOp::inner_get_next_row()
const ObHashPartCols* part_cols = nullptr;
const common::ObIArray<ObExpr*>* cur_exprs = nullptr;
clear_evaluated_flag();
if (first_get_left_) {
if (iter_end_) {
ret = OB_ITER_END;
} else if (first_get_left_) {
if (OB_FAIL(is_left_has_row(left_has_row))) {
LOG_WARN("failed to judge left has row", K(ret));
} else if (!left_has_row) {
......@@ -164,6 +166,9 @@ int ObHashIntersectOp::inner_get_next_row()
LOG_WARN("copy current row failed", K(ret));
}
}
if (OB_ITER_END == ret) {
iter_end_ = true;
}
return ret;
}
......
......@@ -32,7 +32,8 @@ ObHashSetOp::ObHashSetOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInpu
has_got_part_(false),
profile_(ObSqlWorkAreaType::HASH_WORK_AREA),
sql_mem_processor_(profile_),
hp_infras_()
hp_infras_(),
iter_end_(false)
{}
int ObHashSetOp::inner_open()
......@@ -52,6 +53,7 @@ void ObHashSetOp::reset()
first_get_left_ = true;
has_got_part_ = false;
hp_infras_.reset();
iter_end_ = false;
}
int ObHashSetOp::inner_close()
......
......@@ -58,6 +58,7 @@ protected:
ObSqlWorkAreaProfile profile_;
ObSqlMemMgrProcessor sql_mem_processor_;
ObHashPartInfrastructure<ObHashPartCols, ObHashPartStoredRow> hp_infras_;
bool iter_end_;
};
} // end namespace sql
......
......@@ -91,6 +91,8 @@ int ObHashUnionOp::inner_get_next_row()
LOG_WARN("failed to get next row", K(ret));
}
first_get_left_ = false;
} else if (iter_end_) {
ret = OB_ITER_END;
}
bool got_row = false;
bool has_exists = false;
......@@ -145,6 +147,9 @@ int ObHashUnionOp::inner_get_next_row()
LOG_WARN("copy current row failed", K(ret));
}
}
if (OB_ITER_END == ret) {
iter_end_ = true;
}
return ret;
}
......
......@@ -72,6 +72,9 @@ int ObMergeExceptOp::inner_get_next_row()
bool break_outer_loop = false;
const ObIArray<ObExpr*>* left_row = NULL;
clear_evaluated_flag();
if (iter_end_) {
ret = OB_ITER_END;
}
while (OB_SUCC(ret) && OB_SUCC(do_strict_distinct(*left_, last_row_.store_row_, left_row))) {
break_outer_loop = right_iter_end_;
while (OB_SUCC(ret) && !right_iter_end_) {
......@@ -120,6 +123,8 @@ int ObMergeExceptOp::inner_get_next_row()
} else if (OB_FAIL(last_row_.save_store_row(*left_row, eval_ctx_, 0))) {
LOG_WARN("failed to save right row", K(ret));
}
} else if (OB_ITER_END == ret) {
iter_end_ = true;
}
return ret;
}
......
......@@ -71,6 +71,9 @@ int ObMergeIntersectOp::inner_get_next_row()
int cmp = 0;
bool break_outer_loop = false;
const ObIArray<ObExpr*>* left_row = NULL;
if (iter_end_) {
ret = OB_ITER_END;
}
clear_evaluated_flag();
while (OB_SUCC(ret) && OB_SUCC(do_strict_distinct(*left_, last_row_.store_row_, left_row))) {
while (OB_SUCC(ret) && !right_iter_end_) {
......@@ -111,6 +114,8 @@ int ObMergeIntersectOp::inner_get_next_row()
} else if (OB_FAIL(last_row_.save_store_row(*left_row, eval_ctx_, 0))) {
LOG_WARN("failed to save right row", K(ret));
}
} else if (OB_ITER_END == ret) {
iter_end_ = true;
}
return ret;
}
......
......@@ -28,7 +28,8 @@ ObMergeSetOp::ObMergeSetOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpIn
alloc_(ObModIds::OB_SQL_MERGE_GROUPBY, OB_MALLOC_NORMAL_BLOCK_SIZE, OB_SERVER_TENANT_ID, ObCtxIds::WORK_AREA),
last_row_(alloc_),
cmp_(),
need_skip_init_row_(false)
need_skip_init_row_(false),
iter_end_(false)
{}
int ObMergeSetOp::inner_open()
......@@ -57,6 +58,7 @@ int ObMergeSetOp::rescan()
last_row_.reset();
alloc_.reset();
need_skip_init_row_ = false;
iter_end_ = false;
if (OB_FAIL(ObOperator::rescan())) {
LOG_WARN("failed to rescan", K(ret));
}
......
......@@ -73,6 +73,7 @@ protected:
ObChunkDatumStore::LastStoredRow<> last_row_;
Compare cmp_;
bool need_skip_init_row_;
bool iter_end_;
};
template <typename T>
......
......@@ -282,9 +282,13 @@ int ObMergeUnionOp::inner_get_next_row()
if (OB_ISNULL(get_next_row_func_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("get_next_row_func is NULL", K(ret));
} else if (iter_end_) {
ret = OB_ITER_END;
} else if (OB_FAIL((this->*get_next_row_func_)())) {
if (OB_ITER_END != ret) {
LOG_WARN("get next row failed", K(ret));
} else {
iter_end_ = true;
}
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册