You've already forked mariadb-columnstore-engine
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:
committed by
Roman Nozdrin
parent
0ea592da80
commit
b53c231ca6
@ -367,14 +367,14 @@ bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedCol
|
||||
// like operator. both sides are string.
|
||||
if (fOp == OP_LIKE || fOp == OP_NOTLIKE)
|
||||
{
|
||||
const std::string& subject = lop->getStrVal(row, isNull);
|
||||
const auto& subject = lop->getStrVal(row, isNull);
|
||||
if (isNull)
|
||||
return false;
|
||||
const std::string& pattern = rop->getStrVal(row, isNull);
|
||||
const auto& pattern = rop->getStrVal(row, isNull);
|
||||
if (isNull)
|
||||
return false;
|
||||
return datatypes::Charset(cs).like(fOp == OP_NOTLIKE, utils::ConstString(subject),
|
||||
utils::ConstString(pattern));
|
||||
return datatypes::Charset(cs).like(fOp == OP_NOTLIKE, utils::ConstString(subject.str(), subject.length()),
|
||||
utils::ConstString(pattern.str(), pattern.length()));
|
||||
}
|
||||
|
||||
// fOpType should have already been set on the connector during parsing
|
||||
@ -709,11 +709,15 @@ bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedCol
|
||||
if (isNull)
|
||||
return false;
|
||||
|
||||
const std::string& val1 = lop->getStrVal(row, isNull);
|
||||
const auto& val1 = lop->getStrVal(row, isNull);
|
||||
if (isNull)
|
||||
return false;
|
||||
|
||||
return strTrimCompare(val1, rop->getStrVal(row, isNull)) && !isNull;
|
||||
const auto& val2 = rop->getStrVal(row, isNull);
|
||||
if (isNull)
|
||||
return false;
|
||||
|
||||
return strTrimCompare(val1.safeString(""), val2.safeString(""));
|
||||
}
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARBINARY:
|
||||
|
Reference in New Issue
Block a user