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

Add PrimProc support for selective block loading for 16-byte columns.

This commit is contained in:
Gagan Goel
2020-12-11 14:23:45 -05:00
parent 9c623a5434
commit a91fb15b07
9 changed files with 24 additions and 26 deletions

View File

@ -351,8 +351,8 @@ void BatchPrimitiveProcessorJL::addElementType(const ElementType& et, uint32_t d
absRids[ridCount] = et.first; absRids[ridCount] = et.first;
else else
{ {
relRids[ridCount] = et.first & 0x1fff; // 8192 rows per logical block relRids[ridCount] = et.first & 0x1fff; // 8192 rows per logical block
ridMap |= 1 << (relRids[ridCount] >> 10); // LSB -> 0-1023, MSB -> 7168-8191 ridMap |= 1 << (relRids[ridCount] >> 9); // LSB -> 0-511, MSB -> 7680-8191
} }
if (sendValues) if (sendValues)

View File

@ -297,7 +297,7 @@ private:
uint16_t filterCount; uint16_t filterCount;
uint16_t projectCount; uint16_t projectCount;
bool needRidsAtDelivery; bool needRidsAtDelivery;
uint8_t ridMap; uint16_t ridMap;
// TableBand templateTB; // TableBand templateTB;
uint32_t tableOID; uint32_t tableOID;

View File

@ -314,7 +314,7 @@ struct ColByScanRequestHeader
ColRequestHeaderDataType colType; ColRequestHeaderDataType colType;
uint8_t OutputType; // 1 = RID, 2 = Token, 3 = Both uint8_t OutputType; // 1 = RID, 2 = Token, 3 = Both
uint8_t BOP; // 0 = N/A, 1 = AND, 2 = OR uint8_t BOP; // 0 = N/A, 1 = AND, 2 = OR
uint8_t RidFlags; // a bitmap indicating the rid ranges in the resultM SB => row 7168-8191 uint16_t RidFlags; // a bitmap indicating the rid ranges in the result MSB => row 7680-8191
uint16_t NOPS; uint16_t NOPS;
uint16_t NVALS; uint16_t NVALS;
uint8_t sort; uint8_t sort;
@ -336,7 +336,7 @@ struct ColByScanRangeRequestHeader
ColRequestHeaderDataType colType; ColRequestHeaderDataType colType;
uint8_t OutputType; // 1 = RID, 2 = Token, 3 = Both uint8_t OutputType; // 1 = RID, 2 = Token, 3 = Both
uint8_t BOP; // 0 = N/A, 1 = AND, 2 = OR uint8_t BOP; // 0 = N/A, 1 = AND, 2 = OR
uint8_t RidFlags; // a bitmap indicating the rid ranges in the result MSB => row 7168-8191 uint16_t RidFlags; // a bitmap indicating the rid ranges in the result MSB => row 7680-8191
uint16_t NOPS; uint16_t NOPS;
uint16_t NVALS; uint16_t NVALS;
uint8_t sort; uint8_t sort;
@ -409,7 +409,7 @@ struct ColResultHeader
{ {
PrimitiveHeader Hdr; PrimitiveHeader Hdr;
uint64_t LBID; uint64_t LBID;
uint8_t RidFlags; uint16_t RidFlags;
uint16_t NVALS; uint16_t NVALS;
uint16_t ValidMinMax; // 1 if Min/Max are valid, otherwise 0 uint16_t ValidMinMax; // 1 if Min/Max are valid, otherwise 0
uint32_t OutputType; uint32_t OutputType;
@ -695,7 +695,7 @@ struct NewColRequestHeader
uint8_t OutputType; // OT_DATAVALUE, OT_RID, or OT_BOTH uint8_t OutputType; // OT_DATAVALUE, OT_RID, or OT_BOTH
uint8_t BOP; uint8_t BOP;
// uint8_t InputFlags; // 1 = interpret each NOP & RID as a pair (deprecated) // uint8_t InputFlags; // 1 = interpret each NOP & RID as a pair (deprecated)
uint8_t RidFlags; // a bitmap indicating the rid ranges in the result MSB => row 7168-8191 uint16_t RidFlags; // a bitmap indicating the rid ranges in the result MSB => row 7680-8191
uint16_t NOPS; uint16_t NOPS;
uint16_t NVALS; uint16_t NVALS;
uint8_t sort; //1 to sort uint8_t sort; //1 to sort
@ -730,7 +730,7 @@ struct NewColResultHeader
ISMPacketHeader ism; ISMPacketHeader ism;
PrimitiveHeader hdr; PrimitiveHeader hdr;
uint64_t LBID; uint64_t LBID;
uint8_t RidFlags; uint16_t RidFlags;
uint16_t NVALS; uint16_t NVALS;
uint16_t ValidMinMax; // 1 if Min/Max are valid, otherwise 0 uint16_t ValidMinMax; // 1 if Min/Max are valid, otherwise 0
uint32_t OutputType; uint32_t OutputType;

View File

@ -774,7 +774,7 @@ inline void store(const NewColRequestHeader* in,
} }
#endif #endif
out->RidFlags |= (1 << (rid >> 10)); // set the (row/1024)'th bit out->RidFlags |= (1 << (rid >> 9)); // set the (row/512)'th bit
memcpy(&out8[*written], &rid, 2); memcpy(&out8[*written], &rid, 2);
*written += 2; *written += 2;
} }

View File

@ -525,7 +525,7 @@ void BatchPrimitiveProcessor::resetBPP(ByteStream& bs, const SP_UM_MUTEX& w,
for (uint32_t i = 0; i < ridCount; i++) for (uint32_t i = 0; i < ridCount; i++)
{ {
relRids[i] = absRids[i] - baseRid; relRids[i] = absRids[i] - baseRid;
ridMap |= 1 << (relRids[i] >> 10); ridMap |= 1 << (relRids[i] >> 9);
} }
} }
else else
@ -1481,7 +1481,7 @@ void BatchPrimitiveProcessor::execute()
if (accumulator[i]) if (accumulator[i])
{ {
relRids[ridCount] = i; relRids[ridCount] = i;
ridMap |= 1 << (relRids[ridCount] >> 10); ridMap |= 1 << (relRids[ridCount] >> 9);
++ridCount; ++ridCount;
} }
} }

View File

@ -224,7 +224,7 @@ private:
uint16_t filterCount; uint16_t filterCount;
uint16_t projectCount; uint16_t projectCount;
bool sendRidsAtDelivery; bool sendRidsAtDelivery;
uint8_t ridMap; uint16_t ridMap;
bool gotAbsRids; bool gotAbsRids;
bool gotValues; bool gotValues;

View File

@ -127,7 +127,7 @@ void ColumnCommand::makeScanMsg()
primMsg->ism.Size = baseMsgLength; primMsg->ism.Size = baseMsgLength;
primMsg->NVALS = 0; primMsg->NVALS = 0;
primMsg->LBID = lbid; primMsg->LBID = lbid;
primMsg->RidFlags = 0xFF; primMsg->RidFlags = 0xFFFF;
// cout << "scanning lbid " << lbid << " colwidth = " << primMsg->DataSize << // cout << "scanning lbid " << lbid << " colwidth = " << primMsg->DataSize <<
// " filterCount = " << filterCount << " outputType = " << // " filterCount = " << filterCount << " outputType = " <<
@ -148,7 +148,7 @@ void ColumnCommand::loadData()
{ {
uint32_t wasCached; uint32_t wasCached;
uint32_t blocksRead; uint32_t blocksRead;
uint8_t _mask; uint16_t _mask;
uint64_t oidLastLbid = 0; uint64_t oidLastLbid = 0;
bool lastBlockReached = false; bool lastBlockReached = false;
oidLastLbid = getLastLbid(); oidLastLbid = getLastLbid();
@ -161,7 +161,7 @@ void ColumnCommand::loadData()
_mask = mask; _mask = mask;
// primMsg->RidFlags = 0xff; // disables selective block loading // primMsg->RidFlags = 0xffff; // disables selective block loading
//cout <<__FILE__ << "::issuePrimitive() o: " << getOID() << " l:" << primMsg->LBID << " ll: " << oidLastLbid << endl; //cout <<__FILE__ << "::issuePrimitive() o: " << getOID() << " l:" << primMsg->LBID << " ll: " << oidLastLbid << endl;
for (i = 0; i < colType.colWidth; ++i, _mask <<= shift) for (i = 0; i < colType.colWidth; ++i, _mask <<= shift)
@ -599,30 +599,28 @@ void ColumnCommand::prep(int8_t outputType, bool absRids)
// memcpy(primMsg + 1, filterString.buf(), filterString.length()); // memcpy(primMsg + 1, filterString.buf(), filterString.length());
// JFYI This switch results are used by index scan code that is unused
// as of 1.5
switch (colType.colWidth) switch (colType.colWidth)
{ {
case 1: case 1:
shift = 16;
mask = 0xFFFF;
break;
case 2:
shift = 8; shift = 8;
mask = 0xFF; mask = 0xFF;
break; break;
case 2: case 4:
shift = 4; shift = 4;
mask = 0x0F; mask = 0x0F;
break; break;
case 4: case 8:
shift = 2; shift = 2;
mask = 0x03; mask = 0x03;
break; break;
case 8:
shift = 1;
mask = 0x01;
break;
case 16: case 16:
shift = 1; shift = 1;
mask = 0x01; mask = 0x01;

View File

@ -149,7 +149,7 @@ private:
int64_t* values; // this is usually bpp->values; RTSCommand needs to use a different container int64_t* values; // this is usually bpp->values; RTSCommand needs to use a different container
int128_t* wide128Values; int128_t* wide128Values;
uint8_t mask, shift; // vars for the selective block loader uint16_t mask, shift; // vars for the selective block loader
// counters to decide whether to prefetch or not // counters to decide whether to prefetch or not
uint32_t blockCount, loadCount; uint32_t blockCount, loadCount;

View File

@ -285,7 +285,7 @@ void FilterCommand::doFilter()
bpp->wide128Values[bpp->ridCount] = bpp->fFiltCmdBinaryValues[0][i]; bpp->wide128Values[bpp->ridCount] = bpp->fFiltCmdBinaryValues[0][i];
else else
bpp->values[bpp->ridCount] = bpp->fFiltCmdValues[0][i]; bpp->values[bpp->ridCount] = bpp->fFiltCmdValues[0][i];
bpp->ridMap |= 1 << (bpp->relRids[bpp->ridCount] >> 10); bpp->ridMap |= 1 << (bpp->relRids[bpp->ridCount] >> 9);
bpp->ridCount++; bpp->ridCount++;
} }