You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
fix(plugin): Same columns fom different views in GROUP BY do not produce errors (#3035)
Fixes MCOL-5643. The problem was that different views with same column names in GROUP BY and on the SELECT clause produced an error about "projection column is not an aggergate neither in GROUP BY list." This was due to incorrect search in expressions's list that lead to duplicate columns in GROUP BY list.
This commit is contained in:
@ -8075,23 +8075,31 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
ReturnedColumn* rc = buildSimpleColumn(ifp, gwi);
|
||||
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(rc);
|
||||
|
||||
for (uint32_t j = 0; j < gwi.returnedCols.size(); j++)
|
||||
{
|
||||
if (sc)
|
||||
if (sc)
|
||||
{
|
||||
bool found = false;
|
||||
for (uint32_t j = 0; j < gwi.returnedCols.size(); j++)
|
||||
{
|
||||
if (sc->sameColumn(gwi.returnedCols[j].get()))
|
||||
{
|
||||
sc->orderPos(j);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
else if (strcasecmp(sc->alias().c_str(), gwi.returnedCols[j]->alias().c_str()) == 0)
|
||||
}
|
||||
for (uint32_t j = 0; !found && j < gwi.returnedCols.size(); j++)
|
||||
{
|
||||
if (strcasecmp(sc->alias().c_str(), gwi.returnedCols[j]->alias().c_str()) == 0)
|
||||
{
|
||||
rc = gwi.returnedCols[j].get()->clone();
|
||||
rc->orderPos(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint32_t j = 0; j < gwi.returnedCols.size(); j++)
|
||||
{
|
||||
if (ifp->name.length && string(ifp->name.str) == gwi.returnedCols[j].get()->alias())
|
||||
{
|
||||
@ -8100,7 +8108,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
@ -9822,7 +9830,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
}
|
||||
}
|
||||
|
||||
srcp->orderPos(groupcol->counter - 1);
|
||||
srcp->orderPos(groupcol->counter - 1);
|
||||
gwi.groupByCols.push_back(srcp);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user