fix merge set do not deduplicate

This commit is contained in:
18523270951@163.com 2023-05-17 12:46:36 +00:00 committed by ob-robot
parent fd4ddaac3d
commit bf79809622
4 changed files with 13 additions and 5 deletions

View File

@ -160,6 +160,7 @@ int ObMergeExceptOp::inner_get_next_batch(const int64_t max_row_cnt)
first_got_left_row_))) {
//when we succ locate a row in left batch, store row is out of date,
//we will compare inside a batch
use_last_row_ = false;
brs_.skip_->unset(curr_left_idx);
last_left_idx = curr_left_idx;
if (right_iter_end_) {
@ -234,6 +235,8 @@ int ObMergeExceptOp::inner_get_next_batch(const int64_t max_row_cnt)
batch_info_guard.set_batch_idx(last_left_idx);
if (OB_FAIL(last_row_.save_store_row(left_->get_spec().output_, eval_ctx_, 0))) {
LOG_WARN("failed to save last row", K(ret));
} else {
use_last_row_ = true;
}
}
}

View File

@ -158,6 +158,7 @@ int ObMergeIntersectOp::inner_get_next_batch(const int64_t max_row_cnt)
first_got_left_row_))) {
//when we succ locate a row in left batch, store row is out of date,
//we will compare inside a batch
use_last_row_ = false;
while (OB_SUCC(ret) && !right_iter_end_) {
if (!first_got_right_row_) {
if (OB_FAIL(cmp_(right_->get_spec().output_, left_->get_spec().output_,
@ -224,6 +225,8 @@ int ObMergeIntersectOp::inner_get_next_batch(const int64_t max_row_cnt)
batch_info_guard.set_batch_idx(last_left_idx);
if (OB_FAIL(last_row_.save_store_row(left_->get_spec().output_, eval_ctx_, 0))) {
LOG_WARN("failed to save last row", K(ret));
} else {
use_last_row_ = true;
}
}
} else {

View File

@ -365,14 +365,15 @@ int ObMergeSetOp::locate_next_left_inside(ObOperator &child_op,
}
if (curr_idx == row_brs.size_) {
ret = OB_ITER_END;
} else if (OB_NOT_NULL(last_row_.store_row_)
} else if (OB_UNLIKELY(use_last_row_ && nullptr == last_row_.store_row_)
|| OB_LIKELY(!use_last_row_ && last_idx < 0)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get wrong last idx", K(ret), K(use_last_row_), KP(last_row_.store_row_), K(last_idx));
} else if (use_last_row_
&& OB_FAIL(cmp_(*last_row_.store_row_, child_op.get_spec().output_,
curr_idx, eval_ctx_, cmp))) {
LOG_WARN("failed to compare row", K(ret));
} else if (nullptr == last_row_.store_row_ && last_idx < 0) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get wrong last idx", K(ret));
} else if (nullptr == last_row_.store_row_
} else if (!use_last_row_
&& OB_FAIL(cmp_(child_op.get_spec().output_, child_op.get_spec().output_,
last_idx, curr_idx, eval_ctx_, cmp))) {
LOG_WARN("failed to compare row", K(ret));

View File

@ -109,6 +109,7 @@ protected:
//目前仅针对 merge except 和 merge intersect 置为TRUE, 因为无法区分 last_output_row_
//是来自初始化时的全NULL or 左侧child的全NULL, see bug
int64_t last_row_idx_;
bool use_last_row_;
};