diff --git a/src/sql/optimizer/ob_log_temp_table_access.cpp b/src/sql/optimizer/ob_log_temp_table_access.cpp index cddf68302e..e90d545acc 100644 --- a/src/sql/optimizer/ob_log_temp_table_access.cpp +++ b/src/sql/optimizer/ob_log_temp_table_access.cpp @@ -159,3 +159,34 @@ int ObLogTempTableAccess::print_my_plan_annotation(char *buf, } return ret; } + +int ObLogTempTableAccess::get_temp_table_plan(ObLogicalOperator *& insert_op) +{ + int ret = OB_SUCCESS; + insert_op = NULL; + ObLogPlan *plan = get_plan(); + const uint64_t temp_table_id = get_temp_table_id(); + if (OB_ISNULL(plan)) { + ret = OB_ERR_UNEXPECTED; + LOG_ERROR("unexpected null", K(ret)); + } else { + ObIArray &temp_tables = plan->get_optimizer_context().get_temp_table_infos(); + bool find = false; + for (int64_t i = 0; OB_SUCC(ret) && !find && i < temp_tables.count(); ++i) { + if (OB_ISNULL(temp_tables.at(i))) { + ret = OB_ERR_UNEXPECTED; + LOG_ERROR("unexpected null", K(ret)); + } else if (temp_table_id != temp_tables.at(i)->temp_table_id_) { + /* do nothing */ + } else { + find = true; + insert_op = temp_tables.at(i)->table_plan_; + } + } + if (OB_SUCC(ret) && !find) { + ret = OB_ERR_UNEXPECTED; + LOG_ERROR("failed to find table plan", K(ret)); + } + } + return ret; +} diff --git a/src/sql/optimizer/ob_log_temp_table_access.h b/src/sql/optimizer/ob_log_temp_table_access.h index 6c5938abc5..1c6691f218 100644 --- a/src/sql/optimizer/ob_log_temp_table_access.h +++ b/src/sql/optimizer/ob_log_temp_table_access.h @@ -45,6 +45,9 @@ public: int64_t &buf_len, int64_t &pos, ExplainType type); + + int get_temp_table_plan(ObLogicalOperator *& insert_op); + private: DISALLOW_COPY_AND_ASSIGN(ObLogTempTableAccess); diff --git a/src/sql/optimizer/ob_logical_operator.cpp b/src/sql/optimizer/ob_logical_operator.cpp index ce2906bf36..1f9bf3c394 100644 --- a/src/sql/optimizer/ob_logical_operator.cpp +++ b/src/sql/optimizer/ob_logical_operator.cpp @@ -2848,6 +2848,19 @@ int ObLogicalOperator::gen_location_constraint(void *ctx) loc_cons_ctx->base_table_constraints_.count() - 1))) { LOG_WARN("failed to push back location constraint offset", K(ret)); } + } else if (log_op_def::LOG_TEMP_TABLE_ACCESS == get_type()) { + ObLogTempTableAccess *access = static_cast(this); + ObLogicalOperator *insert_op = NULL; + if (OB_FAIL(access->get_temp_table_plan(insert_op))) { + LOG_WARN("failed to get temp table plan", K(ret)); + } else if (OB_ISNULL(insert_op)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpect null operator", K(ret)); + } else if (OB_FAIL(append(strict_pwj_constraint_, insert_op->strict_pwj_constraint_))) { + LOG_WARN("failed to append child pwj constraint", K(ret)); + } else if (OB_FAIL(append(non_strict_pwj_constraint_, insert_op->non_strict_pwj_constraint_))) { + LOG_WARN("failed to append child pwj constraint", K(ret)); + } } } else if (get_num_of_child() > 0) { /** diff --git a/src/sql/resolver/dml/ob_dml_stmt.cpp b/src/sql/resolver/dml/ob_dml_stmt.cpp index 59ffa25561..c35a62a60b 100644 --- a/src/sql/resolver/dml/ob_dml_stmt.cpp +++ b/src/sql/resolver/dml/ob_dml_stmt.cpp @@ -2119,7 +2119,7 @@ int ObDMLStmt::remove_useless_sharable_expr() } else if (OB_FAIL(column_items_.remove(i))) { LOG_WARN("failed to remove column item", K(ret)); } else { - LOG_TRACE("succeed to remove column items", K(*expr), K(lbt())); + LOG_TRACE("succeed to remove column items", K(expr), K(lbt())); } } for (int64_t i = subquery_exprs_.count() - 1; OB_SUCC(ret) && i >= 0; i--) {