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

MCOL-5021 Add a new function to CalpontSystemCatalog class,

isAUXColumnOID(), to check if a given OID is an auxilliary
column OID.
This commit is contained in:
Gagan Goel
2022-06-06 18:22:00 -04:00
parent 262cd5c501
commit ea1861fdb5
2 changed files with 75 additions and 0 deletions

View File

@@ -1241,6 +1241,14 @@ const CalpontSystemCatalog::ColType CalpontSystemCatalog::colType(const OID& Oid
ct.columnOID = Oid; ct.columnOID = Oid;
} }
if ((sysDataList.size() == 0) && isAUXColumnOID(Oid))
{
ct.colDataType = execplan::AUX_COL_DATATYPE;
ct.colWidth = execplan::AUX_COL_WIDTH;
ct.compressionType = execplan::AUX_COL_COMPRESSION_TYPE;
ct.columnOID = Oid;
}
// populate colinfomap cache and oidbitmap // populate colinfomap cache and oidbitmap
lk3.lock(); lk3.lock();
boost::mutex::scoped_lock lk2(fOIDmapLock); boost::mutex::scoped_lock lk2(fOIDmapLock);
@@ -3741,6 +3749,67 @@ CalpontSystemCatalog::OID CalpontSystemCatalog::tableAUXColumnOID(const TableNam
throw IDBExcept(ERR_TABLE_NOT_IN_CATALOG, args); throw IDBExcept(ERR_TABLE_NOT_IN_CATALOG, args);
} }
bool CalpontSystemCatalog::isAUXColumnOID(const OID& oid)
{
DEBUG << "Enter isAUXColumnOID" << endl;
checkSysCatVer();
// select auxcolumnoid from systable where auxcolumnoid = oid;
CalpontSelectExecutionPlan csep;
CalpontSelectExecutionPlan::ReturnedColumnList returnedColumnList;
CalpontSelectExecutionPlan::FilterTokenList filterTokenList;
CalpontSelectExecutionPlan::ColumnMap colMap;
SimpleColumn* c1 =
new SimpleColumn(CALPONT_SCHEMA + "." + SYSTABLE_TABLE + "." + AUXCOLUMNOID_COL, fSessionID);
SRCP srcp;
srcp.reset(c1);
colMap.insert(CMVT_(CALPONT_SCHEMA + "." + SYSTABLE_TABLE + "." + AUXCOLUMNOID_COL, srcp));
csep.columnMapNonStatic(colMap);
srcp.reset(c1->clone());
returnedColumnList.push_back(srcp);
csep.returnedCols(returnedColumnList);
// Filters
SimpleFilter* f1 =
new SimpleFilter(opeq, c1->clone(), new ConstantColumn((int64_t)oid, ConstantColumn::NUM));
filterTokenList.push_back(f1);
csep.filterTokenList(filterTokenList);
ostringstream oss;
oss << "select auxcolumnoid from systable where auxcolumnoid='" << oid
<< "' --isAUXColumnOID/";
csep.data(oss.str()); //@bug 6078. Log the statement
if (fIdentity == EC)
oss << "EC";
else
oss << "FE";
NJLSysDataList sysDataList;
try
{
getSysData(csep, sysDataList, SYSTABLE_TABLE);
}
catch (IDBExcept&)
{
throw;
}
catch (runtime_error& e)
{
throw runtime_error(e.what());
}
if (sysDataList.size() == 1)
return true;
return false;
}
#if 0 #if 0
const CalpontSystemCatalog::IndexNameList CalpontSystemCatalog::indexNames(const TableName& tableName) const CalpontSystemCatalog::IndexNameList CalpontSystemCatalog::indexNames(const TableName& tableName)
{ {

View File

@@ -647,6 +647,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
*/ */
const ROPair columnRID(const TableColName& tableColName, int lower_case_table_names = 0); const ROPair columnRID(const TableColName& tableColName, int lower_case_table_names = 0);
// TODO MCOL-5021
/** return the RID's of the columns for a table /** return the RID's of the columns for a table
* *
* returns a list of the RID's of the columns for a table * returns a list of the RID's of the columns for a table
@@ -665,6 +666,11 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
*/ */
OID tableAUXColumnOID(const TableName& tableName, int lower_case_table_names = 0); OID tableAUXColumnOID(const TableName& tableName, int lower_case_table_names = 0);
/** returns true if the given OID is the AUX
* column OID of the table.
*/
bool isAUXColumnOID(const OID& oid);
/** return the RID of the index for a table /** return the RID of the index for a table
* *
* returns the RID of the indexes for a table * returns the RID of the indexes for a table