1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-641 Basic support for multi-value inserts, and deletes.

This commit is contained in:
Gagan Goel
2020-02-17 19:52:05 -05:00
committed by Roman Nozdrin
parent 55afcd8890
commit 93170c3b31
11 changed files with 266 additions and 1551 deletions

View File

@ -1550,17 +1550,20 @@ void DDLPackageProcessor::updateSyscolumns(execplan::CalpontSystemCatalog::SCN t
if (result.result != NO_ERROR)
return;
WriteEngine::ColStructList colStructs;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
//std::vector<ColStruct> colStructs;
WriteEngine::ColStruct colStruct;
execplan::CalpontSystemCatalog::ColType colType;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryValueList dctnryValueList;
//Build column structure for COLUMNPOS_COL
colStruct.dataOid = OID_SYSCOLUMN_COLUMNPOS;
colStruct.colWidth = 4;
colType.columnOID = colStruct.dataOid = OID_SYSCOLUMN_COLUMNPOS;
colType.colWidth = colStruct.colWidth = 4;
colStruct.tokenFlag = false;
colStruct.colDataType = CalpontSystemCatalog::INT;
colType.colDataType = colStruct.colDataType = CalpontSystemCatalog::INT;
colStructs.push_back(colStruct);
cscColTypeList.push_back(colType);
int error;
std::string err;
std::vector<void*> colOldValuesList1;
@ -1568,7 +1571,7 @@ void DDLPackageProcessor::updateSyscolumns(execplan::CalpontSystemCatalog::SCN t
try
{
//@Bug 3051 use updateColumnRecs instead of updateColumnRec to use different value for diffrent rows.
if (NO_ERROR != (error = fWriteEngine.updateColumnRecs( txnID, colStructs, colValuesList, ridList )))
if (NO_ERROR != (error = fWriteEngine.updateColumnRecs( txnID, cscColTypeList, colStructs, colValuesList, ridList )))
{
// build the logging message
WErrorCodes ec;

View File

@ -478,7 +478,7 @@ protected:
{
if (((colType.colDataType == execplan::CalpontSystemCatalog::CHAR) && (colType.colWidth > 8))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::VARCHAR) && (colType.colWidth > 7))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::DECIMAL) && (colType.precision > 18))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::DECIMAL) && (colType.precision > 38))
|| (colType.colDataType == execplan::CalpontSystemCatalog::VARBINARY)
|| (colType.colDataType == execplan::CalpontSystemCatalog::BLOB)
|| (colType.colDataType == execplan::CalpontSystemCatalog::TEXT))

View File

@ -286,9 +286,7 @@ inline bool isEmptyVal<16>(uint8_t type, const uint8_t* ival) // For BINARY
{
const uint64_t* val = reinterpret_cast<const uint64_t*>(ival);
// WIP ugly speed hack
return (((val[0] == joblist::BINARYEMPTYROW) && (val[1] == joblist::BINARYEMPTYROW))
|| ((val[0] == joblist::BIGINTEMPTYROW) && (val[1] == joblist::BIGINTEMPTYROW)))
;
return ((val[0] == joblist::BINARYEMPTYROW) && (val[1] == joblist::BINARYEMPTYROW));
}

View File

@ -140,6 +140,7 @@ uint8_t WE_DDLCommandProc::writeSystable(ByteStream& bs, std::string& err)
WriteEngine::ColTuple colTuple;
WriteEngine::ColStruct colStruct;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::ColTupleList colTuples;
WriteEngine::dictStr dctColTuples;
WriteEngine::DctnryStruct dctnryStruct;
@ -255,6 +256,7 @@ uint8_t WE_DDLCommandProc::writeSystable(ByteStream& bs, std::string& err)
}
colStructs.push_back(colStruct);
cscColTypeList.push_back(column.colType);
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
@ -293,7 +295,7 @@ uint8_t WE_DDLCommandProc::writeSystable(ByteStream& bs, std::string& err)
// TODO: This may be redundant
static boost::mutex dbrmMutex;
boost::mutex::scoped_lock lk(dbrmMutex);
error = fWEWrapper.insertColumnRec_SYS(txnID, colStructs, colValuesList,
error = fWEWrapper.insertColumnRec_SYS(txnID, cscColTypeList, colStructs, colValuesList,
dctnryStructList, dctnryValueList, SYSCOLUMN_BASE);
if (error != WriteEngine::NO_ERROR)
@ -392,6 +394,7 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err
WriteEngine::ColTuple colTuple;
WriteEngine::ColStruct colStruct;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::ColTupleList colTuples;
WriteEngine::dictStr dctColTuples;
WriteEngine::DctnryStruct dctnryStruct;
@ -702,6 +705,7 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err
{
colStructs.push_back(colStruct);
dctnryStructList.push_back (dctnryStruct);
cscColTypeList.push_back(column.colType);
}
colList[i].push_back(colTuple);
@ -733,7 +737,7 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err
}
//fWEWrapper.setDebugLevel(WriteEngine::DEBUG_3);
error = fWEWrapper.insertColumnRec_SYS(txnID, colStructs, colValuesList,
error = fWEWrapper.insertColumnRec_SYS(txnID, cscColTypeList, colStructs, colValuesList,
dctnryStructList, dctnryValueList, SYSCOLUMN_BASE);
if (idbdatafile::IDBPolicy::useHdfs())
@ -819,6 +823,7 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err)
WriteEngine::ColStruct colStruct;
WriteEngine::ColTuple colTuple;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::ColTupleList colTuples;
WriteEngine::DctColTupleList dctColTuples;
WriteEngine::ColValueList colValuesList;
@ -1091,6 +1096,7 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err)
colStructs.push_back(colStruct);
dctnryStructList.push_back (dctnryStruct);
cscColTypeList.push_back(column.colType);
colList[i].push_back(colTuple);
//colList.push_back(WriteEngine::ColTupleList());
//colList.back().push_back(colTuple);
@ -1118,7 +1124,7 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err)
fWEWrapper.startTransaction(txnID);
int rc1 = 0;
error = fWEWrapper.insertColumnRec_SYS(txnID, colStructs, colValuesList,
error = fWEWrapper.insertColumnRec_SYS(txnID, cscColTypeList, colStructs, colValuesList,
dctnryStructList, dctnryValueList, SYSCOLUMN_BASE);
if (idbdatafile::IDBPolicy::useHdfs())
@ -1368,7 +1374,9 @@ uint8_t WE_DDLCommandProc::deleteSyscolumn(ByteStream& bs, std::string& err)
WriteEngine::ColStruct colStruct;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<void*> colValuesList;
WriteEngine::RIDList ridList;
std::vector<WriteEngine::RIDList> ridLists;
@ -1403,17 +1411,19 @@ uint8_t WE_DDLCommandProc::deleteSyscolumn(ByteStream& bs, std::string& err)
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
colStructs.push_back(colStruct);
cscColTypeList.push_back(column.colType);
++column_iterator;
}
colExtentsStruct.push_back(colStructs);
colExtentsColType.push_back(cscColTypeList);
ridLists.push_back(ridList);
if (0 != colStructs.size() && 0 != ridLists[0].size())
{
int error = fWEWrapper.deleteRow(txnID, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int error = fWEWrapper.deleteRow(txnID, colExtentsColType, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int rc1 = 0;
@ -1508,7 +1518,9 @@ uint8_t WE_DDLCommandProc::deleteSyscolumnRow(ByteStream& bs, std::string& err)
WriteEngine::ColStruct colStruct;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<void*> colValuesList;
WriteEngine::RIDList ridList;
std::vector<WriteEngine::RIDList> ridLists;
@ -1537,17 +1549,20 @@ uint8_t WE_DDLCommandProc::deleteSyscolumnRow(ByteStream& bs, std::string& err)
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
colStructs.push_back(colStruct);
cscColTypeList.push_back(column.colType);
++column_iterator;
}
colExtentsStruct.push_back(colStructs);
colExtentsColType.push_back(cscColTypeList);
ridLists.push_back(ridList);
if (0 != colStructs.size() && 0 != ridLists[0].size())
{
int error = fWEWrapper.deleteRow(txnID, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int error = fWEWrapper.deleteRow(txnID, colExtentsColType, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int rc1 = 0;
if (idbdatafile::IDBPolicy::useHdfs())
@ -1644,7 +1659,9 @@ uint8_t WE_DDLCommandProc::deleteSystable(ByteStream& bs, std::string& err)
WriteEngine::ColStruct colStruct;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<void*> colValuesList;
WriteEngine::RIDList ridList;
std::vector<WriteEngine::RIDList> ridLists;
@ -1672,17 +1689,20 @@ uint8_t WE_DDLCommandProc::deleteSystable(ByteStream& bs, std::string& err)
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
colStructs.push_back(colStruct);
cscColTypeList.push_back(column.colType);
++column_iterator;
}
colExtentsStruct.push_back(colStructs);
colExtentsColType.push_back(cscColTypeList);
ridLists.push_back(ridList);
if (0 != colStructs.size() && 0 != ridLists[0].size())
{
int error = fWEWrapper.deleteRow(txnID, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int error = fWEWrapper.deleteRow(txnID, colExtentsColType, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int rc1 = 0;
if (idbdatafile::IDBPolicy::useHdfs())
@ -1755,7 +1775,9 @@ uint8_t WE_DDLCommandProc::deleteSystables(ByteStream& bs, std::string& err)
systemCatalogPtr->identity(CalpontSystemCatalog::EC);
WriteEngine::ColStruct colStruct;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<void*> colValuesList;
WriteEngine::RIDList ridList;
std::vector<WriteEngine::RIDList> ridLists;
@ -1804,16 +1826,19 @@ uint8_t WE_DDLCommandProc::deleteSystables(ByteStream& bs, std::string& err)
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
colStructs.push_back(colStruct);
cscColTypeList.push_back(column.colType);
++column_iterator;
}
colExtentsStruct.push_back(colStructs);
colExtentsColType.push_back(cscColTypeList);
ridLists.push_back(ridList);
{
int error = fWEWrapper.deleteRow(txnID, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int error = fWEWrapper.deleteRow(txnID, colExtentsColType, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int rc1 = 0;
if (idbdatafile::IDBPolicy::useHdfs())
@ -1867,7 +1892,9 @@ uint8_t WE_DDLCommandProc::deleteSystables(ByteStream& bs, std::string& err)
CalpontSystemCatalog::RIDList colRidList = systemCatalogPtr->columnRIDs(userTableName);
colStructs.clear();
cscColTypeList.clear();
colExtentsStruct.clear();
colExtentsColType.clear();
colValuesList.clear();
ridList.clear();
ridLists.clear();
@ -1902,17 +1929,20 @@ uint8_t WE_DDLCommandProc::deleteSystables(ByteStream& bs, std::string& err)
colStructs.push_back(colStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column.colType);
//oidsToFlush.push_back(colStruct.dataOid);
++column_iterator;
}
colExtentsStruct.push_back(colStructs);
colExtentsColType.push_back(cscColTypeList);
ridLists.push_back(ridList);
if (0 != colStructs.size() && 0 != ridLists[0].size())
{
int error = fWEWrapper.deleteRow(txnID, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int error = fWEWrapper.deleteRow(txnID, colExtentsColType, colExtentsStruct, colValuesList, ridLists, SYSCOLUMN_BASE);
int rc1 = 0;
if (idbdatafile::IDBPolicy::useHdfs())
@ -2035,6 +2065,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnAuto(ByteStream& bs, std::string& err)
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
std::map<uint32_t, uint32_t> oids;
//std::vector<BRM::OID_t> oidsToFlush;
@ -2075,6 +2106,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnAuto(ByteStream& bs, std::string& err)
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
dctnryStructList.push_back(dctnryStruct);
cscColTypeList.push_back(column.colType);
for (unsigned int i = 0; i < roList.size(); i++)
{
@ -2083,6 +2115,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnAuto(ByteStream& bs, std::string& err)
colValuesList.push_back(aColList);
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
std::vector<extentInfo> extentsinfo;
extentInfo aExtentinfo;
@ -2125,13 +2158,14 @@ uint8_t WE_DDLCommandProc::updateSyscolumnAuto(ByteStream& bs, std::string& err)
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
if (idbdatafile::IDBPolicy::useHdfs())
fWEWrapper.startTransaction(txnID);
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -2226,6 +2260,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnNextvalCol(ByteStream& bs, std::string
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
std::map<uint32_t, uint32_t> oids;
//std::vector<BRM::OID_t> oidsToFlush;
@ -2259,6 +2294,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnNextvalCol(ByteStream& bs, std::string
//oidsToFlush.push_back(colStruct.dataOid);
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
cscColTypeList.push_back(column.colType);
for (unsigned int i = 0; i < roList.size(); i++)
{
@ -2296,6 +2332,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnNextvalCol(ByteStream& bs, std::string
std::vector<WriteEngine::RIDList> ridLists;
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
ridLists.push_back(ridList);
@ -2314,13 +2351,14 @@ uint8_t WE_DDLCommandProc::updateSyscolumnNextvalCol(ByteStream& bs, std::string
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
fWEWrapper.setTransId(txnID);
fWEWrapper.startTransaction(txnID);
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -2396,6 +2434,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
tableName.schema = CALPONT_SCHEMA;
tableName.table = SYSCOLUMN_TABLE;
@ -2463,6 +2502,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
cscColTypeList.push_back(column.colType);
for (unsigned int i = 0; i < roList.size(); i++)
{
@ -2485,6 +2525,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
std::vector<extentInfo> extentsinfo;
extentInfo aExtentinfo;
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
for (unsigned int i = 0; i < roList.size(); i++)
@ -2521,6 +2562,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
@ -2529,7 +2571,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
fWEWrapper.setBulkFlag(false);
fWEWrapper.startTransaction(txnID);
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -2625,6 +2667,7 @@ uint8_t WE_DDLCommandProc::updateSystableAuto(ByteStream& bs, std::string& err)
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
std::map<uint32_t, uint32_t> oids;
//std::vector<BRM::OID_t> oidsToFlush;
@ -2658,12 +2701,14 @@ uint8_t WE_DDLCommandProc::updateSystableAuto(ByteStream& bs, std::string& err)
}
colStructs.push_back(colStruct);
cscColTypeList.push_back(column.colType);
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
dctnryStructList.push_back(dctnryStruct);
aColList.push_back(colTuple);
colValuesList.push_back(aColList);
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
@ -2701,6 +2746,7 @@ uint8_t WE_DDLCommandProc::updateSystableAuto(ByteStream& bs, std::string& err)
}
colExtentsStruct.push_back(colStructs);
colExtentsColType.push_back(cscColTypeList);
dctnryExtentsStruct.push_back(dctnryStructList);
}
@ -2710,7 +2756,7 @@ uint8_t WE_DDLCommandProc::updateSystableAuto(ByteStream& bs, std::string& err)
fWEWrapper.setBulkFlag(false);
fWEWrapper.startTransaction(txnID);
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -2804,6 +2850,7 @@ uint8_t WE_DDLCommandProc::updateSystableTablename(ByteStream& bs, std::string&
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
std::map<uint32_t, uint32_t> oids;
//std::vector<BRM::OID_t> oidsToFlush;
@ -2853,6 +2900,7 @@ uint8_t WE_DDLCommandProc::updateSystableTablename(ByteStream& bs, std::string&
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -2865,6 +2913,7 @@ uint8_t WE_DDLCommandProc::updateSystableTablename(ByteStream& bs, std::string&
colValuesList.push_back(aColList);
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
dctColList = dictTuple;
dctRowList.push_back(dctColList);
@ -2900,6 +2949,7 @@ uint8_t WE_DDLCommandProc::updateSystableTablename(ByteStream& bs, std::string&
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
@ -2908,7 +2958,7 @@ uint8_t WE_DDLCommandProc::updateSystableTablename(ByteStream& bs, std::string&
fWEWrapper.setBulkFlag(false);
fWEWrapper.startTransaction(txnID);
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -3032,6 +3082,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
std::map<uint32_t, uint32_t> oids;
//std::vector<BRM::OID_t> oidsToFlush;
@ -3090,6 +3141,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -3102,6 +3154,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
colValuesList.push_back(aColList);
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
dctColList = dictTuple;
dctRowList.push_back(dctColList);
@ -3137,6 +3190,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
@ -3145,7 +3199,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
fWEWrapper.setBulkFlag(false);
fWEWrapper.startTransaction(txnID);
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -3207,6 +3261,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
colValuesList.clear();
aColList.clear();
colStructs.clear();
cscColTypeList.clear();
colOldValuesList.clear();
oids.clear();
tableName.schema = CALPONT_SCHEMA;
@ -3287,6 +3342,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
cscColTypeList.push_back(column.colType);
for (unsigned int i = 0; i < roList.size(); i++)
{
@ -3307,6 +3363,7 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
dctnryValueList.push_back(dctRowList);
extentsinfo.clear();
colExtentsStruct.clear();
colExtentsColType.clear();
dctnryExtentsStruct.clear();
oid = 1021;
@ -3344,10 +3401,11 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
rc = fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
rc = fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE);
if (rc != NO_ERROR)
@ -3481,11 +3539,13 @@ uint8_t WE_DDLCommandProc::updateSyscolumnColumnposCol(messageqcpp::ByteStream&
WriteEngine::ColStruct colStruct;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryValueList dctnryValueList;
WriteEngine::CSCTypesList cscColTypeList;
CalpontSystemCatalog::ColType colType;
//Build column structure for COLUMNPOS_COL
colStruct.dataOid = OID_SYSCOLUMN_COLUMNPOS;
colStruct.colWidth = 4;
colType.columnOID = colStruct.dataOid = OID_SYSCOLUMN_COLUMNPOS;
colType.colWidth = colStruct.colWidth = 4;
colStruct.tokenFlag = false;
colStruct.colDataType = CalpontSystemCatalog::INT;
colType.colDataType = colStruct.colDataType = CalpontSystemCatalog::INT;
colStruct.fColDbRoot = dbRoot;
if (idbdatafile::IDBPolicy::useHdfs())
@ -3494,9 +3554,10 @@ uint8_t WE_DDLCommandProc::updateSyscolumnColumnposCol(messageqcpp::ByteStream&
}
colStructs.push_back(colStruct);
cscColTypeList.push_back(colType);
oids[colStruct.dataOid] = colStruct.dataOid;
//oidsToFlush.push_back(colStruct.dataOid);
rc = fWEWrapper.updateColumnRecs( txnID, colStructs, colValuesList, ridList, SYSCOLUMN_BASE );
rc = fWEWrapper.updateColumnRecs( txnID, cscColTypeList, colStructs, colValuesList, ridList, SYSCOLUMN_BASE );
}
int rc1 = 0;
@ -3592,7 +3653,7 @@ uint8_t WE_DDLCommandProc::fillNewColumn(ByteStream& bs, std::string& err)
std::map<uint32_t, uint32_t> oids;
oids[dataOid] = dataOid;
oids[refColOID] = refColOID;
rc = fWEWrapper.fillColumn(txnID, dataOid, dataType, dataWidth, defaultVal, refColOID, refColDataType,
rc = fWEWrapper.fillColumn(txnID, dataOid, colType, defaultVal, refColOID, refColDataType,
refColWidth, refCompressionType, isNULL, compressionType, defaultValStr, dictOid, autoincrement);
if ( rc != 0 )
@ -4163,6 +4224,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnSetDefault(messageqcpp::ByteStream& bs
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList1;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryValueList dctnryValueList;
@ -4268,6 +4330,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnSetDefault(messageqcpp::ByteStream& bs
colStructs.push_back(colStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -4299,6 +4362,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnSetDefault(messageqcpp::ByteStream& bs
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<WriteEngine::RIDList> ridLists;
ridLists.push_back(ridList);
@ -4329,11 +4393,12 @@ uint8_t WE_DDLCommandProc::updateSyscolumnSetDefault(messageqcpp::ByteStream& bs
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
if (NO_ERROR != fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
if (NO_ERROR != fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE))
{
err = "WE: Update failed on: " + atableName.table;
@ -4439,6 +4504,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
WriteEngine::ColValueList colValuesList;
WriteEngine::ColTupleList aColList1;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
std::vector<void*> colOldValuesList;
std::map<uint32_t, uint32_t> oids;
//std::vector<BRM::OID_t> oidsToFlush;
@ -4557,6 +4623,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
colStructs.push_back(colStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column1.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -4594,6 +4661,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
colStructs.push_back(colStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column2.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -4627,6 +4695,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
colStructs.push_back(colStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column3.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -4661,6 +4730,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
colStructs.push_back(colStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column4.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -4770,6 +4840,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
oids[colStruct.dataOid] = colStruct.dataOid;
cscColTypeList.push_back(column5.colType);
//oidsToFlush.push_back(colStruct.dataOid);
if (dctnryStruct.dctnryOid > 0)
@ -4797,6 +4868,7 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
dctRowList.push_back(dctColList);
dctnryValueList.push_back(dctRowList);
std::vector<WriteEngine::ColStructList> colExtentsStruct;
std::vector<WriteEngine::CSCTypesList> colExtentsColType;
std::vector<WriteEngine::DctnryStructList> dctnryExtentsStruct;
std::vector<WriteEngine::RIDList> ridLists;
ridLists.push_back(ridList);
@ -4828,10 +4900,11 @@ uint8_t WE_DDLCommandProc::updateSyscolumnRenameColumn(messageqcpp::ByteStream&
colExtentsStruct.push_back(colStructs);
dctnryExtentsStruct.push_back(dctnryStructList);
colExtentsColType.push_back(cscColTypeList);
}
// call the write engine to update the row
if (NO_ERROR != fWEWrapper.updateColumnRec(txnID, colExtentsStruct, colValuesList, colOldValuesList,
if (NO_ERROR != fWEWrapper.updateColumnRec(txnID, colExtentsColType, colExtentsStruct, colValuesList, colOldValuesList,
ridLists, dctnryExtentsStruct, dctnryValueList, SYSCOLUMN_BASE))
{
err = "WE: Update failed on: " + atableName.table;

View File

@ -116,7 +116,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
RowList rows = tablePtr->get_RowList();
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypes;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryValueList dctnryValueList;
WriteEngine::ColValueList colValuesList;
@ -141,7 +141,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
Row* rowPtr = rows.at(0);
ColumnList columns = rowPtr->get_ColumnList();
unsigned int numcols = rowPtr->get_NumberOfColumns();
cscColTypes.reserve(numcols);
cscColTypeList.reserve(numcols);
// WIP
// We presume that DictCols number is low
colStructs.reserve(numcols);
@ -159,7 +159,6 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
CalpontSystemCatalog::ColType colType;
colType = systemCatalogPtr->colType(oid);
cscColTypes.push_back(colType);
WriteEngine::ColStruct colStruct;
colStruct.fColDbRoot = dbroot;
WriteEngine::DctnryStruct dctnryStruct;
@ -169,7 +168,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
colStruct.fCompressionType = colType.compressionType;
// Token
if ( isDictCol(colType) )
if (isDictCol(colType) )
{
// WIP Hardcoded value
colStruct.colWidth = 8;
@ -199,6 +198,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
cscColTypeList.push_back(colType);
++column_iterator;
}
@ -538,7 +538,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
if (colValuesList[0].size() > 0)
{
if (NO_ERROR !=
(error = fWEWrapper.insertColumnRec_Single(txnid.id, cscColTypes, colStructs, colValuesList, dctnryStructList, dicStringList, tableRoPair.objnum)))
(error = fWEWrapper.insertColumnRec_Single(txnid.id, cscColTypeList, colStructs, colValuesList, dctnryStructList, dicStringList, tableRoPair.objnum)))
{
if (error == ERR_BRM_DEAD_LOCK)
{
@ -842,6 +842,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std::
bool isInsertSelect = insertPkg.get_isInsertSelect();
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryValueList dctnryValueList;
WriteEngine::ColValueList colValuesList;
@ -1046,7 +1047,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std::
colStruct.fCompressionType = colType.compressionType;
// Token
if ( isDictCol(colType) )
if (isDictCol(colType) )
{
colStruct.colWidth = 8;
colStruct.tokenFlag = true;
@ -1075,6 +1076,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std::
colStructs.push_back(colStruct);
dctnryStructList.push_back(dctnryStruct);
cscColTypeList.push_back(colType);
++column_iterator;
}
@ -1324,7 +1326,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std::
*/
if (NO_ERROR !=
(error = fWEWrapper.insertColumnRecs(txnid.id, colStructs, colValuesList, dctnryStructList, dicStringList,
(error = fWEWrapper.insertColumnRecs(txnid.id, cscColTypeList, colStructs, colValuesList, dctnryStructList, dicStringList,
dbRootExtTrackerVec, 0, bFirstExtentOnThisPM, isInsertSelect, isAutocommitOn, roPair.objnum, fIsFirstBatchPm)))
{
if (error == ERR_BRM_DEAD_LOCK)
@ -2691,6 +2693,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
WriteEngine::ColStruct colStruct;
WriteEngine::ColValueList colValueList;
WriteEngine::RIDList rowIDLists;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryStruct dctnryStruct;
@ -2858,7 +2861,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
colStruct.fCompressionType = colType.compressionType;
tableColName.column = columnsUpdated[j]->get_Name();
if ( !ridsFetched)
if (!ridsFetched)
{
// querystats
uint64_t relativeRID = 0;
@ -3806,12 +3809,13 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
colStructList.push_back(colStruct);
colValueList.push_back (colTupleList);
cscColTypeList.push_back(colType);
} //end of bulding values and column structure.
//timer.stop("fetch values");
if (rowIDLists.size() > 0)
{
error = fWEWrapper.updateColumnRecs(txnId, colStructList, colValueList, rowIDLists, tableRO.objnum);
error = fWEWrapper.updateColumnRecs(txnId, cscColTypeList, colStructList, colValueList, rowIDLists, tableRO.objnum);
}
if (error != NO_ERROR)
@ -4116,13 +4120,14 @@ uint8_t WE_DMLCommandProc::processDelete(messageqcpp::ByteStream& bs,
for (uint32_t j = 0; j < row.getColumnCount(); j++)
{
preBlkNums[j] = -1;
colWidth[j] = (row.getColumnWidth(j) >= 8 ? 8 : row.getColumnWidth(j));
colWidth[j] = (row.getColumnWidth(j) >= 16 ? 16 : row.getColumnWidth(j));
}
//Get the file information from rowgroup
dbRoot = rowGroups[txnId]->getDBRoot();
rowGroups[txnId]->getLocation(&partition, &segment, &extentNum, &blockNum);
WriteEngine::ColStructList colStructList;
WriteEngine::CSCTypesList cscColTypeList;
WriteEngine::ColStruct colStruct;
colStruct.fColPartition = partition;
colStruct.fColSegment = segment;
@ -4158,7 +4163,9 @@ uint8_t WE_DMLCommandProc::processDelete(messageqcpp::ByteStream& bs,
colStruct.tokenFlag = false;
colStruct.fCompressionType = colType.compressionType;
if (colType.colWidth > 8) //token
if (colType.colWidth > 8 &&
!(colType.colDataType == CalpontSystemCatalog::DECIMAL ||
colType.colDataType == CalpontSystemCatalog::UDECIMAL)) //token
{
colStruct.colWidth = 8;
colStruct.tokenFlag = true;
@ -4170,7 +4177,8 @@ uint8_t WE_DMLCommandProc::processDelete(messageqcpp::ByteStream& bs,
colStruct.colDataType = colType.colDataType;
colStructList.push_back( colStruct );
colStructList.push_back(colStruct);
cscColTypeList.push_back(colType);
}
}
catch (exception& ex)
@ -4181,13 +4189,15 @@ uint8_t WE_DMLCommandProc::processDelete(messageqcpp::ByteStream& bs,
}
std::vector<ColStructList> colExtentsStruct;
std::vector<CSCTypesList> colExtentsColType;
std::vector<void*> colOldValueList;
std::vector<RIDList> ridLists;
colExtentsStruct.push_back(colStructList);
colExtentsColType.push_back(cscColTypeList);
ridLists.push_back(rowIDList);
int error = 0;
error = fWEWrapper.deleteRow( txnId, colExtentsStruct, colOldValueList, ridLists, roPair.objnum );
error = fWEWrapper.deleteRow(txnId, colExtentsColType, colExtentsStruct, colOldValueList, ridLists, roPair.objnum);
if (error != NO_ERROR)
{

View File

@ -110,8 +110,8 @@ private:
{
if (((colType.colDataType == execplan::CalpontSystemCatalog::CHAR) && (colType.colWidth > 8))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::VARCHAR) && (colType.colWidth > 7))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::DECIMAL) && (colType.precision > 65))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::UDECIMAL) && (colType.precision > 65))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::DECIMAL) && (colType.precision > 38))
|| ((colType.colDataType == execplan::CalpontSystemCatalog::UDECIMAL) && (colType.precision > 38))
|| (colType.colDataType == execplan::CalpontSystemCatalog::VARBINARY)
|| (colType.colDataType == execplan::CalpontSystemCatalog::BLOB)
|| (colType.colDataType == execplan::CalpontSystemCatalog::TEXT))

View File

@ -82,6 +82,7 @@ bool BlockOp::calculateRowId(
* RETURN:
* emptyVal - the value of empty row
***********************************************************/
// TODO MCOL-641 Add support here
uint64_t BlockOp::getEmptyRowValue(
const CalpontSystemCatalog::ColDataType colDataType, const int width ) const
{
@ -138,8 +139,10 @@ uint64_t BlockOp::getEmptyRowValue(
emptyVal = joblist::SMALLINTEMPTYROW;
else if ( width <= 4 )
emptyVal = joblist::INTEMPTYROW;
else
else if ( width <= 8 )
emptyVal = joblist::BIGINTEMPTYROW;
else
emptyVal = joblist::BINARYEMPTYROW;
break;

View File

@ -328,6 +328,7 @@ void Convertor::mapErrnoToString(int errNum, std::string& errString)
* none
******************************************************************************/
/* static */
// TODO MCOL-641
void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType,
ColType& internalType, bool isToken)
{
@ -778,7 +779,6 @@ int Convertor::getCorrectRowWidth(CalpontSystemCatalog::ColDataType dataType, in
newWidth = 8;
else
newWidth = 16;
break;
case CalpontSystemCatalog::DATE:

View File

@ -85,6 +85,7 @@ ColumnOp::~ColumnOp()
* NO_ERROR if success
* rowIdArray - allocation of the row id left here
***********************************************************/
// TODO MCOL-641 add support here
int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
Column& column, uint64_t totalRow, RID* rowIdArray, HWM& hwm, bool& newExtent, uint64_t& rowsLeft, HWM& newHwm,
bool& newFile, ColStructList& newColStructList, DctnryStructList& newDctnryStructList, std::vector<boost::shared_ptr<DBRootExtentTracker> >& dbRootExtentTrackers,
@ -126,6 +127,9 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
unsigned char buf[BYTE_PER_BLOCK];
unsigned char* curVal;
int64_t emptyVal = getEmptyRowValue(column.colDataType, column.colWidth); // Seems is ok have it here and just once
// TODO MCOL-641 consolidate the emptyvalue logic
//__int128 bigEmptyVal;
//dataconvert::DataConvert::uint128Max(bigEmptyVal);
if (useStartingExtent)
{
@ -1455,6 +1459,7 @@ void ColumnOp::initColumn(Column& column) const
// It is called at just 4 places on allocRowId() but all the time inside extend scanning loops
// WIP Template this method
// TODO MCOL-641 Add support here.
inline bool ColumnOp::isEmptyRow(uint64_t* curVal, uint64_t emptyVal, const int colWidth)
{
switch(colWidth){
@ -1742,6 +1747,7 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
break;
}
// TODO MCOL-641 do we need support here?
if (bDelete)
{
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
@ -1793,6 +1799,13 @@ int ColumnOp::writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridLis
uint64_t emptyVal;
int rc = NO_ERROR;
int w = 0, incr = 8;
if (curCol.colType == WriteEngine::WR_BINARY)
w = incr = curCol.colWidth;
else
w = curCol.colWidth > 8 ? 8 : curCol.colWidth;
while (!bExit)
{
curRowId = ridList[i];
@ -1922,12 +1935,25 @@ int ColumnOp::writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridLis
if (bDelete)
{
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
pVal = &emptyVal;
if (curCol.colType != WriteEngine::WR_BINARY)
{
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
pVal = &emptyVal;
}
else
{
// fix this
uint128_t bigEmptyVal;
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
*(reinterpret_cast<uint64_t*>(&bigEmptyVal)) = emptyVal;
*(reinterpret_cast<uint64_t*>(&bigEmptyVal) + 1) = emptyVal;
//dataconvert::DataConvert::uint128Max(bigEmptyVal);
pVal = &bigEmptyVal;
}
}
// This is the write stuff
for(int b = 0, w = curCol.colWidth > 8 ? 8 : curCol.colWidth; b < curCol.colWidth; b += 8) //FIXME for no loop
for (int b = 0; b < curCol.colWidth; b += incr) //FIXME for no loop
writeBufValue(dataBuf + dataBio + b, pVal, w);
i++;

File diff suppressed because it is too large Load Diff

View File

@ -163,12 +163,6 @@ public:
ColTupleList& curTupleList, void* valArray,
bool bFromList = true) ;
// WIP legacy
EXPORT void convertValArray(const size_t totalRow,
const ColType colType,
ColTupleList& curTupleList, void* valArray,
bool bFromList = true) ;
/**
* @brief Create a column, include object ids for column data and bitmap files
* @param dataOid column datafile object id
@ -195,8 +189,8 @@ public:
* @param refColDataType Data-type of the referecne column
* @param refColWidth Width of the reference column
*/
EXPORT int fillColumn(const TxnID& txnid, const OID& dataOid, execplan::CalpontSystemCatalog::ColDataType dataType,
int dataWidth, ColTuple defaultVal,
EXPORT int fillColumn(const TxnID& txnid, const OID& dataOid, const execplan::CalpontSystemCatalog::ColType& colType,
ColTuple defaultVal,
const OID& refColOID, execplan::CalpontSystemCatalog::ColDataType refColDataType,
int refColWidth, int refCompressionType, bool isNULL, int compressionType,
const std::string& defaultValStr, const OID& dictOid = 0, bool autoincrement = false);
@ -230,7 +224,7 @@ public:
* @param colOldValueList column old values list (return value)
* @param rowIdList row id list
*/
EXPORT int deleteRow(const TxnID& txnid, std::vector<ColStructList>& colExtentsStruct,
EXPORT int deleteRow(const TxnID& txnid, const std::vector<CSCTypesList>& colExtentsColType, std::vector<ColStructList>& colExtentsStruct,
std::vector<void*>& colOldValueList, std::vector<RIDList>& ridLists, const int32_t tableOid);
/**
@ -326,6 +320,7 @@ public:
* @param isFirstBatchPm to track if this batch is first batch for this PM.
*/
EXPORT int insertColumnRecs(const TxnID& txnid,
const CSCTypesList& cscColTypeList,
ColStructList& colStructList,
ColValueList& colValueList,
DctnryStructList& dctnryStructList,
@ -359,6 +354,7 @@ public:
* @param dicStringListt dictionary values list
*/
EXPORT int insertColumnRec_SYS(const TxnID& txnid,
const CSCTypesList& cscColTypeList,
ColStructList& colStructList,
ColValueList& colValueList,
DctnryStructList& dctnryStructList,
@ -372,7 +368,7 @@ public:
* @param dicStringListt dictionary values list
*/
EXPORT int insertColumnRec_Single(const TxnID& txnid,
CSCTypesList& cscColTypesList,
const CSCTypesList& cscColTypeList,
ColStructList& colStructList,
ColValueList& colValueList,
DctnryStructList& dctnryStructList,
@ -550,6 +546,7 @@ public:
* @param ridList row id list
*/
EXPORT int updateColumnRec(const TxnID& txnid,
const std::vector<CSCTypesList>& colExtentsColType,
std::vector<ColStructList>& colExtentsStruct,
ColValueList& colValueList,
std::vector<void*>& colOldValueList,
@ -566,6 +563,7 @@ public:
*/
EXPORT int updateColumnRecs(const TxnID& txnid,
const CSCTypesList& cscColTypeList,
std::vector<ColStruct>& colStructList,
ColValueList& colValueList,
const RIDList& ridLists,
@ -657,10 +655,10 @@ private:
void findSmallestColumn(uint32_t &colId, ColStructList colStructList);
/**
* @brief Convert interface column type to a internal column type
* @brief Convert interface column type to an internal column type
*/
void convertValue(const execplan::CalpontSystemCatalog::ColType &fullColType, ColType colType, void* valArray, size_t pos, boost::any& data, bool fromList = true);
void convertValue(const ColType colType, void* valArray, size_t pos, boost::any& data, bool fromList = true);
void convertValue(const execplan::CalpontSystemCatalog::ColType& cscColType, ColType colType, void* valArray, size_t pos, boost::any& data, bool fromList = true);
/**
* @brief Convert column value to its internal representation
*
@ -668,8 +666,7 @@ private:
* @param value Memory pointer for storing output value. Should be pre-allocated
* @param data Column data
*/
void convertValue(const execplan::CalpontSystemCatalog::ColType &fullColType, const ColType colType, void* value, boost::any& data);
void convertValue(const ColType colType, void* value, boost::any& data);
void convertValue(const execplan::CalpontSystemCatalog::ColType& cscColType, const ColType colType, void* value, boost::any& data);
/**
* @brief Print input value from DDL/DML processors
@ -705,14 +702,6 @@ private:
RID* rowIdArray, const ColStructList& newColStructList,
ColValueList& newColValueList, const int32_t tableOid,
bool useTmpSuffix, bool versioning = true);
// WIP
int writeColumnRec(const TxnID& txnid,
const ColStructList& colStructList,
ColValueList& colValueList,
RID* rowIdArray, const ColStructList& newColStructList,
ColValueList& newColValueList, const int32_t tableOid,
bool useTmpSuffix, bool versioning = true);
int writeColumnRecBinary(const TxnID& txnid, const ColStructList& colStructList,
std::vector<uint64_t>& colValueList,
@ -721,24 +710,17 @@ private:
const int32_t tableOid,
bool useTmpSuffix, bool versioning = true);
//@Bug 1886,2870 pass the address of ridList vector
int writeColumnRec(const TxnID& txnid,
const CSCTypesList& cscColTypes,
const CSCTypesList& cscColTypeList,
const ColStructList& colStructList,
const ColValueList& colValueList, std::vector<void*>& colOldValueList,
const RIDList& ridList, const int32_t tableOid,
bool convertStructFlag = true, ColTupleList::size_type nRows = 0);
// WIP legacy
int writeColumnRec(const TxnID& txnid,
const ColStructList& colStructList,
const ColValueList& colValueList, std::vector<void*>& colOldValueList,
const RIDList& ridList, const int32_t tableOid,
bool convertStructFlag = true, ColTupleList::size_type nRows = 0);
//For update column from column to use
int writeColumnRecords(const TxnID& txnid, std::vector<ColStruct>& colStructList,
int writeColumnRecords(const TxnID& txnid, const CSCTypesList& cscColTypeList,
std::vector<ColStruct>& colStructList,
ColValueList& colValueList, const RIDList& ridLists,
const int32_t tableOid, bool versioning = true);