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

@ -186,10 +186,12 @@ int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
n++;
colValue = dataList[n];
n++;
// XXX check for "null"? what values do we have here?
utils::NullString nullColValue(colValue);
#ifdef DML_PACKAGE_DEBUG
// cout << "The column data: " << colName << " " << colValue << endl;
#endif
DMLColumn* aColumn = new DMLColumn(colName, colValue, false);
DMLColumn* aColumn = new DMLColumn(colName, nullColValue, false);
(aRowPtr->get_ColumnList()).push_back(aColumn);
}
@ -208,7 +210,7 @@ int InsertDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValues
initializeTable();
Row* aRowPtr = new Row();
std::string colName;
std::vector<std::string> colValList;
ColValuesList colValList;
for (int j = 0; j < columns; j++)
{
@ -258,7 +260,10 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
for (unsigned int i = 0; i < columnNameList.size(); i++)
{
DMLColumn* aColumn = new DMLColumn(columnNameList[i], valuesList[i], isNULL);
// XXX can here be NULLs?
idbassert(!isNULL);
utils::NullString ithValue(valuesList[i]);
DMLColumn* aColumn = new DMLColumn(columnNameList[i], ithValue);
(aRow->get_ColumnList()).push_back(aColumn);
}
@ -275,6 +280,7 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
while (iter != valuesList.end())
{
colValue = *iter;
utils::NullString nullColValue;
if (strcasecmp(colValue.c_str(), "NULL") == 0)
{
@ -282,10 +288,11 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
}
else
{
nullColValue.assign(colValue);
isNULL = false;
}
DMLColumn* aColumn = new DMLColumn(colName, colValue, isNULL);
DMLColumn* aColumn = new DMLColumn(colName, nullColValue, isNULL);
(aRow->get_ColumnList()).push_back(aColumn);
++iter;