Fix view merge bug when there is a rand() function in select items of view.
This commit is contained in:
@ -1548,6 +1548,7 @@ int ObTransformGroupByPlacement::check_groupby_pullup_validity(ObDMLStmt* stmt,
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool can_pullup = false;
|
||||
bool has_rand = false;
|
||||
if (OB_ISNULL(stmt) || OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("param has null", K(stmt), K(table), K(ret));
|
||||
@ -1574,6 +1575,11 @@ int ObTransformGroupByPlacement::check_groupby_pullup_validity(ObDMLStmt* stmt,
|
||||
LOG_WARN("failed to check null propagate select expr", K(ret));
|
||||
} else if (!can_pullup) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(sub_stmt->has_rand(has_rand))) {
|
||||
LOG_WARN("failed to check stmt has rand func", K(ret));
|
||||
// stmt不能包含rand函数 https://work.aone.alibaba-inc.com/issue/35875561
|
||||
} else if (!(can_pullup = !has_rand)) {
|
||||
// do nothing
|
||||
} else if (OB_FALSE_IT(helper.need_merge_ = sub_stmt->get_stmt_hint().enable_view_merge())) {
|
||||
} else if (OB_FAIL(valid_views.push_back(helper))) {
|
||||
LOG_WARN("failed to push back group stmt index", K(ret));
|
||||
|
||||
@ -346,7 +346,15 @@ int ObTransformViewMerge::check_can_be_unnested(
|
||||
LOG_WARN("NULL expr", K(ret));
|
||||
} else if (expr->has_flag(CNT_SUB_QUERY)) {
|
||||
can_be = false;
|
||||
} else { /*do nothing*/
|
||||
}
|
||||
}
|
||||
// stmt不能包含rand函数 https://work.aone.alibaba-inc.com/issue/35875561
|
||||
if (OB_SUCC(ret) && can_be) {
|
||||
bool has_rand = false;
|
||||
if (OB_FAIL(child_stmt->has_rand(has_rand))) {
|
||||
LOG_WARN("failed to get rand flag", K(ret));
|
||||
} else {
|
||||
can_be = !has_rand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user