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

MCOL-271 empty strings should not be NULLs (#2794)

This patch improves handling of NULLs in textual fields in ColumnStore.
Previously empty strings were considered NULLs and it could be a problem
if data scheme allows for empty strings. It was also one of major
reasons of behavior difference between ColumnStore and other engines in
MariaDB family.

Also, this patch fixes some other bugs and incorrect behavior, for
example, incorrect comparison for "column <= ''" which evaluates to
constant True for all purposes before this patch.
This commit is contained in:
Sergey Zefirov
2023-03-30 17:26:45 +01:00
committed by Roman Nozdrin
parent 0ea592da80
commit b53c231ca6
417 changed files with 12459 additions and 3520 deletions

View File

@ -95,6 +95,7 @@ string Func_concat_ws::getStrVal(Row& row, FunctionParm& parm, bool& isNull,
#endif
string str;
string tmp;
bool firstTime = true;
for (uint32_t i = 1; i < parm.size(); i++)
{
stringValue(parm[i], row, isNull, tmp);
@ -104,18 +105,20 @@ string Func_concat_ws::getStrVal(Row& row, FunctionParm& parm, bool& isNull,
continue;
}
if (!str.empty())
if (!firstTime) // XXX: XXX: XXX: concatenation of empty strings will result in empty string.
str += delim;
firstTime = false;
// TODO: Work on string reallocation. Use std::string::resize() to
// grab larger chunks in some intellegent manner.
str += tmp;
}
if (str.empty())
if (firstTime) {
// all arguments are NULL.
isNull = true;
else
isNull = false;
return str;
}
return str;
}