diff --git a/primitives/linux-port/column.cpp b/primitives/linux-port/column.cpp index 130707e09..b76b79655 100644 --- a/primitives/linux-port/column.cpp +++ b/primitives/linux-port/column.cpp @@ -286,8 +286,8 @@ inline bool isEmptyVal<16>(uint8_t type, const uint8_t* ival) // For BINARY { const uint64_t* val = reinterpret_cast(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 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) { diff --git a/writeengine/shared/we_convertor.cpp b/writeengine/shared/we_convertor.cpp index dbe51b1d7..a98e4b275 100644 --- a/writeengine/shared/we_convertor.cpp +++ b/writeengine/shared/we_convertor.cpp @@ -638,7 +638,7 @@ void Convertor::convertColType(ColStruct* curStruct) break; default: - *internalType = WriteEngine::WR_BCDECIMAL; + *internalType = WriteEngine::WR_INT128; break; } diff --git a/writeengine/shared/we_type.h b/writeengine/shared/we_type.h index 64cb1d6c3..fcbed9161 100644 --- a/writeengine/shared/we_type.h +++ b/writeengine/shared/we_type.h @@ -111,8 +111,9 @@ enum ColType /** @brief Column type enumeration*/ WR_TEXT = 17, /** @brief TEXT */ 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 */ + WR_BINARY = 20, /** @brief BINARY */ +// WIP We might be good using WR_BINARY + WR_INT128 = 21 /** @brief __int128 */ }; // Describes relation of field to column for a bulk load diff --git a/writeengine/wrapper/we_colop.cpp b/writeengine/wrapper/we_colop.cpp index 8d7bc3d4d..b5d5eb06f 100644 --- a/writeengine/wrapper/we_colop.cpp +++ b/writeengine/wrapper/we_colop.cpp @@ -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; @@ -1439,8 +1431,10 @@ inline bool ColumnOp::isEmptyRow(uint64_t* curVal, uint64_t emptyVal, const int case 32: return ((curVal[0] == emptyVal) && (curVal[1] == emptyVal) - && (curVal[2] == emptyVal) && (curVal[3] == 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; diff --git a/writeengine/wrapper/writeengine.cpp b/writeengine/wrapper/writeengine.cpp index 620428303..8455ce26f 100644 --- a/writeengine/wrapper/writeengine.cpp +++ b/writeengine/wrapper/writeengine.cpp @@ -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(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(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; }