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;
|
pair<DistinctMap_t::iterator, bool> inserted;
|
||||||
|
|
||||||
if (fConstant)
|
inserted = distinctMap->insert(fRowIn.getPointer());
|
||||||
fConstant->fillInConstants(fRowIn, fRowOut);
|
|
||||||
else
|
|
||||||
copyRow(fRowIn, &fRowOut);
|
|
||||||
|
|
||||||
++fRowsProcessed;
|
++fRowsProcessed;
|
||||||
fRowIn.nextRow();
|
|
||||||
|
|
||||||
inserted = distinctMap->insert(fRowOut.getPointer());
|
|
||||||
|
|
||||||
if (inserted.second)
|
if (inserted.second)
|
||||||
{
|
{
|
||||||
|
// skip first limit-start rows
|
||||||
|
if (distinctMap->size() <= fLimitStart)
|
||||||
|
{
|
||||||
|
fRowIn.nextRow();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (UNLIKELY(fRowsReturned >= fLimitCount))
|
if (UNLIKELY(fRowsReturned >= fLimitCount))
|
||||||
{
|
{
|
||||||
fLimitHit = true;
|
fLimitHit = true;
|
||||||
fJobList->abortOnLimit((JobStep*) this);
|
fJobList->abortOnLimit((JobStep*) this);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++fRowsReturned;
|
++fRowsReturned;
|
||||||
|
if (fConstant)
|
||||||
|
fConstant->fillInConstants(fRowIn, fRowOut);
|
||||||
|
else
|
||||||
|
copyRow(fRowIn, &fRowOut);
|
||||||
|
|
||||||
fRowGroupOut.incRowCount();
|
fRowGroupOut.incRowCount();
|
||||||
fRowOut.nextRow();
|
fRowOut.nextRow();
|
||||||
|
|
||||||
@@ -545,6 +550,8 @@ void TupleAnnexStep::executeNoOrderByWithDistinct()
|
|||||||
fRowGroupOut.getRow(0, &fRowOut);
|
fRowGroupOut.getRow(0, &fRowOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fRowIn.nextRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
more = fInputDL->next(fInputIterator, &rgDataIn);
|
more = fInputDL->next(fInputIterator, &rgDataIn);
|
||||||
|
Reference in New Issue
Block a user