You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
MCOL-951 revert bad optimization from UDAF
This commit is contained in:
@@ -2576,22 +2576,22 @@ void TupleAggregateStep::prep2PhasesAggregate(
|
|||||||
{
|
{
|
||||||
// check if there are any aggregate columns
|
// check if there are any aggregate columns
|
||||||
// a vector that has the aggregate function to be done by PM
|
// a vector that has the aggregate function to be done by PM
|
||||||
// vector<pair<uint32_t, int> > aggColVec;
|
vector<pair<uint32_t, int> > aggColVec;
|
||||||
set<uint32_t> avgSet;
|
set<uint32_t> avgSet;
|
||||||
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
|
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
|
||||||
// for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
||||||
// {
|
{
|
||||||
// skip if not an aggregation column
|
// skip if not an aggregation column
|
||||||
// if (returnedColVec[i].second == 0)
|
if (returnedColVec[i].second == 0)
|
||||||
// continue;
|
continue;
|
||||||
|
|
||||||
// aggColVec.push_back(returnedColVec[i]);
|
aggColVec.push_back(returnedColVec[i]);
|
||||||
|
|
||||||
// remember if a column has an average function,
|
// remember if a column has an average function,
|
||||||
// with avg function, no need for separate sum or count_column_name
|
// with avg function, no need for separate sum or count_column_name
|
||||||
// if (returnedColVec[i].second == AggregateColumn::AVG)
|
if (returnedColVec[i].second == AggregateColumn::AVG)
|
||||||
// avgSet.insert(returnedColVec[i].first);
|
avgSet.insert(returnedColVec[i].first);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// populate the aggregate rowgroup on PM and UM
|
// populate the aggregate rowgroup on PM and UM
|
||||||
// PM: projectedRG -> aggregateRGPM
|
// PM: projectedRG -> aggregateRGPM
|
||||||
@@ -2713,16 +2713,12 @@ void TupleAggregateStep::prep2PhasesAggregate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// vectors for aggregate functions
|
// vectors for aggregate functions
|
||||||
for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
for (uint64_t i = 0; i < aggColVec.size(); i++)
|
||||||
{
|
{
|
||||||
// skip if not an aggregation column
|
|
||||||
if (returnedColVec[i].second == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pUDAFFunc = NULL;
|
pUDAFFunc = NULL;
|
||||||
uint32_t aggKey = returnedColVec[i].first;
|
uint32_t aggKey = aggColVec[i].first;
|
||||||
RowAggFunctionType aggOp = functionIdMap(returnedColVec[i].second);
|
RowAggFunctionType aggOp = functionIdMap(aggColVec[i].second);
|
||||||
RowAggFunctionType stats = statsFuncIdMap(returnedColVec[i].second);
|
RowAggFunctionType stats = statsFuncIdMap(aggColVec[i].second);
|
||||||
|
|
||||||
// skip on PM if this is a constant
|
// skip on PM if this is a constant
|
||||||
if (aggOp == ROWAGG_CONSTANT)
|
if (aggOp == ROWAGG_CONSTANT)
|
||||||
@@ -2742,8 +2738,7 @@ void TupleAggregateStep::prep2PhasesAggregate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((aggOp == ROWAGG_SUM || aggOp == ROWAGG_COUNT_COL_NAME) &&
|
if ((aggOp == ROWAGG_SUM || aggOp == ROWAGG_COUNT_COL_NAME) &&
|
||||||
(returnedColVec[i].second == AggregateColumn::AVG))
|
(avgSet.find(aggKey) != avgSet.end()))
|
||||||
// (avgSet.find(aggKey) != avgSet.end()))
|
|
||||||
// skip sum / count(column) if avg is also selected
|
// skip sum / count(column) if avg is also selected
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user