You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
MCOL-4455 Fix ignoring LIMIT offset
"SELECT DISTINCT col FROM table LIMIT O,N" should skip first O rows
This commit is contained in:
@@ -513,26 +513,31 @@ void TupleAnnexStep::executeNoOrderByWithDistinct()
|
||||
{
|
||||
pair<DistinctMap_t::iterator, bool> inserted;
|
||||
|
||||
if (fConstant)
|
||||
fConstant->fillInConstants(fRowIn, fRowOut);
|
||||
else
|
||||
copyRow(fRowIn, &fRowOut);
|
||||
|
||||
inserted = distinctMap->insert(fRowIn.getPointer());
|
||||
++fRowsProcessed;
|
||||
fRowIn.nextRow();
|
||||
|
||||
inserted = distinctMap->insert(fRowOut.getPointer());
|
||||
|
||||
if (inserted.second)
|
||||
{
|
||||
// skip first limit-start rows
|
||||
if (distinctMap->size() <= fLimitStart)
|
||||
{
|
||||
fRowIn.nextRow();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UNLIKELY(fRowsReturned >= fLimitCount))
|
||||
{
|
||||
fLimitHit = true;
|
||||
fJobList->abortOnLimit((JobStep*) this);
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
++fRowsReturned;
|
||||
if (fConstant)
|
||||
fConstant->fillInConstants(fRowIn, fRowOut);
|
||||
else
|
||||
copyRow(fRowIn, &fRowOut);
|
||||
|
||||
fRowGroupOut.incRowCount();
|
||||
fRowOut.nextRow();
|
||||
|
||||
@@ -545,6 +550,8 @@ void TupleAnnexStep::executeNoOrderByWithDistinct()
|
||||
fRowGroupOut.getRow(0, &fRowOut);
|
||||
}
|
||||
}
|
||||
|
||||
fRowIn.nextRow();
|
||||
}
|
||||
|
||||
more = fInputDL->next(fInputIterator, &rgDataIn);
|
||||
|
Reference in New Issue
Block a user