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

@ -53,15 +53,15 @@ CalpontSystemCatalog::ColType Func_find_in_set::operationType(FunctionParm& fp,
int64_t Func_find_in_set::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull,
CalpontSystemCatalog::ColType& op_ct)
{
const string& searchStr = parm[0]->data()->getStrVal(row, isNull);
if (isNull)
const auto& searchStr = parm[0]->data()->getStrVal(row, isNull);
if (searchStr.isNull())
return 0;
const string& setString = parm[1]->data()->getStrVal(row, isNull);
if (isNull)
const auto& setString = parm[1]->data()->getStrVal(row, isNull);
if (setString.isNull())
return 0;
if (searchStr.find(",") != string::npos)
if (searchStr.unsafeStringRef().find(",") != string::npos)
return 0;
if (setString.length() < searchStr.length())
@ -70,10 +70,10 @@ int64_t Func_find_in_set::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool
CHARSET_INFO* cs = op_ct.getCharset();
my_wc_t wc = 0;
const char* str_begin = setString.c_str();
const char* str_end = setString.c_str();
const char* str_begin = setString.str();
const char* str_end = setString.str();
const char* real_end = str_end + setString.length();
const char* find_str = searchStr.c_str();
const char* find_str = searchStr.str();
size_t find_str_len = searchStr.length();
int position = 0;
static const char separator = ',';