[CP] fix wm_concat bug

This commit is contained in:
2149
2023-06-29 03:18:26 +00:00
committed by ob-robot
parent 6c526c3e9b
commit 68b75ed66b

View File

@ -111,6 +111,7 @@ int ObTransformSimplifyOrderby::remove_order_by_for_subquery(ObDMLStmt *stmt, bo
int ObTransformSimplifyOrderby::remove_order_by_for_view_stmt(ObDMLStmt *stmt, bool &trans_happened, bool &force_serial_set_order) int ObTransformSimplifyOrderby::remove_order_by_for_view_stmt(ObDMLStmt *stmt, bool &trans_happened, bool &force_serial_set_order)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
bool can_remove = false;
trans_happened = false; trans_happened = false;
if (OB_ISNULL(stmt)) { if (OB_ISNULL(stmt)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
@ -122,7 +123,21 @@ int ObTransformSimplifyOrderby::remove_order_by_for_view_stmt(ObDMLStmt *stmt, b
/*do nothing*/ /*do nothing*/
} else if (stmt->is_select_stmt() && static_cast<ObSelectStmt*>(stmt)->has_window_function()) { } else if (stmt->is_select_stmt() && static_cast<ObSelectStmt*>(stmt)->has_window_function()) {
/*do nothing*/ /*do nothing*/
} else if (stmt->is_select_stmt() && is_oracle_mode()) {
common::ObIArray<ObAggFunRawExpr*> &aggr_items = static_cast<ObSelectStmt*>(stmt)->get_aggr_items();
can_remove = true;
for (int64_t i = 0; OB_SUCC(ret) && can_remove && i < aggr_items.count(); ++i) {
if (OB_ISNULL(aggr_items.at(i))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null", K(ret), K(aggr_items));
} else if (T_FUN_WM_CONCAT == aggr_items.at(i)->get_expr_type()) {
can_remove = false;
}
}
} else { } else {
can_remove = true;
}
if (OB_SUCC(ret) && can_remove) {
ObSelectStmt *view_stmt = NULL; ObSelectStmt *view_stmt = NULL;
ObSelectStmt *select_stmt = NULL; ObSelectStmt *select_stmt = NULL;
bool happened = false; bool happened = false;