[CP] fix partition wise join and global index lookup -4016
This commit is contained in:
@ -136,9 +136,29 @@ int ObSubQueryIterator::rewind(const bool reset_onetime_plan /* = false */)
|
||||
}
|
||||
if (OB_SUCC(ret) && current_group_ < parent_spf_group) {
|
||||
if (new_group) {
|
||||
//If in lookup op, we need to call get next row to init all of iter.
|
||||
op_.get_next_row();
|
||||
/**
|
||||
* Since the initialization of the lookup Iterator is done within index_lookup.get_next_row(),
|
||||
* when SPF enters skip scan,
|
||||
* we need to mark the jump_read_group_id for each scan Iterator
|
||||
* and determine the number of rows to skip based on the current group_id.
|
||||
* The issue with the lookup process here is that when SPF performs multiple skip scans,
|
||||
* the lookup process may not be executed at all,
|
||||
* resulting in uninitialized lookup Iterators.
|
||||
* As a result, when subsequent skip reads occur,
|
||||
* the lookup Iterator will not be set with the correct jum_read_group_id.
|
||||
* Therefore, it is necessary to ensure that get_next_row() is called at least once to
|
||||
* initialize the lookup Iterator on the right branch.
|
||||
**/
|
||||
if (OB_FAIL(op_.get_next_row())) {
|
||||
if (OB_ITER_END == ret) {
|
||||
//ignore OB_ITER_END
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("get next row from child failed", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
int64_t old_jump_read_group_id;
|
||||
old_jump_read_group_id = op_.get_exec_ctx().get_das_ctx().jump_read_group_id_;
|
||||
op_.get_exec_ctx().get_das_ctx().jump_read_group_id_ = parent_spf_group;
|
||||
@ -152,6 +172,7 @@ int ObSubQueryIterator::rewind(const bool reset_onetime_plan /* = false */)
|
||||
current_group_ = parent_spf_group;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//No batch branch
|
||||
if (OB_SUCC(ret) && OB_FAIL(op_.rescan())) {
|
||||
|
||||
@ -1652,6 +1652,9 @@ bool ObTableScanOp::need_real_rescan()
|
||||
bool bret = false;
|
||||
if (!MY_SPEC.batch_scan_flag_) {
|
||||
bret = true;
|
||||
} else if (tsc_rtdef_.bnlj_params_.empty()) {
|
||||
//batch rescan not init, need to do real rescan
|
||||
bret = true;
|
||||
} else {
|
||||
ObPhysicalPlanCtx *plan_ctx = GET_PHY_PLAN_CTX(ctx_);
|
||||
int64_t param_idx = tsc_rtdef_.bnlj_params_.at(0).param_idx_;
|
||||
@ -3059,7 +3062,10 @@ int ObGlobalIndexLookupOpImpl::close()
|
||||
int ObGlobalIndexLookupOpImpl::rescan()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (get_batch_rescan() && lookup_group_cnt_ < index_group_cnt_) {
|
||||
if (OB_ISNULL(table_scan_op_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table scan op not init", K(ret));
|
||||
} else if (!table_scan_op_->need_real_rescan() && lookup_group_cnt_ < index_group_cnt_) {
|
||||
LOG_DEBUG("rescan in group lookup, only need to switch iterator",
|
||||
K(lookup_group_cnt_), K(index_group_cnt_));
|
||||
if (OB_FAIL(table_scan_op_->build_bnlj_params())) {
|
||||
|
||||
Reference in New Issue
Block a user