1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +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

@ -23,7 +23,7 @@ CalpontSystemCatalog::ColType Func_json_array_insert::operationType(FunctionParm
string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& type)
{
const string_view js = fp[0]->data()->getStrVal(row, isNull);
const auto& js = fp[0]->data()->getStrVal(row, isNull);
if (isNull)
return "";
@ -31,15 +31,15 @@ string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
json_engine_t jsEg;
string retJS;
retJS.reserve(js.size() + 8);
retJS.reserve(js.length() + 8);
initJSPaths(paths, fp, 1, 2);
string tmpJS{js};
utils::NullString tmpJS(js);
for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++)
{
const char* rawJS = tmpJS.data();
const size_t jsLen = tmpJS.size();
const char* rawJS = tmpJS.str();
const size_t jsLen = tmpJS.length();
JSONPath& path = paths[j];
if (!path.parsed)
{
@ -122,7 +122,7 @@ string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
}
// tmpJS save the json string for next loop
tmpJS.swap(retJS);
tmpJS.assign(retJS);
retJS.clear();
}