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 Basic support for multi-value inserts, and deletes.
This commit is contained in:
committed by
Roman Nozdrin
parent
55afcd8890
commit
93170c3b31
@ -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
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user