[CP] fix: fix the correctness problem induced by batch rescan not supported reverse order

This commit is contained in:
obdev 2023-11-29 11:46:05 +00:00 committed by ob-robot
parent 753da38fe9
commit 88451e8b98
3 changed files with 14 additions and 2 deletions

View File

@ -895,7 +895,17 @@ OB_INLINE int ObTableScanOp::init_das_scan_rtdef(const ObDASScanCtDef &das_ctdef
das_rtdef.scan_flag_.set_iter_uncommitted_row();
}
}
if (MY_SPEC.batch_scan_flag_ || is_lookup) {
if (MY_SPEC.batch_scan_flag_) {
// if tsc enable batch rescan, the output order of tsc is determined by group id
if (das_rtdef.scan_flag_.scan_order_ == ObQueryFlag::Reverse) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Scan order is not supported in batch rescan", K(ret), K(das_rtdef.scan_flag_.scan_order_));
} else {
das_rtdef.scan_flag_.scan_order_ = ObQueryFlag::KeepOrder;
}
}
if (is_lookup) {
das_rtdef.scan_flag_.scan_order_ = ObQueryFlag::KeepOrder;
}
das_rtdef.scan_flag_.is_lookup_for_4377_ = is_lookup;

View File

@ -1392,6 +1392,8 @@ int ObLogJoin::check_if_disable_batch(ObLogicalOperator* root, bool &can_use_bat
// For the global index lookup, if there is a pushdown filter when scanning the index,
// batch cannot be used.
can_use_batch_nlj = false;
} else if (ts->get_scan_direction() != default_asc_direction() && ts->get_scan_direction() != ObOrderDirection::UNORDERED) {
can_use_batch_nlj = false;
} else {
SMART_VAR(ObTablePartitionInfo, tmp_info) {
ObTablePartitionInfo *tmp_info_ptr = &tmp_info;

View File

@ -483,7 +483,7 @@ int ObLogSubPlanFilter::check_if_match_das_group_rescan(ObLogicalOperator *root,
LOG_WARN("failed to check query range contribution", K(ret));
} else if (!is_valid) {
group_rescan = false;
} else if (tsc->get_scan_direction() != default_asc_direction()) {
} else if (tsc->get_scan_direction() != default_asc_direction() && tsc->get_scan_direction() != ObOrderDirection::UNORDERED) {
group_rescan = false;
} else if (tsc->has_index_scan_filter() && tsc->get_index_back() && tsc->get_is_index_global()) {
// For the global index lookup, if there is a pushdown filter when scanning the index,