1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-1196 Error when using OR in case THEN portion

In ha_calpont_execplan, Allow OR to be parsed; in searched_case parsing, reverse the order of processing arguments so that ptWorkStack.pop() is executed in the same order as the arguments being processed.

In func_case, modify to pass left and right to getBoolVal, if they exist.
This commit is contained in:
David Hall
2018-03-27 12:43:43 -05:00
parent acfddceb8a
commit 73b1ac68fa
2 changed files with 15 additions and 4 deletions

View File

@ -2553,6 +2553,10 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp
break;
}
case Item::COND_ITEM:
{
break;
}
default:
{
gwi.fatalParseError = true;
@ -3183,6 +3187,7 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS
if (((Item_func_case*)item)->get_first_expr_num() == -1)
funcName = "case_searched";
funcParms.reserve(item->argument_count());
if (gwi.clauseType == SELECT || gwi.clauseType == HAVING || gwi.clauseType == GROUP_BY) // select clause
{
// the first argument
@ -3233,13 +3238,12 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS
gwi.clauseType = SELECT;
if (funcName == "case_searched")
{
for (uint32_t i = 0; i < item->argument_count(); i++)
for (int32_t i = item->argument_count()-1; i >=0; i--)
{
if (i % 2 == 0 && i != item->argument_count()-1)
if (i % 2 == 0 && uint(i) != item->argument_count()-1)
{
// build item from arguments to avoid parm sequence complexity
sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport));
funcParms.push_back(sptp);
if (!gwi.ptWorkStack.empty())
gwi.ptWorkStack.pop();
}
@ -3258,8 +3262,8 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS
if (!gwi.ptWorkStack.empty())
gwi.ptWorkStack.pop();
}
funcParms.push_back(sptp);
}
funcParms.insert(funcParms.begin(), sptp);
}
}
else // simple_case

View File

@ -470,6 +470,13 @@ bool Func_searched_case::getBoolVal(Row& row,
if (isNull)
return joblist::BIGINTNULL;
ParseTree* lop = parm[i+1]->left();
ParseTree* rop = parm[i+1]->right();
if (lop && rop)
{
return (reinterpret_cast<Operator*>(parm[i+1]->data()))->getBoolVal(row, isNull, lop, rop);
}
return parm[i+1]->data()->getBoolVal(row, isNull);
}