Fix simplify is null bug

This commit is contained in:
xianyu-w
2023-01-09 12:38:06 +00:00
committed by ob-robot
parent c153bc2b09
commit 2c5e745e15
4 changed files with 88 additions and 24 deletions

View File

@ -1729,11 +1729,34 @@ int ObNotNullContext::add_filter(const ObIArray<ObRawExpr *> &filters)
return ret;
}
int ObNotNullContext::add_filter(ObRawExpr *filter)
{
return filters_.push_back(filter);
}
int ObNotNullContext::remove_filter(ObRawExpr *filter)
{
return ObOptimizerUtil::remove_item(filters_, filter);
}
int ObNotNullContext::add_having_filter(const ObIArray<ObRawExpr *> &filters)
{
int ret = OB_SUCCESS;
if (OB_FAIL(append(having_filters_, filters))) {
LOG_WARN("failed to append filters", K(ret));
}
return ret;
}
int ObNotNullContext::add_having_filter(ObRawExpr *filter)
{
return having_filters_.push_back(filter);
}
int ObNotNullContext::remove_having_filter(ObRawExpr *filter)
{
return ObOptimizerUtil::remove_item(having_filters_, filter);
}
int ObTransformUtils::get_outer_join_right_tables(const JoinedTable &joined_table,
ObIArray<uint64_t> &table_ids)
{
@ -1754,13 +1777,26 @@ int ObTransformUtils::get_outer_join_right_tables(const JoinedTable &joined_tabl
table_ids)))) {
LOG_WARN("failed to visit right table", K(ret));
}
}
if (OB_SUCC(ret) && (joined_table.is_left_join() ||
joined_table.is_full_join())) {
} else if (joined_table.is_full_join()){
if (left->is_joined_table()) {
if (OB_FAIL(append(table_ids, static_cast<JoinedTable *>(left)->single_table_ids_))) {
LOG_WARN("failed to append tables ids", K(ret));
}
} else if (OB_FAIL(table_ids.push_back(left->table_id_))) {
LOG_WARN("failed to push back left table id", K(ret));
}
if (OB_SUCC(ret) && right->is_joined_table()) {
if (OB_FAIL(append(table_ids, static_cast<JoinedTable *>(right)->single_table_ids_))) {
LOG_WARN("failed to append tables ids", K(ret));
}
} else if (OB_FAIL(table_ids.push_back(right->table_id_))) {
LOG_WARN("failed to push back right table id", K(ret));
}
} else if (joined_table.is_left_join()) {
if (left->is_joined_table() &&
OB_FAIL(SMART_CALL(get_outer_join_right_tables(static_cast<JoinedTable&>(*left),
table_ids)))) {
LOG_WARN("failed to visit left table", K(ret));
table_ids)))){
LOG_WARN("failed to visit left table", K(ret));
} else if (right->is_joined_table()) {
if (OB_FAIL(append(table_ids, static_cast<JoinedTable *>(right)->single_table_ids_))) {
LOG_WARN("failed to append tables ids", K(ret));
@ -1768,14 +1804,11 @@ int ObTransformUtils::get_outer_join_right_tables(const JoinedTable &joined_tabl
} else if (OB_FAIL(table_ids.push_back(right->table_id_))) {
LOG_WARN("failed to push back right table id", K(ret));
}
}
if (OB_SUCC(ret) && (joined_table.is_right_join() ||
joined_table.is_full_join())) {
} else if (joined_table.is_right_join()) {
if (right->is_joined_table() &&
OB_FAIL(SMART_CALL(get_outer_join_right_tables(static_cast<JoinedTable&>(*right),
table_ids)))) {
LOG_WARN("failed to visit right table", K(ret));
OB_FAIL(SMART_CALL(get_outer_join_right_tables(static_cast<JoinedTable&>(*right),
table_ids)))){
LOG_WARN("failed to visit right table", K(ret));
} else if (left->is_joined_table()) {
if (OB_FAIL(append(table_ids, static_cast<JoinedTable *>(left)->single_table_ids_))) {
LOG_WARN("failed to append tables ids", K(ret));