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
@ -2078,7 +2078,7 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
|
||||
}
|
||||
|
||||
if (udf->result_type() == STRING_RESULT)
|
||||
gwip->rcWorkStack.push(new ConstantColumn(buf.ptr()));
|
||||
gwip->rcWorkStack.push(new ConstantColumn(buf.ptr())); // XXX: constantcolumn from string = can it be NULL?
|
||||
else
|
||||
{
|
||||
gwip->rcWorkStack.push(new ConstantColumn(buf.ptr(), ConstantColumn::NUM));
|
||||
@ -2916,7 +2916,6 @@ uint32_t setAggOp(AggregateColumn* ac, Item_sum* isp)
|
||||
case Item_sum::SUM_BIT_FUNC:
|
||||
{
|
||||
string funcName = isp->func_name();
|
||||
|
||||
if (funcName.compare("bit_and(") == 0)
|
||||
ac->aggOp(AggregateColumn::BIT_AND);
|
||||
else if (funcName.compare("bit_or(") == 0)
|
||||
@ -4865,7 +4864,7 @@ static void processAggregateColumnConstArg(gp_walk_info& gwi, SRCP& parm, Aggreg
|
||||
return;
|
||||
}
|
||||
ConstantColumn* cc;
|
||||
if ((cc = dynamic_cast<ConstantColumn*>(rt)) && cc->type() == ConstantColumn::NULLDATA)
|
||||
if ((cc = dynamic_cast<ConstantColumn*>(rt)) && cc->isNull())
|
||||
{
|
||||
// Explicit NULL or a const function that evaluated to NULL
|
||||
cc = new ConstantColumnNull();
|
||||
@ -5739,16 +5738,25 @@ void gp_walk(const Item* item, void* arg)
|
||||
if (isp->result_type() == STRING_RESULT)
|
||||
{
|
||||
String val, *str = isp->val_str(&val);
|
||||
string cval;
|
||||
|
||||
if (str->ptr())
|
||||
if (str)
|
||||
{
|
||||
cval.assign(str->ptr(), str->length());
|
||||
}
|
||||
string cval;
|
||||
|
||||
gwip->rcWorkStack.push(new ConstantColumn(cval));
|
||||
(dynamic_cast<ConstantColumn*>(gwip->rcWorkStack.top()))->timeZone(gwip->timeZone);
|
||||
break;
|
||||
if (str->ptr())
|
||||
{
|
||||
cval.assign(str->ptr(), str->length());
|
||||
}
|
||||
|
||||
gwip->rcWorkStack.push(new ConstantColumn(cval));
|
||||
(dynamic_cast<ConstantColumn*>(gwip->rcWorkStack.top()))->timeZone(gwip->timeZone);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
gwip->rcWorkStack.push(new ConstantColumn("", ConstantColumn::NULLDATA));
|
||||
(dynamic_cast<ConstantColumn*>(gwip->rcWorkStack.top()))->timeZone(gwip->timeZone);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gwip->rcWorkStack.push(buildReturnedColumn(isp, *gwip, gwip->fatalParseError));
|
||||
@ -7477,7 +7485,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
collectAllCols(gwi, ifp);
|
||||
break;
|
||||
}
|
||||
|
||||
sc = buildSimpleColumn(ifp, gwi);
|
||||
|
||||
if (sc)
|
||||
|
Reference in New Issue
Block a user