1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

@ -368,6 +368,8 @@ const std::string bestTableName(const Item_field* ifp);
bool isMCSTable(TABLE* table_ptr);
bool isForeignTableUpdate(THD* thd);
bool isUpdateHasForeignTable(THD* thd);
bool isMCSTableUpdate(THD* thd);
bool isMCSTableDelete(THD* thd);
// execution plan util functions prototypes
execplan::ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupport, bool isRefItem = false);
@ -411,10 +413,10 @@ bool buildEqualityPredicate(execplan::ReturnedColumn* lhs,
const std::vector<Item*>& itemList,
bool isInSubs = false);
inline bool isUpdateStatement(const enum_sql_command& command, const bool isMCSTableUpdate = true)
inline bool isUpdateStatement(const enum_sql_command& command)
{
return (command == SQLCOM_UPDATE) ||
(command == SQLCOM_UPDATE_MULTI && isMCSTableUpdate);
return ((command == SQLCOM_UPDATE) ||
(command == SQLCOM_UPDATE_MULTI));
}
inline bool isDeleteStatement(const enum_sql_command& command)
@ -423,9 +425,9 @@ inline bool isDeleteStatement(const enum_sql_command& command)
(command == SQLCOM_DELETE_MULTI);
}
inline bool isUpdateOrDeleteStatement(const enum_sql_command& command, const bool isMCSTableUpdate = true)
inline bool isUpdateOrDeleteStatement(const enum_sql_command& command)
{
return isUpdateStatement(command, isMCSTableUpdate) ||
return isUpdateStatement(command) ||
isDeleteStatement(command);
}