fix late materialization and topk hint bug

This commit is contained in:
wangt1xiuyi
2021-08-26 12:37:17 +08:00
committed by wangzelin.wzl
parent 5462fd51be
commit d1cd5d4780
2 changed files with 5 additions and 3 deletions

View File

@ -2261,11 +2261,12 @@ int ObSelectLogPlan::candi_allocate_late_materialization()
} else { } else {
bool use_late_mat = false; bool use_late_mat = false;
ObLogicalOperator* best_plan = NULL; ObLogicalOperator* best_plan = NULL;
ObLogTableScan* index_scan = NULL; ObLogTableScan* best_index_scan = NULL;
TableItem* nl_table_item = NULL; TableItem* nl_table_item = NULL;
ObLogTableScan* nl_table_get = NULL; ObLogTableScan* nl_table_get = NULL;
for (int64_t i = 0; OB_SUCC(ret) && i < candidates_.candidate_plans_.count(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < candidates_.candidate_plans_.count(); ++i) {
bool need = false; bool need = false;
ObLogTableScan* index_scan = NULL;
CandidatePlan& plain_plan = candidates_.candidate_plans_.at(i); CandidatePlan& plain_plan = candidates_.candidate_plans_.at(i);
if (OB_FAIL(if_plan_need_late_materialization(plain_plan.plan_tree_, index_scan, need))) { if (OB_FAIL(if_plan_need_late_materialization(plain_plan.plan_tree_, index_scan, need))) {
LOG_WARN("failed to check if need late materialization", K(ret)); LOG_WARN("failed to check if need late materialization", K(ret));
@ -2288,6 +2289,7 @@ int ObSelectLogPlan::candi_allocate_late_materialization()
} else if (NULL == best_plan || plain_plan.plan_tree_->get_cost() < best_plan->get_cost()) { } else if (NULL == best_plan || plain_plan.plan_tree_->get_cost() < best_plan->get_cost()) {
best_plan = plain_plan.plan_tree_; best_plan = plain_plan.plan_tree_;
use_late_mat = need; use_late_mat = need;
best_index_scan = index_scan;
} else { /*do nothing*/ } else { /*do nothing*/
} }
} }
@ -2300,7 +2302,8 @@ int ObSelectLogPlan::candi_allocate_late_materialization()
if (OB_FAIL(candidates_.candidate_plans_.push_back(CandidatePlan(best_plan)))) { if (OB_FAIL(candidates_.candidate_plans_.push_back(CandidatePlan(best_plan)))) {
LOG_WARN("failed to push back candidate plan", K(ret)); LOG_WARN("failed to push back candidate plan", K(ret));
} else if (use_late_mat && !get_optimizer_context().is_cost_evaluation() && } else if (use_late_mat && !get_optimizer_context().is_cost_evaluation() &&
OB_FAIL(adjust_late_materialization_structure(best_plan, index_scan, nl_table_get, nl_table_item))) { OB_FAIL(adjust_late_materialization_structure(
best_plan, best_index_scan, nl_table_get, nl_table_item))) {
LOG_WARN("failed to adjust late materialization stmt", K(ret)); LOG_WARN("failed to adjust late materialization stmt", K(ret));
} else { } else {
candidates_.plain_plan_.first = best_plan->get_cost(); candidates_.plain_plan_.first = best_plan->get_cost();

View File

@ -3702,7 +3702,6 @@ int ObDMLStmt::copy_query_hint(ObDMLStmt* from, ObDMLStmt* to)
LOG_WARN("get null stmt", K(ret), K(from), K(to)); LOG_WARN("get null stmt", K(ret), K(from), K(to));
} else { } else {
to->get_stmt_hint().frozen_version_ = from->get_stmt_hint().frozen_version_; to->get_stmt_hint().frozen_version_ = from->get_stmt_hint().frozen_version_;
to->get_stmt_hint().topk_precision_ = from->get_stmt_hint().topk_precision_;
to->get_stmt_hint().use_jit_policy_ = from->get_stmt_hint().use_jit_policy_; to->get_stmt_hint().use_jit_policy_ = from->get_stmt_hint().use_jit_policy_;
to->get_stmt_hint().force_trace_log_ = from->get_stmt_hint().force_trace_log_; to->get_stmt_hint().force_trace_log_ = from->get_stmt_hint().force_trace_log_;
to->get_stmt_hint().read_consistency_ = from->get_stmt_hint().read_consistency_; to->get_stmt_hint().read_consistency_ = from->get_stmt_hint().read_consistency_;