You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-641 1. Add support for int128_t in ParsedColumnFilter.
2. Set Decimal precision in SimpleColumn::evaluate(). 3. Add support for int128_t in ConstantColumn. 4. Set IDB_Decimal::s128Value in buildDecimalColumn(). 5. Use width 16 as first if predicate for branching based on decimal width.
This commit is contained in:
committed by
Roman Nozdrin
parent
0bd172cd6e
commit
74b64eb4f1
@ -39,6 +39,7 @@
|
||||
#include "brmtypes.h"
|
||||
#include "dataconvert.h"
|
||||
#include "exceptclasses.h"
|
||||
#include "mcs_decimal.h"
|
||||
|
||||
#include "joblisttypes.h"
|
||||
|
||||
@ -986,18 +987,18 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
if ( (column.dataType == CalpontSystemCatalog::DECIMAL) ||
|
||||
(column.dataType == CalpontSystemCatalog::UDECIMAL))
|
||||
{
|
||||
if (width <= 8)
|
||||
{
|
||||
// errno is initialized and set in convertDecimalString
|
||||
llVal = Convertor::convertDecimalString(
|
||||
field, fieldLength, column.scale );
|
||||
}
|
||||
else
|
||||
if (LIKELY(width == datatypes::MAXDECIMALWIDTH))
|
||||
{
|
||||
bool saturate = false;
|
||||
bigllVal = dataconvert::string_to_ll<int128_t>(string(field), saturate);
|
||||
// TODO MCOL-641 check saturate
|
||||
}
|
||||
else if (width <= 8)
|
||||
{
|
||||
// errno is initialized and set in convertDecimalString
|
||||
llVal = Convertor::convertDecimalString(
|
||||
field, fieldLength, column.scale );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2622,7 +2622,6 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
uint64_t& blocksChanged)
|
||||
{
|
||||
uint8_t rc = 0;
|
||||
//cout << " In processUpdate" << endl;
|
||||
uint32_t tmp32, sessionID;
|
||||
TxnID txnId;
|
||||
bs >> PMId;
|
||||
@ -2639,7 +2638,6 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
uint8_t pkgType;
|
||||
bs >> pkgType;
|
||||
cpackages[txnId].read(bs);
|
||||
//cout << "Processed meta data in update" << endl;
|
||||
|
||||
rc = fWEWrapper.startTransaction(txnId);
|
||||
|
||||
@ -2811,9 +2809,20 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
rid = relativeRID;
|
||||
convertToRelativeRid (rid, extentNum, blockNum);
|
||||
rowIDLists.push_back(rid);
|
||||
uint32_t colWidth = ((colTypes[j].colWidth > 8 &&
|
||||
!(colTypes[j].colDataType == CalpontSystemCatalog::DECIMAL ||
|
||||
colTypes[j].colDataType == CalpontSystemCatalog::UDECIMAL)) ? 8 : colTypes[j].colWidth);
|
||||
|
||||
uint32_t colWidth = colTypes[j].colWidth;
|
||||
|
||||
if (colWidth > 8 &&
|
||||
!(colTypes[j].colDataType == CalpontSystemCatalog::DECIMAL ||
|
||||
colTypes[j].colDataType == CalpontSystemCatalog::UDECIMAL))
|
||||
{
|
||||
colWidth = 8;
|
||||
}
|
||||
else if (colWidth >= datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
colWidth = datatypes::MAXDECIMALWIDTH;
|
||||
}
|
||||
|
||||
int rrid = (int) relativeRID / (BYTE_PER_BLOCK / colWidth);
|
||||
// populate stats.blocksChanged
|
||||
if (rrid > preBlkNums[j])
|
||||
@ -2984,16 +2993,18 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
case CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
// WIP MCOL-641
|
||||
if (fetchColColwidths[fetchColPos] == 16)
|
||||
if (fetchColColwidths[fetchColPos] == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
int128_t* dec;
|
||||
char buf[utils::MAXLENGTH16BYTES];
|
||||
dec = row.getBinaryField<int128_t>(fetchColPos);
|
||||
|
||||
dataconvert::DataConvert::decimalToString(dec,
|
||||
(unsigned)fetchColScales[fetchColPos], buf,
|
||||
sizeof(buf), fetchColTypes[fetchColPos]);
|
||||
|
||||
value.assign(buf);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3347,17 +3358,19 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
||||
case CalpontSystemCatalog::DECIMAL:
|
||||
case CalpontSystemCatalog::UDECIMAL:
|
||||
{
|
||||
if (fetchColColwidths[fetchColPos] == 16)
|
||||
if (fetchColColwidths[fetchColPos] == datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
// WIP MCOL-641
|
||||
int128_t* dec;
|
||||
char buf[utils::MAXLENGTH16BYTES];
|
||||
dec = row.getBinaryField<int128_t>(fetchColPos);
|
||||
|
||||
dataconvert::DataConvert::decimalToString(dec,
|
||||
(unsigned)fetchColScales[fetchColPos], buf,
|
||||
sizeof(buf), fetchColTypes[fetchColPos]);
|
||||
|
||||
value = buf;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3994,7 +4007,6 @@ uint8_t WE_DMLCommandProc::processDelete(messageqcpp::ByteStream& bs,
|
||||
uint64_t& blocksChanged)
|
||||
{
|
||||
uint8_t rc = 0;
|
||||
//cout << " In processDelete" << endl;
|
||||
uint32_t tmp32, sessionID;
|
||||
TxnID txnId;
|
||||
bs >> PMId;
|
||||
@ -4069,7 +4081,18 @@ 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) >= 16 ? 16 : row.getColumnWidth(j));
|
||||
colWidth[j] = row.getColumnWidth(j);
|
||||
execplan::CalpontSystemCatalog::ColDataType colDataType = row.getColType(j);
|
||||
if (colWidth[j] >= 8 &&
|
||||
!(colDataType == execplan::CalpontSystemCatalog::DECIMAL ||
|
||||
colDataType == execplan::CalpontSystemCatalog::UDECIMAL))
|
||||
{
|
||||
colWidth[j] = 8;
|
||||
}
|
||||
else if (colWidth[j] >= datatypes::MAXDECIMALWIDTH)
|
||||
{
|
||||
colWidth[j] = datatypes::MAXDECIMALWIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
//Get the file information from rowgroup
|
||||
|
@ -70,9 +70,6 @@ namespace WriteEngine
|
||||
{
|
||||
StopWatch timer;
|
||||
|
||||
using dataconvert::int128_t;
|
||||
using dataconvert::uint128_t;
|
||||
|
||||
/**@brief WriteEngineWrapper Constructor
|
||||
*/
|
||||
WriteEngineWrapper::WriteEngineWrapper() : m_opType(NOOP)
|
||||
@ -803,21 +800,9 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>
|
||||
cscColType = cscColTypeList[i];
|
||||
Convertor::convertColType(&curColStruct);
|
||||
|
||||
/*if (curColStruct.colType == WriteEngine::WR_BINARY)
|
||||
{
|
||||
uint128_t bigEmptyVal;
|
||||
emptyVal = m_colOp[op(curColStruct.fCompressionType)]->
|
||||
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth);
|
||||
*(reinterpret_cast<uint64_t*>(&bigEmptyVal)) = emptyVal;
|
||||
*(reinterpret_cast<uint64_t*>(&bigEmptyVal) + 1) = emptyVal;
|
||||
curTuple.data = bigEmptyVal;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
m_colOp[op(curColStruct.fCompressionType)]->
|
||||
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth, (uint8_t*)&emptyVal);
|
||||
curTuple.data = emptyVal;
|
||||
//}
|
||||
m_colOp[op(curColStruct.fCompressionType)]->
|
||||
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth, (uint8_t*)&emptyVal);
|
||||
curTuple.data = emptyVal;
|
||||
|
||||
curTupleList.push_back(curTuple);
|
||||
colValueList.push_back(curTupleList);
|
||||
@ -4371,7 +4356,6 @@ int WriteEngineWrapper::updateColumnRecs(const TxnID& txnid,
|
||||
ColumnOp* colOp = NULL;
|
||||
bool successFlag = true;
|
||||
unsigned width = 0;
|
||||
\
|
||||
int curFbo = 0, curBio, lastFbo = -1;
|
||||
RID aRid = ridLists[0];
|
||||
int rc = 0;
|
||||
|
Reference in New Issue
Block a user