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
MDEV-27519 CRC32() upon Columnstore table returns a wrong value
Func_crc32::getIntVal(): Support the 2-ary CRC32() variant (MDEV-27208). Also, do not assume that the string contains no NUL bytes.
This commit is contained in:
committed by
Roman Nozdrin
parent
cc850bfe08
commit
15da99477e
@ -50,8 +50,23 @@ int64_t Func_crc32::getIntVal(rowgroup::Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType& ct)
|
CalpontSystemCatalog::ColType& ct)
|
||||||
{
|
{
|
||||||
const string& val = parm[0]->data()->getStrVal(row, isNull);
|
unsigned crc;
|
||||||
return (int64_t) crc32(0L, (unsigned char*)val.c_str(), strlen(val.c_str()));
|
switch (parm.size()) {
|
||||||
|
default:
|
||||||
|
isNull = true;
|
||||||
|
return 0;
|
||||||
|
case 1:
|
||||||
|
crc = 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
crc = static_cast<unsigned>(parm[0]->data()->getIntVal(row, isNull));
|
||||||
|
if (isNull)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const string& b = parm[parm.size() - 1]->data()->getStrVal(row, isNull);
|
||||||
|
if (isNull)
|
||||||
|
return 0;
|
||||||
|
return crc32(crc, reinterpret_cast<const uint8_t*>(b.data()), b.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user