You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Merge pull request #1459 from dhall-MariaDB/MCOL-4144-dev
MCOL-4144-dev Enable lower_case_table_names
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
[mysqld]
|
||||
plugin-load-add=ha_columnstore.so
|
||||
plugin-maturity=beta
|
||||
lower_case_table_names=1
|
||||
|
||||
# Enable compression by default on create, set to NONE to turn off
|
||||
#columnstore_compression_type=SNAPPY
|
||||
|
@ -345,7 +345,7 @@ SCSEP FromSubQuery::transform()
|
||||
gwi.subQuery = this;
|
||||
gwi.viewName = fGwip.viewName;
|
||||
csep->derivedTbAlias(fAlias); // always lower case
|
||||
csep->derivedTbView(fGwip.viewName.alias);
|
||||
csep->derivedTbView(fGwip.viewName.alias, lower_case_table_names);
|
||||
|
||||
if (getSelectPlan(gwi, *fFromSub, csep, false) != 0)
|
||||
{
|
||||
|
@ -478,7 +478,9 @@ extern "C"
|
||||
tableName.table = args->args[0];
|
||||
|
||||
if (thd->db.length)
|
||||
{
|
||||
tableName.schema = thd->db.str;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg("No schema information provided");
|
||||
@ -487,6 +489,11 @@ extern "C"
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(tableName.schema);
|
||||
boost::algorithm::to_lower(tableName.table);
|
||||
}
|
||||
|
||||
if ( !ci->dmlProc )
|
||||
{
|
||||
@ -620,6 +627,11 @@ extern "C"
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(tableName.schema);
|
||||
boost::algorithm::to_lower(tableName.table);
|
||||
}
|
||||
|
||||
boost::shared_ptr<execplan::CalpontSystemCatalog> csc =
|
||||
execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(
|
||||
|
@ -421,10 +421,14 @@ bool anyRowInTable(string& schema, string& tableName, int sessionID)
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(execplan::CalpontSystemCatalog::FE);
|
||||
CalpontSystemCatalog::TableName aTableName;
|
||||
algorithm::to_lower(schema);
|
||||
algorithm::to_lower(tableName);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
algorithm::to_lower(schema);
|
||||
algorithm::to_lower(tableName);
|
||||
}
|
||||
aTableName.schema = schema;
|
||||
aTableName.table = tableName;
|
||||
|
||||
CalpontSystemCatalog::RIDList ridList = csc->columnRIDs(aTableName, true);
|
||||
CalpontSystemCatalog::TableColName tableColName = csc->colName(ridList[0].objnum);
|
||||
|
||||
@ -558,8 +562,11 @@ bool anyTimestampColumn(string& schema, string& tableName, int sessionID)
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(execplan::CalpontSystemCatalog::FE);
|
||||
CalpontSystemCatalog::TableName aTableName;
|
||||
algorithm::to_lower(schema);
|
||||
algorithm::to_lower(tableName);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
algorithm::to_lower(schema);
|
||||
algorithm::to_lower(tableName);
|
||||
}
|
||||
|
||||
// select columnname from calpontsys.syscolumn
|
||||
// where schema = schema and tablename = tableName
|
||||
@ -729,8 +736,11 @@ bool anyNullInTheColumn (THD* thd, string& schema, string& table, string& column
|
||||
CalpontSelectExecutionPlan::ReturnedColumnList returnedColumnList;
|
||||
CalpontSelectExecutionPlan::FilterTokenList filterTokenList;
|
||||
CalpontSelectExecutionPlan::ColumnMap colMap;
|
||||
algorithm::to_lower(schema);
|
||||
algorithm::to_lower(table);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
algorithm::to_lower(schema);
|
||||
algorithm::to_lower(table);
|
||||
}
|
||||
algorithm::to_lower(columnName);
|
||||
|
||||
SessionManager sm;
|
||||
@ -912,6 +922,11 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& tabl
|
||||
if ( typeid ( stmt ) == typeid ( CreateTableStatement ) )
|
||||
{
|
||||
CreateTableStatement* createTable = dynamic_cast <CreateTableStatement*> ( &stmt );
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
algorithm::to_lower(createTable->fTableDef->fQualifiedName->fSchema);
|
||||
algorithm::to_lower(createTable->fTableDef->fQualifiedName->fName);
|
||||
}
|
||||
|
||||
bool matchedCol = false;
|
||||
bool isFirstTimestamp = true;
|
||||
@ -1215,6 +1230,11 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& tabl
|
||||
else if ( typeid ( stmt ) == typeid ( AlterTableStatement ) )
|
||||
{
|
||||
AlterTableStatement* alterTable = dynamic_cast <AlterTableStatement*> ( &stmt );
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
algorithm::to_lower(alterTable->fTableName->fSchema);
|
||||
algorithm::to_lower(alterTable->fTableName->fName);
|
||||
}
|
||||
|
||||
alterTable->fTimeZone.assign(thd->variables.time_zone->get_name()->ptr());
|
||||
|
||||
|
@ -1877,6 +1877,11 @@ std::string ha_mcs_impl_viewtablelock( cal_impl_if::cal_connection_info& ci, ex
|
||||
std::string dmlStatement( "VIEWTABLELOCK" );
|
||||
VendorDMLStatement cmdStmt(dmlStatement, DML_COMMAND, sessionID);
|
||||
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(cmdStmt);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(tablename.schema);
|
||||
boost::algorithm::to_lower(tablename.table);
|
||||
}
|
||||
pDMLPackage->set_SchemaName (tablename.schema);
|
||||
pDMLPackage->set_TableName (tablename.table);
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
//#define DEBUG_WALK_COND
|
||||
#include <strings.h>
|
||||
|
||||
#include <string>
|
||||
@ -129,15 +128,6 @@ public:
|
||||
gp_walk_info* fgwip;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
string lower(string str)
|
||||
{
|
||||
boost::algorithm::to_lower(str);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
#include "ha_view.h"
|
||||
|
||||
namespace cal_impl_if
|
||||
@ -1249,7 +1239,7 @@ void buildNestedTableOuterJoin(gp_walk_info& gwi, TABLE_LIST* table_ptr)
|
||||
(table->db.length ? table->db.str : ""),
|
||||
(table->table_name.length ? table->table_name.str : ""),
|
||||
(table->alias.length ? table->alias.str : ""),
|
||||
getViewName(table));
|
||||
getViewName(table), true, lower_case_table_names);
|
||||
gwi.innerTables.insert(ta);
|
||||
}
|
||||
|
||||
@ -1264,7 +1254,7 @@ void buildNestedTableOuterJoin(gp_walk_info& gwi, TABLE_LIST* table_ptr)
|
||||
(tab->db.length ? tab->db.str : ""),
|
||||
(tab->table_name.length ? tab->table_name.str : ""),
|
||||
(tab->alias.length ? tab->alias.str : ""),
|
||||
getViewName(tab));
|
||||
getViewName(tab), true, lower_case_table_names);
|
||||
gwi.innerTables.insert(ta);
|
||||
}
|
||||
}
|
||||
@ -1313,7 +1303,7 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
|
||||
(table_ptr->db.length ? table_ptr->db.str : ""),
|
||||
(table_ptr->table_name.length ? table_ptr->table_name.str : ""),
|
||||
(table_ptr->alias.length ? table_ptr->alias.str : ""),
|
||||
getViewName(table_ptr));
|
||||
getViewName(table_ptr), true, lower_case_table_names);
|
||||
|
||||
if (table_ptr->outer_join && table_ptr->on_expr)
|
||||
{
|
||||
@ -1332,7 +1322,7 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
|
||||
(table->db.length ? table->db.str : ""),
|
||||
(table->table_name.length ? table->table_name.str : ""),
|
||||
(table->alias.length ? table->alias.str : ""),
|
||||
getViewName(table));
|
||||
getViewName(table), true, lower_case_table_names);
|
||||
gwi_outer.innerTables.insert(ta);
|
||||
}
|
||||
}
|
||||
@ -1367,7 +1357,7 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
|
||||
(table->db.length ? table->db.str : ""),
|
||||
(table->table_name.length ? table->table_name.str : ""),
|
||||
(table->alias.length ? table->alias.str : ""),
|
||||
getViewName(table));
|
||||
getViewName(table), true, lower_case_table_names);
|
||||
gwi_outer.innerTables.insert(ta);
|
||||
}
|
||||
|
||||
@ -2387,8 +2377,8 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp)
|
||||
// @bug 3003. Keep column alias if it has.
|
||||
sc->alias(ifp->is_autogenerated_name() ? tcn.column : ifp->name.str);
|
||||
|
||||
sc->tableAlias(lower(gwi.tbList[i].alias));
|
||||
sc->viewName(lower(viewName));
|
||||
sc->tableAlias(gwi.tbList[i].alias);
|
||||
sc->viewName(viewName, lower_case_table_names);
|
||||
sc->resultType(ct);
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
break;
|
||||
@ -2446,17 +2436,15 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp)
|
||||
sc->alias(ifp->is_autogenerated_name() ? cols[j]->alias() : ifp->name.str);
|
||||
sc->tableName(csep->derivedTbAlias());
|
||||
sc->colPosition(j);
|
||||
string tableAlias(csep->derivedTbAlias());
|
||||
sc->tableAlias(lower(tableAlias));
|
||||
sc->tableAlias(csep->derivedTbAlias());
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
if (!viewName.empty())
|
||||
{
|
||||
// TODO: Remove lower when MCOL-4144 fixed
|
||||
sc->viewName(lower(viewName));
|
||||
sc->viewName(viewName, lower_case_table_names);
|
||||
}
|
||||
else
|
||||
{
|
||||
sc->viewName(lower(csep->derivedTbView()));
|
||||
sc->viewName(csep->derivedTbView());
|
||||
}
|
||||
sc->resultType(cols[j]->resultType());
|
||||
sc->hasAggregate(cols[j]->hasAggregate());
|
||||
@ -2570,15 +2558,14 @@ void collectAllCols(gp_walk_info& gwi, Item_field* ifp)
|
||||
SimpleColumn* sc = new SimpleColumn();
|
||||
sc->columnName(cols[j]->alias());
|
||||
sc->colPosition(j);
|
||||
string tableAlias(csep->derivedTbAlias());
|
||||
sc->tableAlias(lower(tableAlias));
|
||||
sc->viewName(lower(gwi.tbList[i].view));
|
||||
sc->tableAlias(csep->derivedTbAlias());
|
||||
sc->viewName(gwi.tbList[i].view);
|
||||
sc->resultType(cols[j]->resultType());
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
|
||||
// @bug5634 derived table optimization
|
||||
cols[j]->incRefCount();
|
||||
sc->derivedTable(tableAlias);
|
||||
sc->derivedTable(sc->tableAlias());
|
||||
sc->derivedRefCol(cols[j].get());
|
||||
srcp.reset(sc);
|
||||
gwi.returnedCols.push_back(srcp);
|
||||
@ -2590,10 +2577,23 @@ void collectAllCols(gp_walk_info& gwi, Item_field* ifp)
|
||||
{
|
||||
CalpontSystemCatalog::TableName tn(gwi.tbList[i].schema, gwi.tbList[i].table);
|
||||
|
||||
if (!tableName.empty() && (strcasecmp(tableName.c_str(), tn.table.c_str()) != 0 &&
|
||||
strcasecmp(tableName.c_str(), gwi.tbList[i].alias.c_str()) != 0 ))
|
||||
continue;
|
||||
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
if (!tableName.empty() && (strcasecmp(tableName.c_str(), tn.table.c_str()) != 0 &&
|
||||
strcasecmp(tableName.c_str(), gwi.tbList[i].alias.c_str()) != 0 ))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!tableName.empty() && (strcmp(tableName.c_str(), tn.table.c_str()) != 0 &&
|
||||
strcmp(tableName.c_str(), gwi.tbList[i].alias.c_str()) != 0 ))
|
||||
continue;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(tn.schema);
|
||||
boost::algorithm::to_lower(tn.table);
|
||||
}
|
||||
CalpontSystemCatalog::RIDList oidlist = gwi.csc->columnRIDs(tn, true);
|
||||
|
||||
for (unsigned int j = 0; j < oidlist.size(); j++)
|
||||
@ -2602,13 +2602,13 @@ void collectAllCols(gp_walk_info& gwi, Item_field* ifp)
|
||||
CalpontSystemCatalog::TableColName tcn = gwi.csc->colName(oidlist[j].objnum);
|
||||
CalpontSystemCatalog::ColType ct = gwi.csc->colType(oidlist[j].objnum);
|
||||
sc->columnName(tcn.column);
|
||||
sc->tableName(tcn.table);
|
||||
sc->schemaName(tcn.schema);
|
||||
sc->tableName(tcn.table, lower_case_table_names);
|
||||
sc->schemaName(tcn.schema, lower_case_table_names);
|
||||
sc->oid(oidlist[j].objnum);
|
||||
sc->alias(tcn.column);
|
||||
sc->resultType(ct);
|
||||
sc->tableAlias(lower(gwi.tbList[i].alias));
|
||||
sc->viewName(lower(viewName));
|
||||
sc->tableAlias(gwi.tbList[i].alias, lower_case_table_names);
|
||||
sc->viewName(viewName, lower_case_table_names);
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
srcp.reset(sc);
|
||||
gwi.returnedCols.push_back(srcp);
|
||||
@ -2887,6 +2887,15 @@ SimpleColumn* getSmallestColumn(boost::shared_ptr<CalpontSystemCatalog> csc,
|
||||
TABLE* table,
|
||||
gp_walk_info& gwi)
|
||||
{
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(tn.schema);
|
||||
boost::algorithm::to_lower(tn.table);
|
||||
boost::algorithm::to_lower(tan.schema);
|
||||
boost::algorithm::to_lower(tan.table);
|
||||
boost::algorithm::to_lower(tan.alias);
|
||||
boost::algorithm::to_lower(tan.view);
|
||||
}
|
||||
// derived table
|
||||
if (tan.schema.empty())
|
||||
{
|
||||
@ -2901,7 +2910,7 @@ SimpleColumn* getSmallestColumn(boost::shared_ptr<CalpontSystemCatalog> csc,
|
||||
SimpleColumn* sc = new SimpleColumn();
|
||||
sc->columnName(rc->alias());
|
||||
sc->sequence(0);
|
||||
sc->tableAlias(lower(tan.alias));
|
||||
sc->tableAlias(tan.alias);
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
// @bug5634 derived table optimization.
|
||||
rc->incRefCount();
|
||||
@ -2919,9 +2928,8 @@ SimpleColumn* getSmallestColumn(boost::shared_ptr<CalpontSystemCatalog> csc,
|
||||
{
|
||||
// get the first column to project. @todo optimization to get the smallest one for foreign engine.
|
||||
Field* field = *(table->field);
|
||||
SimpleColumn* sc = new SimpleColumn(table->s->db.str, table->s->table_name.str, field->field_name.str, tan.fisColumnStore, gwi.sessionid);
|
||||
string alias(table->alias.ptr());
|
||||
sc->tableAlias(lower(alias));
|
||||
SimpleColumn* sc = new SimpleColumn(table->s->db.str, table->s->table_name.str, field->field_name.str, tan.fisColumnStore, gwi.sessionid, lower_case_table_names);
|
||||
sc->tableAlias(table->alias.ptr(), lower_case_table_names);
|
||||
sc->isColumnStore(false);
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
sc->resultType(fieldType_MysqlToIDB(field));
|
||||
@ -2950,8 +2958,8 @@ SimpleColumn* getSmallestColumn(boost::shared_ptr<CalpontSystemCatalog> csc,
|
||||
|
||||
tcn = csc->colName(oidlist[minWidthColOffset].objnum);
|
||||
SimpleColumn* sc = new SimpleColumn(tcn.schema, tcn.table, tcn.column, csc->sessionID());
|
||||
sc->tableAlias(lower(tan.alias));
|
||||
sc->viewName(lower(tan.view));
|
||||
sc->tableAlias(tan.alias);
|
||||
sc->viewName(tan.view);
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
sc->resultType(csc->colType(oidlist[minWidthColOffset].objnum));
|
||||
sc->charsetNumber(3000);
|
||||
@ -4499,15 +4507,15 @@ SimpleColumn* buildSimpleColumn(Item_field* ifp, gp_walk_info& gwi)
|
||||
if (isInformationSchema)
|
||||
{
|
||||
sc->schemaName("information_schema");
|
||||
sc->tableName(tbname);
|
||||
sc->tableName(tbname, lower_case_table_names);
|
||||
}
|
||||
|
||||
sc->tableAlias(lower(tbname));
|
||||
sc->tableAlias(tbname, lower_case_table_names);
|
||||
|
||||
// view name
|
||||
sc->viewName(lower(getViewName(ifp->cached_table)));
|
||||
|
||||
sc->viewName(getViewName(ifp->cached_table), lower_case_table_names);
|
||||
sc->alias(ifp->name.str);
|
||||
|
||||
sc->isColumnStore(columnStore);
|
||||
sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
|
||||
@ -5231,7 +5239,7 @@ void gp_walk(const Item* item, void* arg)
|
||||
break;
|
||||
|
||||
string aliasTableName(scp->tableAlias());
|
||||
scp->tableAlias(lower(aliasTableName));
|
||||
scp->tableAlias(aliasTableName);
|
||||
gwip->rcWorkStack.push(scp->clone());
|
||||
boost::shared_ptr<SimpleColumn> scsp(scp);
|
||||
gwip->scsp = scsp;
|
||||
@ -6214,6 +6222,10 @@ int processFrom(bool &isUnion,
|
||||
}
|
||||
|
||||
string viewName = getViewName(table_ptr);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(viewName);
|
||||
}
|
||||
|
||||
// @todo process from subquery
|
||||
if (table_ptr->derived)
|
||||
@ -6221,7 +6233,11 @@ int processFrom(bool &isUnion,
|
||||
SELECT_LEX* select_cursor = table_ptr->derived->first_select();
|
||||
FromSubQuery fromSub(gwi, select_cursor);
|
||||
string alias(table_ptr->alias.str);
|
||||
fromSub.alias(lower(alias));
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(alias);
|
||||
}
|
||||
fromSub.alias(alias);
|
||||
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview("", "", alias, viewName);
|
||||
// @bug 3852. check return execplan
|
||||
@ -6244,7 +6260,7 @@ int processFrom(bool &isUnion,
|
||||
else if (table_ptr->view)
|
||||
{
|
||||
View* view = new View(*table_ptr->view->first_select_lex(), &gwi);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, true, lower_case_table_names);
|
||||
view->viewName(tn);
|
||||
gwi.viewList.push_back(view);
|
||||
view->transform();
|
||||
@ -6256,7 +6272,7 @@ int processFrom(bool &isUnion,
|
||||
|
||||
// trigger system catalog cache
|
||||
if (columnStore)
|
||||
gwi.csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str), true);
|
||||
gwi.csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str, lower_case_table_names), true);
|
||||
|
||||
string table_name = table_ptr->table_name.str;
|
||||
|
||||
@ -6264,9 +6280,9 @@ int processFrom(bool &isUnion,
|
||||
if (table_ptr->db.length && strcmp(table_ptr->db.str, "information_schema") == 0)
|
||||
table_name = (table_ptr->schema_table_name.length ? table_ptr->schema_table_name.str : table_ptr->alias.str);
|
||||
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_name, table_ptr->alias.str, viewName, columnStore);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_name, table_ptr->alias.str, viewName, columnStore, lower_case_table_names);
|
||||
gwi.tbList.push_back(tn);
|
||||
CalpontSystemCatalog::TableAliasName tan = make_aliastable(table_ptr->db.str, table_name, table_ptr->alias.str, columnStore);
|
||||
CalpontSystemCatalog::TableAliasName tan = make_aliastable(table_ptr->db.str, table_name, table_ptr->alias.str, columnStore, lower_case_table_names);
|
||||
gwi.tableMap[tan] = make_pair(0, table_ptr);
|
||||
#ifdef DEBUG_WALK_COND
|
||||
cerr << tn << endl;
|
||||
@ -7205,8 +7221,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
|
||||
rc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
|
||||
if (sub->get_select_lex()->get_table_list())
|
||||
rc->viewName(lower(getViewName(sub->get_select_lex()->get_table_list())));
|
||||
|
||||
{
|
||||
rc->viewName(getViewName(sub->get_select_lex()->get_table_list()), lower_case_table_names);
|
||||
}
|
||||
if (sub->name.length)
|
||||
rc->alias(sub->name.str);
|
||||
|
||||
@ -7968,7 +7985,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
|
||||
sc1->columnName(sc->columnName());
|
||||
sc1->tableName(sc->tableName());
|
||||
sc1->tableAlias(sc->tableAlias());
|
||||
sc1->viewName(lower(sc->viewName()));
|
||||
sc1->viewName(sc->viewName());
|
||||
sc1->colPosition(0);
|
||||
sc1->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
minSc.reset(sc1);
|
||||
@ -8056,7 +8073,11 @@ int cp_get_table_plan(THD* thd, SCSEP& csep, cal_table_info& ti)
|
||||
{
|
||||
SimpleColumn* sc = new SimpleColumn(table->s->db.str, table->s->table_name.str, field->field_name.str, sessionID);
|
||||
string alias(table->alias.c_ptr());
|
||||
sc->tableAlias(lower(alias));
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(alias);
|
||||
}
|
||||
sc->tableAlias(alias);
|
||||
sc->timeZone(gwi->thd->variables.time_zone->get_name()->ptr());
|
||||
assert (sc);
|
||||
boost::shared_ptr<SimpleColumn> spsc(sc);
|
||||
@ -8117,7 +8138,7 @@ int cp_get_table_plan(THD* thd, SCSEP& csep, cal_table_info& ti)
|
||||
csep->returnedCols(gwi->returnedCols);
|
||||
csep->columnMap(gwi->columnMap);
|
||||
CalpontSelectExecutionPlan::TableList tblist;
|
||||
tblist.push_back(make_aliastable(table->s->db.str, table->s->table_name.str, table->alias.c_ptr()));
|
||||
tblist.push_back(make_aliastable(table->s->db.str, table->s->table_name.str, table->alias.c_ptr(), true, lower_case_table_names));
|
||||
csep->tableList(tblist);
|
||||
|
||||
// @bug 3321. Set max number of blocks in a dictionary file to be scanned for filtering
|
||||
@ -8343,6 +8364,10 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
}
|
||||
|
||||
string viewName = getViewName(table_ptr);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(viewName);
|
||||
}
|
||||
|
||||
// @todo process from subquery
|
||||
if (table_ptr->derived)
|
||||
@ -8354,7 +8379,11 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
// Use Pushdown handler for subquery processing
|
||||
FromSubQuery fromSub(gwi, select_cursor);
|
||||
string alias(table_ptr->alias.str);
|
||||
fromSub.alias(lower(alias));
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(alias);
|
||||
}
|
||||
fromSub.alias(alias);
|
||||
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview("", "", alias, viewName);
|
||||
// @bug 3852. check return execplan
|
||||
@ -8377,7 +8406,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
else if (table_ptr->view)
|
||||
{
|
||||
View* view = new View(*table_ptr->view->first_select_lex(), &gwi);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, true, lower_case_table_names);
|
||||
view->viewName(tn);
|
||||
gwi.viewList.push_back(view);
|
||||
view->transform();
|
||||
@ -8389,7 +8418,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
|
||||
// trigger system catalog cache
|
||||
if (columnStore)
|
||||
csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str), true);
|
||||
csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str, lower_case_table_names), true);
|
||||
|
||||
string table_name = table_ptr->table_name.str;
|
||||
|
||||
@ -8397,9 +8426,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
if (table_ptr->db.length && strcmp(table_ptr->db.str, "information_schema") == 0)
|
||||
table_name = (table_ptr->schema_table_name.length ? table_ptr->schema_table_name.str : table_ptr->alias.str);
|
||||
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_name, table_ptr->alias.str, viewName, columnStore);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_name, table_ptr->alias.str, viewName, columnStore, lower_case_table_names);
|
||||
gwi.tbList.push_back(tn);
|
||||
CalpontSystemCatalog::TableAliasName tan = make_aliastable(table_ptr->db.str, table_name, table_ptr->alias.str, columnStore);
|
||||
CalpontSystemCatalog::TableAliasName tan = make_aliastable(table_ptr->db.str, table_name, table_ptr->alias.str, columnStore, lower_case_table_names);
|
||||
gwi.tableMap[tan] = make_pair(0, table_ptr);
|
||||
#ifdef DEBUG_WALK_COND
|
||||
cerr << tn << endl;
|
||||
@ -8959,8 +8988,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
rc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
|
||||
if (sub->get_select_lex()->get_table_list())
|
||||
rc->viewName(lower(getViewName(sub->get_select_lex()->get_table_list())));
|
||||
|
||||
{
|
||||
rc->viewName(getViewName(sub->get_select_lex()->get_table_list()), lower_case_table_names);
|
||||
}
|
||||
if (sub->name.length)
|
||||
rc->alias(sub->name.str);
|
||||
|
||||
@ -9123,7 +9153,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
funcFieldVec[i]->print(&str, QT_ORDINARY);
|
||||
sc->alias(string(str.c_ptr()));
|
||||
//sc->tableAlias(funcFieldVec[i]->table_name);
|
||||
sc->tableAlias(sc->tableAlias());
|
||||
sc->tableAlias(sc->alias());
|
||||
SRCP srcp(sc);
|
||||
uint32_t j = 0;
|
||||
|
||||
@ -9920,7 +9950,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
sc1->columnName(sc->columnName());
|
||||
sc1->tableName(sc->tableName());
|
||||
sc1->tableAlias(sc->tableAlias());
|
||||
sc1->viewName(lower(sc->viewName()));
|
||||
sc1->viewName(sc->viewName());
|
||||
sc1->timeZone(gwi.thd->variables.time_zone->get_name()->ptr());
|
||||
sc1->colPosition(0);
|
||||
minSc.reset(sc1);
|
||||
|
@ -965,8 +965,6 @@ vector<string> getOnUpdateTimestampColumns(string& schema, string& tableName, in
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
csc->identity(execplan::CalpontSystemCatalog::FE);
|
||||
CalpontSystemCatalog::TableName aTableName;
|
||||
boost::algorithm::to_lower(schema);
|
||||
boost::algorithm::to_lower(tableName);
|
||||
|
||||
// select columnname from calpontsys.syscolumn
|
||||
// where schema = schema and tablename = tableName
|
||||
@ -1304,11 +1302,18 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
else
|
||||
aliasName = item->table_name.str;
|
||||
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(aliasName);
|
||||
boost::algorithm::to_lower(tableName);
|
||||
boost::algorithm::to_lower(tmpTableName);
|
||||
}
|
||||
|
||||
if (strcasecmp(tableName.c_str(), "") == 0)
|
||||
{
|
||||
tableName = tmpTableName;
|
||||
}
|
||||
else if (strcasecmp(tableName.c_str(), tmpTableName.c_str()) != 0)
|
||||
else if (strcmp(tableName.c_str(), tmpTableName.c_str()) != 0)
|
||||
{
|
||||
//@ Bug3326 error out for multi table update
|
||||
string emsg(IDBErrorInfo::instance()->errorMsg(ERR_UPDATE_NOT_SUPPORT_FEATURE));
|
||||
@ -1332,8 +1337,13 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
schemaName = string(item->db_name.str);
|
||||
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schemaName);
|
||||
}
|
||||
}
|
||||
columnAssignmentPtr = new ColumnAssignment(item->name.str, "=", "");
|
||||
if (item->field_type() == MYSQL_TYPE_TIMESTAMP ||
|
||||
item->field_type() == MYSQL_TYPE_TIMESTAMP2)
|
||||
@ -1567,6 +1577,11 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
aTableName.schema = first_table->table->s->db.str;
|
||||
aTableName.table = first_table->table->s->table_name.str;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(aTableName.schema);
|
||||
boost::algorithm::to_lower(aTableName.table);
|
||||
}
|
||||
|
||||
CalpontDMLPackage* pDMLPackage = 0;
|
||||
// dmlStmt += ";";
|
||||
@ -1604,6 +1619,12 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
schemaName = first_table->db.str;
|
||||
tableName = first_table->table_name.str;
|
||||
aliasName = first_table->alias.str;
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schemaName);
|
||||
boost::algorithm::to_lower(tableName);
|
||||
boost::algorithm::to_lower(aliasName);
|
||||
}
|
||||
qualifiedTablName->fName = tableName;
|
||||
qualifiedTablName->fSchema = schemaName;
|
||||
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(dmlStatement);
|
||||
@ -1623,6 +1644,12 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
schemaName = first_table->table->s->db.str;
|
||||
tableName = first_table->table->s->table_name.str;
|
||||
aliasName = first_table->alias.str;
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schemaName);
|
||||
boost::algorithm::to_lower(tableName);
|
||||
boost::algorithm::to_lower(aliasName);
|
||||
}
|
||||
qualifiedTablName->fName = tableName;
|
||||
qualifiedTablName->fSchema = schemaName;
|
||||
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(dmlStatement);
|
||||
@ -1634,6 +1661,12 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
schemaName = first_table->table->s->db.str;
|
||||
tableName = first_table->table->s->table_name.str;
|
||||
aliasName = first_table->alias.str;
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schemaName);
|
||||
boost::algorithm::to_lower(tableName);
|
||||
boost::algorithm::to_lower(aliasName);
|
||||
}
|
||||
qualifiedTablName->fName = tableName;
|
||||
qualifiedTablName->fSchema = schemaName;
|
||||
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(dmlStatement);
|
||||
@ -1821,7 +1854,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
|
||||
try
|
||||
{
|
||||
colrids = csc->columnRIDs(deleteTableName);
|
||||
colrids = csc->columnRIDs(deleteTableName, false, lower_case_table_names);
|
||||
}
|
||||
catch (IDBExcept& ie)
|
||||
{
|
||||
@ -1916,7 +1949,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
||||
CalpontSystemCatalog::ROPair roPair;
|
||||
try
|
||||
{
|
||||
roPair = csc->tableRID( aTableName );
|
||||
roPair = csc->tableRID(aTableName);
|
||||
}
|
||||
catch (IDBExcept& ie)
|
||||
{
|
||||
@ -2238,7 +2271,7 @@ int ha_mcs_impl_discover_existence(const char* schema, const char* name)
|
||||
|
||||
try
|
||||
{
|
||||
const CalpontSystemCatalog::OID oid = csc->lookupTableOID(make_table(schema, name));
|
||||
const CalpontSystemCatalog::OID oid = csc->lookupTableOID(make_table(schema, name, lower_case_table_names));
|
||||
|
||||
if (oid)
|
||||
return 1;
|
||||
@ -2438,7 +2471,7 @@ int ha_mcs::impl_rnd_init(TABLE* table, const std::vector<COND*>& condStack)
|
||||
ti.csep->sessionID(sessionID);
|
||||
|
||||
if (thd->db.length)
|
||||
ti.csep->schemaName(thd->db.str);
|
||||
ti.csep->schemaName(thd->db.str, lower_case_table_names);
|
||||
|
||||
ti.csep->traceFlags(ci->traceFlags);
|
||||
ti.msTablePtr = table;
|
||||
@ -2629,7 +2662,7 @@ int ha_mcs::impl_rnd_init(TABLE* table, const std::vector<COND*>& condStack)
|
||||
|
||||
// populate coltypes here for table mode because tableband gives treeoid for dictionary column
|
||||
{
|
||||
CalpontSystemCatalog::RIDList oidlist = csc->columnRIDs(make_table(table->s->db.str, table->s->table_name.str), true);
|
||||
CalpontSystemCatalog::RIDList oidlist = csc->columnRIDs(make_table(table->s->db.str, table->s->table_name.str, lower_case_table_names), true);
|
||||
|
||||
if (oidlist.size() != num_attr)
|
||||
{
|
||||
@ -3180,7 +3213,7 @@ void ha_mcs_impl_start_bulk_insert(ha_rows rows, TABLE* table, bool is_cache_ins
|
||||
|
||||
try
|
||||
{
|
||||
colrids = csc->columnRIDs(tableName);
|
||||
colrids = csc->columnRIDs(tableName, false, lower_case_table_names);
|
||||
}
|
||||
catch (IDBExcept& ie)
|
||||
{
|
||||
@ -3591,7 +3624,7 @@ void ha_mcs_impl_start_bulk_insert(ha_rows rows, TABLE* table, bool is_cache_ins
|
||||
|
||||
try
|
||||
{
|
||||
CalpontSystemCatalog::ROPair roPair = csc->tableRID( tableName );
|
||||
CalpontSystemCatalog::ROPair roPair = csc->tableRID(tableName, lower_case_table_names);
|
||||
ci->tableOid = roPair.objnum;
|
||||
}
|
||||
catch (IDBExcept& ie)
|
||||
@ -4331,7 +4364,7 @@ int ha_mcs_impl_group_by_init(mcs_handler_info *handler_info, TABLE* table)
|
||||
csep->sessionID(sessionID);
|
||||
|
||||
if (group_hand->table_list->db.length)
|
||||
csep->schemaName(group_hand->table_list->db.str);
|
||||
csep->schemaName(group_hand->table_list->db.str, lower_case_table_names);
|
||||
|
||||
csep->traceFlags(ci->traceFlags);
|
||||
|
||||
@ -5086,7 +5119,7 @@ int ha_mcs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
||||
csep->sessionID(sessionID);
|
||||
|
||||
if (thd->db.length)
|
||||
csep->schemaName(thd->db.str);
|
||||
csep->schemaName(thd->db.str, lower_case_table_names);
|
||||
|
||||
csep->traceFlags(ci->traceFlags);
|
||||
|
||||
|
@ -450,8 +450,10 @@ void parsePartitionString(UDF_ARGS* args,
|
||||
string& errMsg,
|
||||
execplan::CalpontSystemCatalog::TableName tableName)
|
||||
{
|
||||
//@Bug 4695
|
||||
algorithm::to_lower(tableName.schema);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(tableName.schema);
|
||||
}
|
||||
|
||||
if (tableName.schema == "calpontsys")
|
||||
{
|
||||
@ -654,12 +656,17 @@ void partitionByValue_common(UDF_ARGS* args, // input
|
||||
column = (char*)(args->args[1]);
|
||||
}
|
||||
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schema);
|
||||
boost::algorithm::to_lower(table);
|
||||
}
|
||||
boost::algorithm::to_lower(column);
|
||||
|
||||
tableName.schema = schema;
|
||||
tableName.table = table;
|
||||
|
||||
//@Bug 4695
|
||||
algorithm::to_lower(tableName.schema);
|
||||
|
||||
if (tableName.schema == "calpontsys")
|
||||
{
|
||||
errMsg = IDBErrorInfo::instance()->errorMsg(SYSTABLE_PARTITION);
|
||||
@ -670,7 +677,7 @@ void partitionByValue_common(UDF_ARGS* args, // input
|
||||
{
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(tid2sid(current_thd->thread_id));
|
||||
csc->identity(execplan::CalpontSystemCatalog::FE);
|
||||
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column);
|
||||
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column, lower_case_table_names);
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
OID_t oid = csc->lookupOID(tcn);
|
||||
ct = csc->colType(oid);
|
||||
@ -1029,10 +1036,16 @@ extern "C"
|
||||
table = (char*)(args->args[0]);
|
||||
column = (char*)(args->args[1]);
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schema);
|
||||
boost::algorithm::to_lower(table);
|
||||
}
|
||||
boost::algorithm::to_lower(column);
|
||||
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(tid2sid(current_thd->thread_id));
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column);
|
||||
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column, lower_case_table_names);
|
||||
OID_t oid = csc->lookupOID(tcn);
|
||||
ct = csc->colType(oid);
|
||||
|
||||
@ -1735,9 +1748,16 @@ extern "C"
|
||||
column = (char*)(args->args[1]);
|
||||
}
|
||||
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(schema);
|
||||
boost::algorithm::to_lower(table);
|
||||
}
|
||||
boost::algorithm::to_lower(column);
|
||||
|
||||
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(tid2sid(current_thd->thread_id));
|
||||
csc->identity(CalpontSystemCatalog::FE);
|
||||
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column);
|
||||
CalpontSystemCatalog::TableColName tcn = make_tcn(schema, table, column, lower_case_table_names);
|
||||
OID_t oid = csc->lookupOID(tcn);
|
||||
ct = csc->colType(oid);
|
||||
|
||||
|
@ -88,14 +88,21 @@ void View::transform()
|
||||
continue;
|
||||
|
||||
string viewName = getViewName(table_ptr);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(viewName);
|
||||
}
|
||||
|
||||
if (table_ptr->derived)
|
||||
{
|
||||
SELECT_LEX* select_cursor = table_ptr->derived->first_select();
|
||||
FromSubQuery* fromSub = new FromSubQuery(gwi, select_cursor);
|
||||
string alias(table_ptr->alias.str);
|
||||
gwi.viewName = make_aliasview("", alias, table_ptr->belong_to_view->alias.str, "");
|
||||
algorithm::to_lower(alias);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
boost::algorithm::to_lower(alias);
|
||||
}
|
||||
gwi.viewName = make_aliasview("", alias, table_ptr->belong_to_view->alias.str, "", true, lower_case_table_names);
|
||||
fromSub->alias(alias);
|
||||
gwi.derivedTbList.push_back(SCSEP(fromSub->transform()));
|
||||
// set alias to both table name and alias name of the derived table
|
||||
@ -108,8 +115,8 @@ void View::transform()
|
||||
else if (table_ptr->view)
|
||||
{
|
||||
// for nested view, the view name is vout.vin... format
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName);
|
||||
gwi.viewName = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, viewName);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName, true, lower_case_table_names);
|
||||
gwi.viewName = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, viewName, true, lower_case_table_names);
|
||||
View* view = new View(*table_ptr->view->first_select_lex(), &gwi);
|
||||
view->viewName(gwi.viewName);
|
||||
gwi.viewList.push_back(view);
|
||||
@ -122,9 +129,9 @@ void View::transform()
|
||||
|
||||
// trigger system catalog cache
|
||||
if (columnStore)
|
||||
csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str), true);
|
||||
csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str, lower_case_table_names), true);
|
||||
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName, columnStore);
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName, columnStore, lower_case_table_names);
|
||||
gwi.tbList.push_back(tn);
|
||||
gwi.tableMap[tn] = make_pair(0, table_ptr);
|
||||
fParentGwip->tableMap[tn] = make_pair(0, table_ptr);
|
||||
|
@ -28,6 +28,9 @@ template <class T> bool isnan(T);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define INFINIDB_DEBUG
|
||||
//#define DEBUG_WALK_COND
|
||||
|
||||
#define MYSQL_SERVER 1 //needed for definition of struct THD in mysql_priv.h
|
||||
#define USE_CALPONT_REGEX
|
||||
|
||||
@ -45,7 +48,7 @@ template <class T> bool isnan(T);
|
||||
#ifndef ENABLED_DEBUG_SYNC
|
||||
#define ENABLED_DEBUG_SYNC
|
||||
#endif
|
||||
//#define INFINIDB_DEBUG
|
||||
|
||||
#define DBUG_ON 1
|
||||
#undef DBUG_OFF
|
||||
#else
|
||||
@ -73,6 +76,7 @@ template <class T> bool isnan(T);
|
||||
#include "derived_handler.h"
|
||||
#include "select_handler.h"
|
||||
#include "rpl_rli.h"
|
||||
#include "my_dbug.h"
|
||||
|
||||
// Now clean up the pollution as best we can...
|
||||
#undef min
|
||||
|
@ -151,7 +151,7 @@ static int is_columnstore_columns_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||
// So simply ignore the dropped table.
|
||||
try
|
||||
{
|
||||
column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true);
|
||||
column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true, lower_case_table_names);
|
||||
}
|
||||
catch (IDBExcept& ex)
|
||||
{
|
||||
|
@ -131,28 +131,35 @@ static int is_columnstore_tables_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||
}
|
||||
}
|
||||
|
||||
execplan::CalpontSystemCatalog::TableInfo tb_info = systemCatalogPtr->tableInfo((*it).second);
|
||||
std::string create_date = dataconvert::DataConvert::dateToString((*it).second.create_date);
|
||||
table->field[0]->store((*it).second.schema.c_str(), (*it).second.schema.length(), cs);
|
||||
table->field[1]->store((*it).second.table.c_str(), (*it).second.table.length(), cs);
|
||||
table->field[2]->store((*it).first);
|
||||
table->field[3]->store(create_date.c_str(), create_date.length(), cs);
|
||||
table->field[4]->store(tb_info.numOfCols);
|
||||
|
||||
if (tb_info.tablewithautoincr)
|
||||
try
|
||||
{
|
||||
table->field[5]->set_notnull();
|
||||
table->field[5]->store(systemCatalogPtr->nextAutoIncrValue((*it).second));
|
||||
execplan::CalpontSystemCatalog::TableInfo tb_info = systemCatalogPtr->tableInfo((*it).second);
|
||||
std::string create_date = dataconvert::DataConvert::dateToString((*it).second.create_date);
|
||||
table->field[0]->store((*it).second.schema.c_str(), (*it).second.schema.length(), cs);
|
||||
table->field[1]->store((*it).second.table.c_str(), (*it).second.table.length(), cs);
|
||||
table->field[2]->store((*it).first);
|
||||
table->field[3]->store(create_date.c_str(), create_date.length(), cs);
|
||||
table->field[4]->store(tb_info.numOfCols);
|
||||
|
||||
if (tb_info.tablewithautoincr)
|
||||
{
|
||||
table->field[5]->set_notnull();
|
||||
table->field[5]->store(systemCatalogPtr->nextAutoIncrValue((*it).second));
|
||||
}
|
||||
else
|
||||
{
|
||||
table->field[5]->set_null();
|
||||
}
|
||||
|
||||
table->field[5]->store(tb_info.tablewithautoincr);
|
||||
|
||||
if (schema_table_store_record(thd, table))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
table->field[5]->set_null();
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
|
||||
table->field[5]->store(tb_info.tablewithautoincr);
|
||||
|
||||
if (schema_table_store_record(thd, table))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user