1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-4671: MCOL-4622: fix the behavior of both PRs

first was playing different with RIGHT and LEFT functions(using the getUintVal and getIntVal accordingly)
https://github.com/mariadb-corporation/mariadb-columnstore-engine/pull/3234
second introduced round for ints from double, but added it to uint but not to int missing long doubles as well
https://github.com/mariadb-corporation/mariadb-columnstore-engine/pull/3480
This commit is contained in:
Leonid Fedorov
2025-05-22 19:07:45 +00:00
committed by Leonid Fedorov
parent 842ec9dbff
commit 5814a80b50
5 changed files with 68 additions and 33 deletions

View File

@@ -57,11 +57,11 @@ std::string Func_right::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is
const char* end = pos + binLen;
// Negative trim length values are legal, but they don't make any real sense
int64_t trimLength = fp[1]->data()->getUintVal(row, isNull);
int64_t trimLength = fp[1]->data()->getIntVal(row, isNull);
if (isNull || trimLength <= 0)
return "";
size_t trimLengthPositive = static_cast<size_t>(trimLength); // now we are sure it is positive
size_t trimLengthPositive = trimLength; // now we are sure it is positive
size_t start = cs->numchars(pos, end); // Here, start is number of characters in src
if (start <= trimLengthPositive)
return src.safeString("");