From 0f38ab7395050d5f2cb2863a67c4b3ed24365f60 Mon Sep 17 00:00:00 2001 From: jz0 Date: Tue, 27 Jul 2021 18:09:13 +0800 Subject: [PATCH] Fix outerjoin on condition pushdown parent_namespace_stmt issue --- src/sql/rewrite/ob_transform_simplify.cpp | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/sql/rewrite/ob_transform_simplify.cpp b/src/sql/rewrite/ob_transform_simplify.cpp index e63ee15a47..171e6a5633 100644 --- a/src/sql/rewrite/ob_transform_simplify.cpp +++ b/src/sql/rewrite/ob_transform_simplify.cpp @@ -356,18 +356,20 @@ int ObTransformSimplify::push_down_on_condition(ObDMLStmt *stmt, LOG_WARN("failed to update column item rel id", K(ret)); } - if (OB_FAIL(ret)) { - } else if (OB_FAIL(child_stmt->adjust_subquery_stmt_parent(stmt, child_stmt))) { - LOG_WARN("failed to adjust subquery stmt parent", K(ret)); - } else if (OB_FAIL(stmt->get_column_exprs(join_table->right_table_->table_id_, old_column_exprs))) { - LOG_WARN("failed to get column exprs", K(ret)); - } else if (OB_FAIL(ObTransformUtils::convert_column_expr_to_select_expr( - old_column_exprs, *child_stmt, new_column_exprs))) { - LOG_WARN("failed to conver column exprs", K(ret)); - } else if (OB_FAIL(child_stmt->replace_inner_stmt_expr(old_column_exprs, new_column_exprs))) { - LOG_WARN("failed to replace stmt exprs", K(ret)); - } else if (OB_FAIL(stmt->formalize_stmt(ctx_->session_info_))) { - LOG_WARN("failed to formalize stmt", K(ret)); + if (OB_SUCC(ret)) { + child_stmt->set_parent_namespace_stmt(stmt->get_parent_namespace_stmt()); + if (OB_FAIL(child_stmt->adjust_subquery_stmt_parent(stmt, child_stmt))) { + LOG_WARN("failed to adjust subquery stmt parent", K(ret)); + } else if (OB_FAIL(stmt->get_column_exprs(join_table->right_table_->table_id_, old_column_exprs))) { + LOG_WARN("failed to get column exprs", K(ret)); + } else if (OB_FAIL(ObTransformUtils::convert_column_expr_to_select_expr( + old_column_exprs, *child_stmt, new_column_exprs))) { + LOG_WARN("failed to conver column exprs", K(ret)); + } else if (OB_FAIL(child_stmt->replace_inner_stmt_expr(old_column_exprs, new_column_exprs))) { + LOG_WARN("failed to replace stmt exprs", K(ret)); + } else if (OB_FAIL(stmt->formalize_stmt(ctx_->session_info_))) { + LOG_WARN("failed to formalize stmt", K(ret)); + } } return ret; } -- GitLab