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

MCOL-4868 UPDATE on a ColumnStore table containing an IN-subquery

on a non-ColumnStore table does not work.

As part of MCOL-4617, we moved the in-to-exists predicate creation
and injection from the server into the engine. However, when query
with an IN Subquery contains a non-ColumnStore table, the server
still performs the in-to-exists predicate transformation for the
foreign engine table. This caused ColumnStore's execution plan to
contain incorrect WHERE predicates. As a fix, we call
mutate_optimizer_flags() for the WRITE lock, in addition to the READ
table lock. And in mutate_optimizer_flags(), we change the optimizer
flag from OPTIMIZER_SWITCH_IN_TO_EXISTS to OPTIMIZER_SWITCH_MATERIALIZATION.
This commit is contained in:
Gagan Goel
2021-12-14 19:25:03 -05:00
parent 6144e6ff99
commit 7f456e58cc
6 changed files with 209 additions and 12 deletions

View File

@ -2580,7 +2580,7 @@ int ha_mcs_impl_rnd_next(uchar* buf, TABLE* table)
thd->lex->sql_command == SQLCOM_LOAD))
return HA_ERR_END_OF_FILE;
if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd)))
if (isMCSTableUpdate(thd) || isMCSTableDelete(thd))
return HA_ERR_END_OF_FILE;
// @bug 2547
@ -2674,7 +2674,7 @@ int ha_mcs_impl_rnd_end(TABLE* table, bool is_pushdown_hand)
if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE )
return rc;
if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd)))
if (isMCSTableUpdate(thd) || isMCSTableDelete(thd))
return rc;
if (!ci)
@ -4010,7 +4010,7 @@ int ha_mcs::impl_external_lock(THD* thd, TABLE* table, int lock_type)
}
else
{
if (lock_type == 0)
if ((lock_type == 0) || (lock_type == 1))
{
ci->physTablesList.insert(table);
// MCOL-2178 Disable Conversion of Big IN Predicates Into Subqueries
@ -4538,7 +4538,7 @@ int ha_mcs_impl_group_by_next(TABLE* table)
thd->lex->sql_command == SQLCOM_LOAD))
return HA_ERR_END_OF_FILE;
if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd)))
if (isMCSTableUpdate(thd) || isMCSTableDelete(thd))
return HA_ERR_END_OF_FILE;
if (get_fe_conn_info_ptr() == nullptr)