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

@ -49,17 +49,17 @@ int64_t Func_instr::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNu
int64_t start0 = 0;
my_match_t match;
const std::string& str = parm[0]->data()->getStrVal(row, isNull);
if (isNull)
const auto& str = parm[0]->data()->getStrVal(row, isNull);
if (str.isNull())
return 0;
const char* s1 = str.c_str();
const char* s1 = str.str();
uint32_t l1 = (uint32_t)str.length();
const std::string& substr = parm[1]->data()->getStrVal(row, isNull);
if (isNull)
const auto& substr = parm[1]->data()->getStrVal(row, isNull);
if (substr.isNull())
return 0;
const char* s2 = substr.c_str();
const char* s2 = substr.str();
uint32_t l2 = (uint32_t)substr.length();
if (l2 < 1)
return start + 1;