From be31c37c90c0485aa53b7abe5077d041b9fc9d46 Mon Sep 17 00:00:00 2001 From: Roman Nozdrin Date: Tue, 18 Jan 2022 09:45:28 +0000 Subject: [PATCH] MDEV-27519 CRC32() upon Columnstore table returns a wrong value --- utils/funcexp/func_crc32.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/utils/funcexp/func_crc32.cpp b/utils/funcexp/func_crc32.cpp index cfdea1e57..24f1e580f 100644 --- a/utils/funcexp/func_crc32.cpp +++ b/utils/funcexp/func_crc32.cpp @@ -50,23 +50,23 @@ int64_t Func_crc32::getIntVal(rowgroup::Row& row, bool& isNull, CalpontSystemCatalog::ColType& ct) { - unsigned crc; - switch (parm.size) { - default: - isNull = true; - return 0; - case 1: - crc = 0; - break; - case 2: - crc = static_cast(parm[0]->data()->getIntVal(row, isNull)); - if (isNull) + unsigned crc = 0; + switch (parm.size()) + { + default: + isNull = true; return 0; + case 1: + break; + case 2: + crc = static_cast(parm[0]->data()->getIntVal(row, isNull)); + if (isNull) + return 0; } - const string& b = parm[parm.size - 1]->data()->getStrVal(row, isNull); + const string& b = parm[parm.size() - 1]->data()->getStrVal(row, isNull); if (isNull) return 0; - return crc32(crc, reinterpret_cast(b.data()), b.size()); + return crc32(crc, reinterpret_cast(b.data()), b.size()); }