[FEAT MERGE] DAS iterator refactor and keep order optimization

Co-authored-by: saltonz <saltonzh@gmail.com>
Co-authored-by: zhenhan.gong@gmail.com <zhenhan.gong@gmail.com>
Co-authored-by: Tyshawn <tuyunshan@gmail.com>
This commit is contained in:
pe-99y
2024-06-24 13:57:14 +00:00
committed by ob-robot
parent 7f3ce430fb
commit 5c5e6da6ce
88 changed files with 7062 additions and 2432 deletions

View File

@ -7455,7 +7455,18 @@ int ObLogPlan::try_push_limit_into_table_scan(ObLogicalOperator *top,
(NULL == table_scan->get_limit_expr() ||
ObOptimizerUtil::is_point_based_sub_expr(limit_expr, table_scan->get_limit_expr())) &&
table_scan->get_text_retrieval_info().topk_limit_expr_ == NULL) {
if (!top->is_distributed()) {
bool das_multi_partition = false;
if (table_scan->use_das() && NULL != table_scan->get_table_partition_info()) {
int64_t partition_count = table_scan->get_table_partition_info()->
get_phy_tbl_location_info().get_phy_part_loc_info_list().count();
if (1 != partition_count) {
das_multi_partition = true;
}
}
if (das_multi_partition) {
new_limit_expr = pushed_expr;
} else if (!top->is_distributed()) {
new_limit_expr = limit_expr;
new_offset_expr = offset_expr;
} else {
@ -7469,6 +7480,9 @@ int ObLogPlan::try_push_limit_into_table_scan(ObLogicalOperator *top,
} else {
is_pushed = true;
}
if (das_multi_partition) {
is_pushed = false;
}
} else if (OB_NOT_NULL(table_scan->get_text_retrieval_info().topk_limit_expr_)) {
is_pushed = true;
}
@ -10664,6 +10678,8 @@ int ObLogPlan::do_post_plan_processing()
LOG_WARN("failed to collect table location", K(ret));
} else if (OB_FAIL(build_location_related_tablet_ids())) {
LOG_WARN("build location related tablet ids failed", K(ret));
} else if (OB_FAIL(check_das_need_keep_ordering(root))) {
LOG_WARN("failed to check das need keep ordering", K(ret));
} else { /*do nothing*/ }
return ret;
}
@ -11355,6 +11371,26 @@ int ObLogPlan::build_location_related_tablet_ids()
return ret;
}
int ObLogPlan::check_das_need_keep_ordering(ObLogicalOperator *op)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(op)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null param", K(ret));
} else if (log_op_def::LOG_TABLE_SCAN == op->get_type()) {
ObLogTableScan *scan = static_cast<ObLogTableScan*>(op);
if (OB_FAIL(scan->check_das_need_keep_ordering())) {
LOG_WARN("failed to check das need keep ordering", K(ret));
}
}
for (int i = 0; OB_SUCC(ret) && i < op->get_num_of_child(); ++i) {
if (OB_FAIL(SMART_CALL(check_das_need_keep_ordering(op->get_child(i))))) {
LOG_WARN("failed to check das need keep ordering", K(ret));
}
}
return ret;
}
int ObLogPlan::calc_plan_resource()
{
int ret = OB_SUCCESS;