fix some optimizer bugs

This commit is contained in:
chimyue
2023-05-10 05:19:22 +00:00
committed by ob-robot
parent a4d3658f03
commit 5eef4de86d
10 changed files with 43 additions and 26 deletions

View File

@ -657,7 +657,7 @@ int ObQueryHint::print_qb_name_hints(PlanText &plan_text) const
// If outline_stmt_id_ is invalid stmt id and has_outline_data(), do not print hint.
// This may happened for outline data from SPM.
int ObQueryHint::print_stmt_hint(PlanText &plan_text, const ObDMLStmt &stmt,
const bool is_root_stmt, const bool ignore_parallel) const
const bool is_root_stmt) const
{
int ret = OB_SUCCESS;
const int64_t stmt_id = stmt.get_stmt_id();
@ -673,9 +673,9 @@ int ObQueryHint::print_stmt_hint(PlanText &plan_text, const ObDMLStmt &stmt,
// If stmt is the first stmt can add hint, print global hint and hint with qb name.
const bool is_first_stmt = is_root_stmt;
if ((is_first_stmt || OB_INVALID_ID != stmt.get_dblink_id()) &&
OB_FAIL(get_global_hint().print_global_hint(plan_text, ignore_parallel))) {
OB_FAIL(get_global_hint().print_global_hint(plan_text))) {
LOG_WARN("failed to print global hint", K(ret));
} else if (OB_FAIL(stmt.get_stmt_hint().print_stmt_hint(plan_text, ignore_parallel))) {
} else if (OB_FAIL(stmt.get_stmt_hint().print_stmt_hint(plan_text))) {
LOG_WARN("failed to print stmt hint", K(ret));
} else if (is_first_stmt) {
int tmp = OB_SUCCESS;
@ -725,7 +725,7 @@ int ObQueryHint::print_outline_data(PlanText &plan_text) const
}
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(get_global_hint().print_global_hint(plan_text, /*ignore_parallel*/false))) {
} else if (OB_FAIL(get_global_hint().print_global_hint(plan_text))) {
LOG_WARN("failed to print global hint", K(ret));
} else if (OB_FAIL(BUF_PRINTF("%sEND_OUTLINE_DATA", ObQueryHint::get_outline_indent(is_oneline)))) {
LOG_WARN("fail to print buf", K(ret));
@ -1064,11 +1064,12 @@ DEF_TO_STRING(ObStmtHint)
return pos;
}
int ObStmtHint::print_stmt_hint(PlanText &plan_text, const bool ignore_parallel) const
int ObStmtHint::print_stmt_hint(PlanText &plan_text) const
{
int ret = OB_SUCCESS;
const ObHint *hint = NULL;
const int64_t N = get_hint_count();
const bool ignore_parallel = EXPLAIN_DBLINK_STMT == plan_text.type_;
for (int64_t i = 0; OB_SUCC(ret) && i < N; ++i) {
if (OB_ISNULL(hint = get_hint_by_idx(i))) {
ret = OB_ERR_UNEXPECTED;