You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-12-10 22:42:30 +03:00
@@ -1525,7 +1525,7 @@ void parseExecutionPlan(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo,
|
|||||||
// bug4531, window function support
|
// bug4531, window function support
|
||||||
WindowFunctionStep::checkWindowFunction(csep, jobInfo);
|
WindowFunctionStep::checkWindowFunction(csep, jobInfo);
|
||||||
|
|
||||||
// bug3391, move forward the aggregation check for no aggregte having clause.
|
// bug3391, move forward the aggregation check for no aggregate having clause.
|
||||||
checkAggregation(csep, jobInfo);
|
checkAggregation(csep, jobInfo);
|
||||||
|
|
||||||
// include filters in having clause, if any.
|
// include filters in having clause, if any.
|
||||||
|
|||||||
@@ -477,6 +477,17 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J
|
|||||||
colSet.insert(key);
|
colSet.insert(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MCOL-3435 We haven't yet checked for aggregate, but we need to know
|
||||||
|
bool hasAggregation = false;
|
||||||
|
for (uint64_t i = 0; i < jobInfo.deliveredCols.size(); i++)
|
||||||
|
{
|
||||||
|
if (dynamic_cast<AggregateColumn*>(jobInfo.deliveredCols[i].get()) != NULL)
|
||||||
|
{
|
||||||
|
hasAggregation = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add non-duplicate auxiliary columns
|
// add non-duplicate auxiliary columns
|
||||||
RetColsVector colsInAf;
|
RetColsVector colsInAf;
|
||||||
|
|
||||||
@@ -499,10 +510,30 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J
|
|||||||
if (colSet.find(key) == colSet.end())
|
if (colSet.find(key) == colSet.end())
|
||||||
{
|
{
|
||||||
jobInfo.deliveredCols.push_back(*j);
|
jobInfo.deliveredCols.push_back(*j);
|
||||||
// MCOL-3343 Enable this if we decide to allow Window Functions to run with
|
// MCOL-3435 Allow Window Functions to run with aggregates with
|
||||||
// aggregates with no group by. MariaDB allows this. Nobody else in the world does.
|
// no group by by inserting a group by for window parameters.
|
||||||
// There will be more work to get it to function if we try this.
|
if (hasAggregation)
|
||||||
// jobInfo.windowSet.insert(getTupleKey(jobInfo, *j, true));
|
{
|
||||||
|
// If an argument is an AggregateColumn, don't group by it.
|
||||||
|
if (dynamic_cast<AggregateColumn*>(j->get()) == NULL)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colSet.insert(key);
|
colSet.insert(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user