fix subquery coalesce bug

This commit is contained in:
Larry955 2022-12-09 04:08:27 +00:00 committed by ob-robot
parent 7ef8b5ebc9
commit 3c16986342
2 changed files with 3 additions and 4 deletions

View File

@ -130,7 +130,8 @@ int ObTransformSimplifySubquery::try_trans_subquery_in_expr(ObDMLStmt *stmt,
LOG_WARN("too deep recursive", K(ret), K(is_stack_overflow));
} else if (IS_SUBQUERY_COMPARISON_OP(expr->get_expr_type()) ||
T_OP_EXISTS == expr->get_expr_type() ||
T_OP_NOT_EXISTS == expr->get_expr_type()) {
T_OP_NOT_EXISTS == expr->get_expr_type() ||
expr->is_alias_ref_expr()) {
// 如果 expr 的param 必须是 subquery,那么不去改写它包含的子查询
//do nothing
} else if (expr->is_query_ref_expr()) {

View File

@ -1962,13 +1962,11 @@ int ObTransformSubqueryCoalesce::inner_coalesce_subquery(ObSelectStmt *subquery,
} else if (!coalesce_select->same_as(*subquery_select, &context)) {
// do nothing
} else if (!is_first_subquery &&
!coalesce_select->is_column_ref_expr() &&
!coalesce_select->is_const_expr() &&
OB_FAIL(ObTransformUtils::create_select_item(*ctx_->allocator_,
coalesce_select,
coalesce_query))) {
LOG_WARN("failed to create column for subquery", K(ret));
} else if (OB_FAIL(index_map.push_back(coalesce_query->get_select_item_size() - 1))) {
} else if (OB_FAIL(index_map.push_back(is_first_subquery ? j : coalesce_query->get_select_item_size() - 1))) {
LOG_WARN("failed to push back index", K(ret));
} else {
find = true;