From e50f1cde1f60be987f73f4873e2ca08ac24f9594 Mon Sep 17 00:00:00 2001 From: xianyu-w <707512433@qq.com> Date: Mon, 6 Feb 2023 17:04:45 +0800 Subject: [PATCH] Fix failed cases introduced by dblink-write --- src/sql/ob_select_stmt_printer.cpp | 49 --------------------------- src/sql/ob_select_stmt_printer.h | 2 -- src/sql/optimizer/ob_log_link_dml.cpp | 2 +- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/src/sql/ob_select_stmt_printer.cpp b/src/sql/ob_select_stmt_printer.cpp index d5d500bfc2..824a31b552 100644 --- a/src/sql/ob_select_stmt_printer.cpp +++ b/src/sql/ob_select_stmt_printer.cpp @@ -118,9 +118,6 @@ int ObSelectStmtPrinter::print_unpivot() K(stmt_->get_table_items().count()), K(ret)); } else { const ObSelectStmt *select_stmt = static_cast(stmt_); - if (!is_root_stmt()) { - DATA_PRINTF("("); - } if (print_params_.print_with_cte_ && OB_FAIL(print_cte_define())) { LOG_WARN("failed to print cte", K(ret)); @@ -882,52 +879,6 @@ int ObSelectStmtPrinter::print_for_update() return ret; } -//把cte的定义完整的恢复出来 -int ObSelectStmtPrinter::print_with() -{ - int ret = OB_SUCCESS; - const ObSelectStmt *select_stmt = static_cast(stmt_); - if (OB_ISNULL(stmt_)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpect null stmt", K(ret)); - } else if (select_stmt->get_cte_definition_size() == 0) { - // don't print - } else { - const ObIArray &cte_tables = select_stmt->get_cte_definitions(); - DATA_PRINTF(is_oracle_mode() ? "WITH " : "WITH RECURSIVE "); - //恢复定义,cte先放本stmt中T_WITH_CLAUSE产生的的cte,再放parent放过来的 - for (int64_t i = 0; OB_SUCC(ret) && i < cte_tables.count() && OB_SUCC(ret); i++) { - TableItem* cte_table = cte_tables.at(i); - //打印定义 - if (OB_ISNULL(cte_table)) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("the cte tableitem can not be null", K(ret)); - } else if (TableItem::NORMAL_CTE == cte_table->cte_type_ - || TableItem::RECURSIVE_CTE == cte_table->cte_type_) { - if (OB_FAIL(print_cte_define_title(cte_table))) { - LOG_WARN("print column name failed", K(ret)); - } else if (OB_FAIL(print_subquery(cte_table->ref_query_, PRINT_BRACKET))) { - LOG_WARN("print table failed", K(ret)); - } else if (OB_FAIL(print_search_and_cycle(cte_table->ref_query_))) { - LOG_WARN("print search and cycle failed", K(ret)); - } - } else { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpected cte type", K(ret), K(cte_table->cte_type_)); - } - //打印尾巴 - if (OB_FAIL(ret)) { - //do nothing - } else if (i == cte_tables.count() - 1) { - DATA_PRINTF(" "); - } else { - DATA_PRINTF(", "); - } - } - } - return ret; -} - int ObSelectStmtPrinter::print_with_check_option() { int ret = OB_SUCCESS; diff --git a/src/sql/ob_select_stmt_printer.h b/src/sql/ob_select_stmt_printer.h index 5334591f61..19edf8aa70 100644 --- a/src/sql/ob_select_stmt_printer.h +++ b/src/sql/ob_select_stmt_printer.h @@ -77,8 +77,6 @@ private: int print_order_by(); int print_for_update(); - ///////cte related functions - int print_with(); int print_multi_rollup_items(const common::ObIArray &rollup_items); int print_with_check_option(); diff --git a/src/sql/optimizer/ob_log_link_dml.cpp b/src/sql/optimizer/ob_log_link_dml.cpp index 63a4486d9b..190fe38b8e 100644 --- a/src/sql/optimizer/ob_log_link_dml.cpp +++ b/src/sql/optimizer/ob_log_link_dml.cpp @@ -49,7 +49,7 @@ int ObLogLinkDml::get_plan_item_info(PlanText &plan_text, ObSqlPlanItem &plan_item) { int ret = OB_SUCCESS; - if (OB_FAIL(ObLogicalOperator::get_plan_item_info(plan_text, plan_item))) { + if (OB_FAIL(ObLogLink::get_plan_item_info(plan_text, plan_item))) { LOG_WARN("failed to get plan item info", K(ret)); } else { BEGIN_BUF_PRINT;