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

@ -127,10 +127,10 @@ int64_t Func_ceil::getIntVal(Row& row, FunctionParm& parm, bool& isNull, Calpont
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
{
const string& str = parm[0]->data()->getStrVal(row, isNull);
const auto& str = parm[0]->data()->getStrVal(row, isNull);
if (!isNull)
ret = (int64_t)ceil(strtod(str.c_str(), 0));
ret = (int64_t)ceil(strtod(str.str(), 0));
}
break;
@ -252,10 +252,10 @@ uint64_t Func_ceil::getUintVal(Row& row, FunctionParm& parm, bool& isNull,
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
{
const string& str = parm[0]->data()->getStrVal(row, isNull);
const auto& str = parm[0]->data()->getStrVal(row, isNull);
if (!isNull)
ret = (uint64_t)ceil(strtod(str.c_str(), 0));
ret = (uint64_t)ceil(strtod(str.str(), 0));
}
break;
@ -313,10 +313,10 @@ double Func_ceil::getDoubleVal(Row& row, FunctionParm& parm, bool& isNull,
else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR ||
op_ct.colDataType == CalpontSystemCatalog::CHAR || op_ct.colDataType == CalpontSystemCatalog::TEXT)
{
const string& str = parm[0]->data()->getStrVal(row, isNull);
const auto& str = parm[0]->data()->getStrVal(row, isNull);
if (!isNull)
ret = ceil(strtod(str.c_str(), 0));
ret = ceil(strtod(str.str(), 0));
}
else if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE)
{
@ -370,10 +370,12 @@ long double Func_ceil::getLongDoubleVal(Row& row, FunctionParm& parm, bool& isNu
else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR ||
op_ct.colDataType == CalpontSystemCatalog::CHAR || op_ct.colDataType == CalpontSystemCatalog::TEXT)
{
const string& str = parm[0]->data()->getStrVal(row, isNull);
const auto& str = parm[0]->data()->getStrVal(row, isNull);
if (!isNull)
ret = ceil(strtod(str.c_str(), 0));
{
ret = ceil(strtod(str.str(), 0));
}
}
else if (op_ct.colDataType == CalpontSystemCatalog::DECIMAL ||
op_ct.colDataType == CalpontSystemCatalog::UDECIMAL)
@ -541,10 +543,10 @@ IDB_Decimal Func_ceil::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull,
case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::TEXT:
{
const string& str = parm[0]->data()->getStrVal(row, isNull);
const auto& str = parm[0]->data()->getStrVal(row, isNull);
if (!isNull)
ret.value = (int64_t)ceil(strtod(str.c_str(), 0));
ret.value = (int64_t)ceil(strtod(str.str(), 0));
}
break;