You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Merge pull request #2124 from denis0x0D/MCOL-4810_fix
MCOL-4810 Add support for missed operation.
This commit is contained in:
@ -545,6 +545,7 @@ void ByteStream::swap(ByteStream& rhs)
|
|||||||
std::swap(fCurInPtr, rhs.fCurInPtr);
|
std::swap(fCurInPtr, rhs.fCurInPtr);
|
||||||
std::swap(fCurOutPtr, rhs.fCurOutPtr);
|
std::swap(fCurOutPtr, rhs.fCurOutPtr);
|
||||||
std::swap(fMaxLen, rhs.fMaxLen);
|
std::swap(fMaxLen, rhs.fMaxLen);
|
||||||
|
std::swap(longStrings, rhs.longStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
ifstream& operator>>(ifstream& ifs, ByteStream& bs)
|
ifstream& operator>>(ifstream& ifs, ByteStream& bs)
|
||||||
@ -564,7 +565,31 @@ bool ByteStream::operator==(const ByteStream& b) const
|
|||||||
if (b.length() != length())
|
if (b.length() != length())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (memcmp(fCurOutPtr, b.fCurOutPtr, length()) == 0);
|
if (memcmp(fCurOutPtr, b.fCurOutPtr, length()) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Check the `longString` sizes.
|
||||||
|
if (longStrings.size() != b.longStrings.size())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// For each `longString`.
|
||||||
|
for (uint32_t i = 0, e = b.longStrings.size(); i < e; ++i)
|
||||||
|
{
|
||||||
|
const auto* leftMemChunk = reinterpret_cast<MemChunk*>(longStrings[i].get());
|
||||||
|
const auto* rightMemChunk = reinterpret_cast<MemChunk*>(b.longStrings[i].get());
|
||||||
|
if (leftMemChunk == nullptr || rightMemChunk == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const uint32_t leftSize = leftMemChunk->currentSize;
|
||||||
|
const uint32_t rightSize = rightMemChunk->currentSize;
|
||||||
|
if (leftSize != rightSize)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (memcmp(leftMemChunk->data, rightMemChunk->data, leftSize) != 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ByteStream::operator!=(const ByteStream& b) const
|
bool ByteStream::operator!=(const ByteStream& b) const
|
||||||
|
@ -471,6 +471,13 @@ protected:
|
|||||||
void doCopy(const ByteStream& rhs);
|
void doCopy(const ByteStream& rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Put struct `MemChunk` declaration here, to avoid circular dependency.
|
||||||
|
struct MemChunk
|
||||||
|
{
|
||||||
|
uint32_t currentSize;
|
||||||
|
uint32_t capacity;
|
||||||
|
uint8_t data[];
|
||||||
|
};
|
||||||
|
|
||||||
uint8_t* fBuf; ///the start of the allocated buffer
|
uint8_t* fBuf; ///the start of the allocated buffer
|
||||||
uint8_t* fCurInPtr; //the point in fBuf where data is inserted next
|
uint8_t* fCurInPtr; //the point in fBuf where data is inserted next
|
||||||
|
@ -177,6 +177,7 @@ public:
|
|||||||
|
|
||||||
// This is an overlay b/c the underlying data needs to be any size,
|
// This is an overlay b/c the underlying data needs to be any size,
|
||||||
// and alloc'd in one chunk. data can't be a separate dynamic chunk.
|
// and alloc'd in one chunk. data can't be a separate dynamic chunk.
|
||||||
|
// NOTE: Change here, requires a change in 'bytestream.h'.
|
||||||
struct MemChunk
|
struct MemChunk
|
||||||
{
|
{
|
||||||
uint32_t currentSize;
|
uint32_t currentSize;
|
||||||
|
Reference in New Issue
Block a user