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

MCOL-641 Basic support for updates.

This commit is contained in:
Gagan Goel
2020-02-20 17:23:25 -05:00
committed by Roman Nozdrin
parent f73de30427
commit b07db9a8f4
5 changed files with 124 additions and 163 deletions

View File

@ -1502,6 +1502,17 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
isFromCol = true;
columnAssignmentPtr->fFromCol = true;
Item_field* setIt = reinterpret_cast<Item_field*> (value);
// Minor optimization:
// do not perform updates of the form "update t1 set a = a;"
if (!strcmp(item->name.str, setIt->name.str)
&& item->table_name && setIt->table_name && !strcmp(item->table_name, setIt->table_name)
&& item->db_name && setIt->db_name && !strcmp(item->db_name, setIt->db_name))
{
delete columnAssignmentPtr;
continue;
}
string sectableName = string(setIt->table_name.str);
if ( setIt->db_name.str ) //derived table
@ -1609,6 +1620,13 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
ci->stats.fQueryType = updateCP->queryType();
}
// Exit early if there is nothing to update
if (colAssignmentListPtr->empty())
{
ci->affectedRows = 0;
return 0;
}
//save table oid for commit/rollback to use
uint32_t sessionID = tid2sid(thd->thread_id);
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
@ -1645,7 +1663,6 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
TableName* qualifiedTablName = new TableName();
UpdateSqlStatement updateStmt;
//@Bug 2753. To make sure the momory is freed.
updateStmt.fColAssignmentListPtr = colAssignmentListPtr;