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

MCOL-641 This commit contains fixes for the rebase that mostly adds

WE_BINARY and WE_INT128 into switch-case blocks.
This commit is contained in:
Roman Nozdrin
2019-12-30 06:09:53 -06:00
parent c9f42fb5cc
commit df65543dd4
5 changed files with 49 additions and 19 deletions

View File

@ -286,8 +286,8 @@ 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))
|| ((val[0] == joblist::BIGINTEMPTYROW) && (val[1] == joblist::BIGINTEMPTYROW)))
;
}
@ -1611,7 +1611,6 @@ inline void p_Col_bin_ridArray(NewColRequestHeader* in,
scoped_array<idb_regex_t> std_regex;
idb_regex_t* regex = NULL;
uint8_t likeOps = 0;
// no pre-parsed column filter is set, parse the filter in the message
if (parsedColumnFilter.get() == NULL) {

View File

@ -638,7 +638,7 @@ void Convertor::convertColType(ColStruct* curStruct)
break;
default:
*internalType = WriteEngine::WR_BCDECIMAL;
*internalType = WriteEngine::WR_INT128;
break;
}

View File

@ -112,7 +112,8 @@ enum ColType /** @brief Column type enumeration*/
WR_MEDINT = 18, /** @brief Medium Int */
WR_UMEDINT = 19, /** @brief Unsigned Medium Int */
WR_BINARY = 20, /** @brief BINARY */
WR_BCDECIMAL = 21 /** @brief BINARY CODED DECIMAL */
// WIP We might be good using WR_BINARY
WR_INT128 = 21 /** @brief __int128 */
};
// Describes relation of field to column for a bulk load

View File

@ -1410,17 +1410,9 @@ 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
inline bool ColumnOp::isEmptyRow(uint64_t* curVal, uint64_t emptyVal, const int colWidth)
{
//Calling it here makes calling it "i" times from the calling loop at allocRowId()
//uint64_t emptyVal = getEmptyRowValue(column.colDataType, column.colWidth);
// No need for it if change param type.. just been lazy to add extra castings
//uint64_t &emptyVal = column.emptyVal;
//no need to multiply over and over if just increment the pointer on the caller
//uint64_t *curVal = (uint64_t*)(buf + offset * column.colWidth);
switch(colWidth){
case 1:
return *(uint8_t*)curVal == emptyVal;
@ -1441,6 +1433,8 @@ inline bool ColumnOp::isEmptyRow(uint64_t* curVal, uint64_t emptyVal, const int
return ((curVal[0] == emptyVal) && (curVal[1] == emptyVal)
&& (curVal[2] == emptyVal) && (curVal[3] == emptyVal));
}
// WIP
return false;
}
/***********************************************************
@ -1687,7 +1681,7 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_BCDECIMAL:
case WriteEngine::WR_INT128:
if (!bDelete) pVal = (uint8_t*) valArray + i * curCol.colWidth;
break;

View File

@ -390,9 +390,11 @@ void WriteEngineWrapper::convertValue(const ColType colType, void* value, boost:
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
{
char val = boost::any_cast<char>(data);
//TODO:FIXME how to determine size ? 16, 32,48 ?
// WIP
size = 16;
memcpy(value, &val, size);
}
@ -503,7 +505,7 @@ void WriteEngineWrapper::convertValue(const ColType colType, void* valArray, con
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_BCDECIMAL:
case WriteEngine::WR_INT128:
curStr = boost::any_cast<string>(data);
memcpy((char*)valArray + pos * curStr.length(), curStr.c_str(), curStr.length());
break;
@ -575,9 +577,11 @@ void WriteEngineWrapper::convertValue(const ColType colType, void* valArray, con
break;
case WriteEngine::WR_BINARY :
case WriteEngine::WR_INT128:
{
char tmp[16];
//TODO:FIXME how to determine size ? 16, 32,48 ?
// WIP
memcpy(tmp, (char*)valArray + pos * 16, 16);
curStr = tmp;
data = curStr;
@ -897,6 +901,14 @@ int WriteEngineWrapper::deleteBadRows(const TxnID& txnid, ColStructList& colStru
case WriteEngine::WR_TOKEN:
valArray = (Token*) calloc(sizeof(Token), 1);
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
// WIP use column width here
// remove all C-casts from above
valArray = calloc(1, 16);
break;
}
rc = colOp->writeRows(curCol, ridList.size(), ridList, valArray, 0, true);
@ -4569,6 +4581,14 @@ int WriteEngineWrapper::writeColumnRecords(const TxnID& txnid,
case WriteEngine::WR_TOKEN:
valArray = (Token*) calloc(sizeof(Token), totalRow);
break;
// WIP
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
// Use column width and remove all C-casts from above
valArray = calloc(totalRow, 16);
break;
}
// convert values to valArray
@ -4808,6 +4828,12 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
case WriteEngine::WR_TOKEN:
valArray = (Token*) calloc(sizeof(Token), totalRow1);
break;
// WIP
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
valArray = calloc(totalRow1, 16);
break;
}
// convert values to valArray
@ -4983,6 +5009,13 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
case WriteEngine::WR_TOKEN:
valArray = (Token*) calloc(sizeof(Token), totalRow2);
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
// WIP
valArray = calloc(totalRow2, 16);
break;
}
// convert values to valArray
@ -5158,7 +5191,7 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_BCDECIMAL:
case WriteEngine::WR_INT128:
valArray = calloc(colStructList[i].colWidth, totalRow1);
break;
}
@ -5382,6 +5415,7 @@ int WriteEngineWrapper::writeColumnRecBinary(const TxnID& txnid,
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
((uint64_t*)valArray)[j] = curValue; //FIXME maybe
break;
@ -5530,6 +5564,7 @@ int WriteEngineWrapper::writeColumnRecBinary(const TxnID& txnid,
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
((uint64_t*)valArray)[j] = curValue; // FIXME maybe
break;
}
@ -5816,6 +5851,7 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
valArray = (Token*) calloc(sizeof(Token), 1);
break;
case WriteEngine::WR_BINARY:
case WriteEngine::WR_INT128:
valArray = (char*) calloc(sizeof(char), curColStruct.colWidth); //FIXME maybe
break;
}