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

MCOL-3435 Don't put nested aggregate into implied group by. Use the csep group by instead of groupByColumnVec.

This commit is contained in:
David Hall
2019-09-12 09:50:39 -05:00
parent 5c8ff4a1eb
commit f238a09ee0

View File

@ -514,11 +514,24 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J
// no group by by inserting a group by for window parameters.
if (hasAggregation)
{
uint32_t tupleKey = getTupleKey(jobInfo, *j, true);
if (find(jobInfo.groupByColVec.begin(), jobInfo.groupByColVec.end(), tupleKey)
== jobInfo.groupByColVec.end())
// If an argument is an AggregateColumn, don't group by it.
if (dynamic_cast<AggregateColumn*>(j->get()) == NULL)
{
jobInfo.groupByColVec.push_back(tupleKey);
bool bFound = false;
for (std::vector<SRCP>::iterator igpc = csep->groupByCols().begin();
igpc < csep->groupByCols().end();
++igpc)
{
if (*igpc->get() == *j->get())
{
bFound = true;
break;
}
}
if (!bFound)
{
csep->groupByCols().push_back(*j);
}
}
}
}