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

@ -69,7 +69,7 @@ class SimpleColumn_UINT : public SimpleColumn
}
/** Evaluate methods */
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override;
virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
@ -148,10 +148,13 @@ void SimpleColumn_UINT<len>::setNullVal()
}
template <int len>
inline const std::string& SimpleColumn_UINT<len>::getStrVal(rowgroup::Row& row, bool& isNull)
inline const utils::NullString& SimpleColumn_UINT<len>::getStrVal(rowgroup::Row& row, bool& isNull)
{
if (row.equals<len>(fNullVal, fInputIndex))
{
isNull = true;
fResult.strVal.dropString();
}
else
{
#ifndef __LP64__
@ -159,9 +162,9 @@ inline const std::string& SimpleColumn_UINT<len>::getStrVal(rowgroup::Row& row,
#else
snprintf(tmp, 21, "%lu", row.getUintField<len>(fInputIndex));
#endif
fResult.strVal.assign(std::string(tmp));
}
fResult.strVal = std::string(tmp);
return fResult.strVal;
}