提交 3c169863 编写于 作者: L Larry955 提交者: ob-robot

fix subquery coalesce bug

上级 7ef8b5eb
......@@ -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()) {
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册