1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-4493 Add ON expressions for WHERE processing when the JOIN

type is not LEFT/RIGHT.

In buildOuterJoin(), do not add ON expressions for WHERE
processing when the JOIN type is not LEFT/RIGHT.

Test cases to check correct processing of INNER JOIN ON expressions
with possible/impossible WHERE conditions are added for
  1. One side of the LEFT JOIN being INNER JOIN.
  2. One side of the LEFT JOIN being an INNER JOIN inside an INNER JOIN.
  3. Both sides of the LEFT JOIN being an INNER JOIN.
This commit is contained in:
Gagan Goel
2021-01-27 09:34:17 -05:00
parent 7277299628
commit abf45bf46c
3 changed files with 266 additions and 2 deletions

View File

@ -1320,7 +1320,7 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
(table_ptr->alias.length ? table_ptr->alias.str : ""),
getViewName(table_ptr), true, lower_case_table_names);
if (table_ptr->outer_join && table_ptr->on_expr)
if ((table_ptr->outer_join & (JOIN_TYPE_LEFT | JOIN_TYPE_RIGHT)) && table_ptr->on_expr)
{
// inner tables block
Item_cond* expr = reinterpret_cast<Item_cond*>(table_ptr->on_expr);
@ -6297,7 +6297,7 @@ int processFrom(bool &isUnion,
}
// Save on_expr to use it for WHERE processing
if (!table_ptr->outer_join && table_ptr->on_expr)
if (!(table_ptr->outer_join & (JOIN_TYPE_LEFT | JOIN_TYPE_RIGHT)) && table_ptr->on_expr)
{
on_expr_list.push_back(table_ptr->on_expr);
}