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(aggregation, disk-based) MCOL-5691 distinct aggregate disk based (#3145)
* fix(aggregation, disk-based): MCOL-5689 this fixes disk-based distinct aggregation functions Previously disk-based distinct aggregation functions produced incorrect results b/c there was no finalization applied for previous generations stored on disk. * fix(aggregation, disk-based): Fix disk-based COUNT(DISTINCT ...) queries. (Case 2). (Distinct & Multi-Distinct, Single- & Multi-Threaded). * fix(aggregation, disk-based): Fix disk-based DISTINCT & GROUP BY queries. (Case 1). (Distinct & Multi-Distinct, Single- & Multi-Threaded). --------- Co-authored-by: Theresa Hradilak <theresa.hradilak@gmail.com> Co-authored-by: Roman Nozdrin <rnozdrin@mariadb.com>
This commit is contained in:
@ -4099,6 +4099,18 @@ bool RowAggregationUM::nextRowGroup()
|
||||
return more;
|
||||
}
|
||||
|
||||
bool RowAggregationUM::nextOutputRowGroup()
|
||||
{
|
||||
bool more = fRowAggStorage->getNextOutputRGData(fCurRGData);
|
||||
|
||||
if (more)
|
||||
{
|
||||
fRowGroupOut->setData(fCurRGData.get());
|
||||
}
|
||||
|
||||
return more;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Row Aggregation constructor used on UM
|
||||
// For 2nd phase of two-phase case, from partial RG to final aggregated RG
|
||||
@ -4558,19 +4570,29 @@ void RowAggregationDistinct::addRowGroup(const RowGroup* pRows,
|
||||
//------------------------------------------------------------------------------
|
||||
void RowAggregationDistinct::doDistinctAggregation()
|
||||
{
|
||||
while (dynamic_cast<RowAggregationUM*>(fAggregator.get())->nextRowGroup())
|
||||
auto* umAggregator = dynamic_cast<RowAggregationUM*>(fAggregator.get());
|
||||
if (umAggregator)
|
||||
{
|
||||
fRowGroupIn.setData(fAggregator->getOutputRowGroup()->getRGData());
|
||||
|
||||
Row rowIn;
|
||||
fRowGroupIn.initRow(&rowIn);
|
||||
fRowGroupIn.getRow(0, &rowIn);
|
||||
|
||||
for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i, rowIn.nextRow())
|
||||
while (umAggregator->nextOutputRowGroup())
|
||||
{
|
||||
aggregateRow(rowIn);
|
||||
fRowGroupIn.setData(fAggregator->getOutputRowGroup()->getRGData());
|
||||
|
||||
Row rowIn;
|
||||
fRowGroupIn.initRow(&rowIn);
|
||||
fRowGroupIn.getRow(0, &rowIn);
|
||||
|
||||
for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i, rowIn.nextRow())
|
||||
{
|
||||
aggregateRow(rowIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << "RowAggregationDistinct: incorrect fAggregator class.";
|
||||
cerr << errmsg.str() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void RowAggregationDistinct::doDistinctAggregation_rowVec(vector<std::pair<Row::Pointer, uint64_t>>& inRows)
|
||||
|
Reference in New Issue
Block a user