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-267 multi-block support for PrimProc and bulk
* Adds multi-block bulk write support * Adds PrimProc multi-block read support * Allows the functions length() and hex() to work with BLOB columns
This commit is contained in:
@ -249,6 +249,7 @@ inline bool isEmptyVal<8>(uint8_t type, const uint8_t* ival)
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
case CalpontSystemCatalog::VARBINARY:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
return (*val == joblist::CHAR8EMPTYROW);
|
||||
case CalpontSystemCatalog::UBIGINT:
|
||||
return (joblist::UBIGINTEMPTYROW == *val);
|
||||
@ -271,6 +272,7 @@ inline bool isEmptyVal<4>(uint8_t type, const uint8_t* ival)
|
||||
return (joblist::FLOATEMPTYROW == *val);
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
return (joblist::CHAR4EMPTYROW == *val);
|
||||
@ -292,6 +294,7 @@ inline bool isEmptyVal<2>(uint8_t type, const uint8_t* ival)
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
return (joblist::CHAR2EMPTYROW == *val);
|
||||
@ -313,6 +316,7 @@ inline bool isEmptyVal<1>(uint8_t type, const uint8_t* ival)
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
return (*val == joblist::CHAR1EMPTYROW);
|
||||
@ -343,6 +347,7 @@ inline bool isNullVal<8>(uint8_t type, const uint8_t* ival)
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
case CalpontSystemCatalog::VARBINARY:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
//@bug 339 might be a token here
|
||||
//TODO: what's up with the second const here?
|
||||
return (*val == joblist::CHAR8NULL || 0xFFFFFFFFFFFFFFFELL == *val);
|
||||
@ -367,6 +372,7 @@ inline bool isNullVal<4>(uint8_t type, const uint8_t* ival)
|
||||
return (joblist::FLOATNULL == *val);
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
return (joblist::CHAR4NULL == *val);
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
@ -389,6 +395,7 @@ inline bool isNullVal<2>(uint8_t type, const uint8_t* ival)
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
return (joblist::CHAR2NULL == *val);
|
||||
@ -410,6 +417,7 @@ inline bool isNullVal<1>(uint8_t type, const uint8_t* ival)
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::DATE:
|
||||
case CalpontSystemCatalog::DATETIME:
|
||||
return (*val == joblist::CHAR1NULL);
|
||||
@ -451,6 +459,7 @@ inline bool isMinMaxValid(const NewColRequestHeader *in) {
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
return (in->DataSize<9);
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
return (in->DataSize<8);
|
||||
case CalpontSystemCatalog::TINYINT:
|
||||
case CalpontSystemCatalog::SMALLINT:
|
||||
@ -505,7 +514,7 @@ inline bool colCompare(int64_t val1, int64_t val2, uint8_t COP, uint8_t rf, int
|
||||
return colCompare_(dVal1, dVal2, COP);
|
||||
}
|
||||
|
||||
else if ( (type == CalpontSystemCatalog::CHAR || type == CalpontSystemCatalog::VARCHAR) && !isNull )
|
||||
else if ( (type == CalpontSystemCatalog::CHAR || type == CalpontSystemCatalog::VARCHAR || type == CalpontSystemCatalog::BLOB) && !isNull )
|
||||
{
|
||||
if (!regex.used && !rf)
|
||||
return colCompare_(order_swap(val1), order_swap(val2), COP);
|
||||
@ -1180,7 +1189,7 @@ inline void p_Col_ridArray(NewColRequestHeader *in,
|
||||
if (out->ValidMinMax && !isNull && !isEmpty)
|
||||
{
|
||||
|
||||
if ((in->DataType == CalpontSystemCatalog::CHAR || in->DataType == CalpontSystemCatalog::VARCHAR ) && 1 < W)
|
||||
if ((in->DataType == CalpontSystemCatalog::CHAR || in->DataType == CalpontSystemCatalog::VARCHAR || in->DataType == CalpontSystemCatalog::BLOB ) && 1 < W)
|
||||
{
|
||||
if (colCompare(out->Min, val, COMPARE_GT, false, in->DataType, W, placeholderRegex))
|
||||
out->Min = val;
|
||||
|
@ -866,6 +866,7 @@ const uint64_t ColumnCommand::getEmptyRowValue( const execplan::CalpontSystemCat
|
||||
case execplan::CalpontSystemCatalog::DATE :
|
||||
case execplan::CalpontSystemCatalog::DATETIME :
|
||||
case execplan::CalpontSystemCatalog::VARBINARY :
|
||||
case execplan::CalpontSystemCatalog::BLOB :
|
||||
default:
|
||||
emptyVal = joblist::CHAR1EMPTYROW;
|
||||
if ( width == (2 + offset) )
|
||||
|
@ -509,7 +509,8 @@ void DictStep::_projectToRG(RowGroup &rg, uint32_t col)
|
||||
|
||||
// bug 4901 - move this inside the loop and call incrementally
|
||||
// to save the unnecessary string copy
|
||||
if (rg.getColTypes()[col] != execplan::CalpontSystemCatalog::VARBINARY) {
|
||||
if ((rg.getColTypes()[col] != execplan::CalpontSystemCatalog::VARBINARY) &&
|
||||
(rg.getColTypes()[col] != execplan::CalpontSystemCatalog::BLOB)) {
|
||||
for (i = curResultCounter; i < tmpResultCounter; i++) {
|
||||
rg.getRow(newRidList[i].pos, &r);
|
||||
//cout << "serializing " << tmpStrings[i] << endl;
|
||||
@ -517,9 +518,39 @@ void DictStep::_projectToRG(RowGroup &rg, uint32_t col)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = curResultCounter; i < tmpResultCounter; i++) {
|
||||
uint32_t firstTmpResultCounter = tmpResultCounter;
|
||||
for (i = curResultCounter; i < firstTmpResultCounter; i++) {
|
||||
rg.getRow(newRidList[i].pos, &r);
|
||||
r.setVarBinaryField(tmpStrings[i].ptr, tmpStrings[i].len, col);
|
||||
// If this is a multi-block blob, get all the blocks
|
||||
// We do string copy here, should maybe have a RowGroup
|
||||
// function to append strings or something?
|
||||
if ((newRidList[i].token != 0xffffffffffffffffLL) &&
|
||||
((newRidList[i].token >> 46) > 0))
|
||||
{
|
||||
StringPtr multi_part[1];
|
||||
uint16_t old_offset = primMsg->tokens[0].offset;
|
||||
string result((char*)tmpStrings[i].ptr, tmpStrings[i].len);
|
||||
uint64_t origin_lbid = primMsg->LBID;
|
||||
uint32_t lbid_count = newRidList[i].token >> 46;
|
||||
primMsg->tokens[0].offset = 1; // first offset of a sig
|
||||
for (uint32_t j = 1; j <= lbid_count; j++)
|
||||
{
|
||||
tmpResultCounter = 0;
|
||||
primMsg->LBID = origin_lbid + j;
|
||||
primMsg->NVALS = 1;
|
||||
primMsg->tokens[0].LBID = origin_lbid + j;
|
||||
issuePrimitive(false);
|
||||
projectResult(multi_part);
|
||||
result.append((char*)multi_part[0].ptr, multi_part[0].len);
|
||||
}
|
||||
primMsg->tokens[0].offset = old_offset;
|
||||
tmpResultCounter = firstTmpResultCounter;
|
||||
r.setVarBinaryField((unsigned char*)result.c_str(), result.length(), col);
|
||||
}
|
||||
else
|
||||
{
|
||||
r.setVarBinaryField(tmpStrings[i].ptr, tmpStrings[i].len, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
curResultCounter = tmpResultCounter;
|
||||
|
@ -94,7 +94,8 @@ Command* FilterCommand::makeFilterCommand(ByteStream& bs, vector<SCommand>& cmds
|
||||
// char[] is stored as int, but cannot directly compare if length is different
|
||||
// due to endian issue
|
||||
if (cmd0->getColType().colDataType == execplan::CalpontSystemCatalog::CHAR ||
|
||||
cmd0->getColType().colDataType == execplan::CalpontSystemCatalog::VARCHAR)
|
||||
cmd0->getColType().colDataType == execplan::CalpontSystemCatalog::VARCHAR ||
|
||||
cmd0->getColType().colDataType == execplan::CalpontSystemCatalog::BLOB)
|
||||
{
|
||||
StrFilterCmd* sc = new StrFilterCmd();
|
||||
sc->setCompareFunc(CC);
|
||||
|
Reference in New Issue
Block a user