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

This commit is contained in:
obdev
2024-02-07 05:50:26 +00:00
committed by ob-robot
parent fe7ee1531c
commit fd77441e70
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(); 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_.scan_order_ = ObQueryFlag::KeepOrder;
} }
das_rtdef.scan_flag_.is_lookup_for_4377_ = is_lookup; 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, // For the global index lookup, if there is a pushdown filter when scanning the index,
// batch cannot be used. // batch cannot be used.
can_use_batch_nlj = false; 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 { } else {
SMART_VAR(ObTablePartitionInfo, tmp_info) { SMART_VAR(ObTablePartitionInfo, tmp_info) {
ObTablePartitionInfo *tmp_info_ptr = &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)); LOG_WARN("failed to check query range contribution", K(ret));
} else if (!is_valid) { } else if (!is_valid) {
group_rescan = false; 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; group_rescan = false;
} else if (tsc->has_index_scan_filter() && tsc->get_index_back() && tsc->get_is_index_global()) { } 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, // For the global index lookup, if there is a pushdown filter when scanning the index,