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 updates.

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

View File

@ -1733,9 +1733,6 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
if (!bDelete) pVal = &((uint64_t*) valArray)[i];
break;
// WIP
//case WriteEngine::WR_INT128:
case WriteEngine::WR_BINARY:
// WIP CSCCol type
pVal = &((uint128_t*) valArray)[i];
@ -1838,102 +1835,73 @@ int ColumnOp::writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridLis
// This is a awkward way to convert void* and get ith element, I just don't have a good solution for that
// How about pVal = valArray? You're always getting the 0'th element here anyways.
switch (curCol.colType)
// TODO MCOL-641 add support here
// This branch does not seem to be called from anywhere
if (!bDelete)
{
// case WriteEngine::WR_LONG : pVal = &((long *) valArray)[i]; break;
case WriteEngine::WR_FLOAT :
if (!bDelete) pVal = &((float*) valArray)[0];
//pOldVal = &((float *) oldValArray)[i];
break;
case WriteEngine::WR_DOUBLE :
if (!bDelete) pVal = &((double*) valArray)[0];
//pOldVal = &((double *) oldValArray)[i];
break;
case WriteEngine::WR_VARBINARY : // treat same as char for now
case WriteEngine::WR_BLOB :
case WriteEngine::WR_TEXT :
case WriteEngine::WR_CHAR :
if (!bDelete)
{
switch (curCol.colType)
{
case WriteEngine::WR_FLOAT :
pVal = &((float*) valArray)[0];
break;
case WriteEngine::WR_DOUBLE :
pVal = &((double*) valArray)[0];
break;
case WriteEngine::WR_VARBINARY : // treat same as char for now
case WriteEngine::WR_BLOB :
case WriteEngine::WR_TEXT :
case WriteEngine::WR_CHAR :
memcpy(charTmpBuf, (char*)valArray, 8);
pVal = charTmpBuf;
}
//pOldVal = (char*)oldValArray + i*8;
break;
// case WriteEngine::WR_BIT : pVal = &((bool *) valArray)[i]; break;
case WriteEngine::WR_SHORT :
if (!bDelete) pVal = &((short*) valArray)[0];
//pOldVal = &((short *) oldValArray)[i];
break;
case WriteEngine::WR_BYTE :
if (!bDelete) pVal = &((char*) valArray)[0];
//pOldVal = &((char *) oldValArray)[i];
break;
case WriteEngine::WR_LONGLONG:
if (!bDelete) pVal = &((long long*) valArray)[0];
//pOldVal = &((long long *) oldValArray)[i];
break;
case WriteEngine::WR_TOKEN:
if (!bDelete) pVal = &((Token*) valArray)[0];
//pOldVal = &((Token *) oldValArray)[i];
break;
case WriteEngine::WR_INT :
case WriteEngine::WR_MEDINT :
if (!bDelete) pVal = &((int*) valArray)[0];
//pOldVal = &((int *) oldValArray)[i];
break;
case WriteEngine::WR_USHORT :
if (!bDelete) pVal = &((uint16_t*) valArray)[0];
//pOldVal = &((uint16_t *) oldValArray)[i];
break;
case WriteEngine::WR_UBYTE :
if (!bDelete) pVal = &((uint8_t*) valArray)[0];
//pOldVal = &((uint8_t *) oldValArray)[i];
break;
case WriteEngine::WR_ULONGLONG:
if (!bDelete) pVal = &((uint64_t*) valArray)[0];
//pOldVal = &((uint64_t *) oldValArray)[i];
break;
case WriteEngine::WR_UINT :
case WriteEngine::WR_UMEDINT :
if (!bDelete) pVal = &((uint32_t*) valArray)[0];
//pOldVal = &((uint32_t *) oldValArray)[i];
break;
default :
if (!bDelete) pVal = &((int*) valArray)[0];
//pOldVal = &((int *) oldValArray)[i];
break;
break;
// case WriteEngine::WR_BIT : pVal = &((bool *) valArray)[i]; break;
case WriteEngine::WR_SHORT :
pVal = &((short*) valArray)[0];
break;
case WriteEngine::WR_BYTE :
pVal = &((char*) valArray)[0];
break;
case WriteEngine::WR_LONGLONG:
pVal = &((long long*) valArray)[0];
break;
case WriteEngine::WR_TOKEN:
pVal = &((Token*) valArray)[0];
break;
case WriteEngine::WR_INT :
case WriteEngine::WR_MEDINT :
pVal = &((int*) valArray)[0];
break;
case WriteEngine::WR_USHORT :
pVal = &((uint16_t*) valArray)[0];
break;
case WriteEngine::WR_UBYTE :
pVal = &((uint8_t*) valArray)[0];
break;
case WriteEngine::WR_ULONGLONG:
pVal = &((uint64_t*) valArray)[0];
break;
case WriteEngine::WR_UINT :
case WriteEngine::WR_UMEDINT :
pVal = &((uint32_t*) valArray)[0];
break;
default :
pVal = &((int*) valArray)[0];
break;
}
}
// This is the stuff to retrieve old value
//memcpy(pOldVal, dataBuf + dataBio, curCol.colWidth);
if (bDelete)
else
{
if (curCol.colType != WriteEngine::WR_BINARY)
{
@ -2084,6 +2052,10 @@ int ColumnOp::writeRowsValues(Column& curCol, uint64_t totalRow, const RIDList&
pVal = &((uint32_t*) valArray)[i];
break;
case WriteEngine::WR_BINARY:
pVal = &((int128_t*) valArray)[i];
break;
default :
pVal = &((int*) valArray)[i];
break;

View File

@ -4376,9 +4376,6 @@ int WriteEngineWrapper::updateColumnRecs(const TxnID& txnid,
const int32_t tableOid)
{
//Mark extents invalid
//int rc = 0;
//if (colExtentsStruct[0].dataOid < 3000)
//{
vector<BRM::LBID_t> lbids;
vector<CalpontSystemCatalog::ColDataType> colDataTypes;
ColumnOp* colOp = NULL;
@ -4414,15 +4411,13 @@ int WriteEngineWrapper::updateColumnRecs(const TxnID& txnid,
if (lbids.size() > 0)
{
// cout << "BRMWrapper::getInstance()->markExtentsInvalid(lbids); " << lbids.size() << " lbids" << endl;
rc = BRMWrapper::getInstance()->markExtentsInvalid(lbids, colDataTypes);
}
//}
if ( m_opType != DELETE)
if (m_opType != DELETE)
m_opType = UPDATE;
rc = writeColumnRecords (txnid, cscColTypeList, colExtentsStruct, colValueList, ridLists, tableOid);
rc = writeColumnRecords(txnid, cscColTypeList, colExtentsStruct, colValueList, ridLists, tableOid);
m_opType = NOOP;
return rc;
}
@ -4438,6 +4433,7 @@ int WriteEngineWrapper::writeColumnRecords(const TxnID& txnid,
void* valArray = NULL;
Column curCol;
ColStruct curColStruct;
CalpontSystemCatalog::ColType curColType;
ColTupleList curTupleList;
ColStructList::size_type totalColumn;
ColStructList::size_type i;
@ -4452,6 +4448,7 @@ int WriteEngineWrapper::writeColumnRecords(const TxnID& txnid,
{
valArray = NULL;
curColStruct = colStructList[i];
curColType = cscColTypeList[i];
curTupleList = colValueList[i];
ColumnOp* colOp = m_colOp[op(curColStruct.fCompressionType)];
@ -4568,11 +4565,10 @@ int WriteEngineWrapper::writeColumnRecords(const TxnID& txnid,
valArray = (Token*) calloc(sizeof(Token), totalRow);
break;
// WIP
// WIP MCOL-641
case WriteEngine::WR_BINARY:
//case WriteEngine::WR_INT128:
// Use column width and remove all C-casts from above
valArray = calloc(totalRow, 16);
valArray = calloc(totalRow, curColType.colWidth);
break;
}