1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-4453 Fix SELECT ... LIMIT 0, now it returns an empty set as expected

This commit is contained in:
Alexey Antipovsky
2020-12-16 18:50:21 +03:00
parent 5d4d7c100c
commit 45c34553db

View File

@@ -429,6 +429,13 @@ void TupleAnnexStep::executeNoOrderBy()
continue; continue;
} }
if (UNLIKELY(fRowsReturned >= fLimitCount))
{
fLimitHit = true;
fJobList->abortOnLimit((JobStep*) this);
continue;
}
if (fConstant) if (fConstant)
fConstant->fillInConstants(fRowIn, fRowOut); fConstant->fillInConstants(fRowIn, fRowOut);
else else
@@ -441,11 +448,6 @@ void TupleAnnexStep::executeNoOrderBy()
fRowOut.nextRow(); fRowOut.nextRow();
fRowIn.nextRow(); fRowIn.nextRow();
} }
else
{
fLimitHit = true;
fJobList->abortOnLimit((JobStep*) this);
}
} }
if (fRowGroupOut.getRowCount() > 0) if (fRowGroupOut.getRowCount() > 0)
@@ -523,15 +525,17 @@ void TupleAnnexStep::executeNoOrderByWithDistinct()
if (inserted.second) if (inserted.second)
{ {
fRowGroupOut.incRowCount(); if (UNLIKELY(fRowsReturned >= fLimitCount))
fRowOut.nextRow();
if (UNLIKELY(++fRowsReturned >= fLimitCount))
{ {
fLimitHit = true; fLimitHit = true;
fJobList->abortOnLimit((JobStep*) this); fJobList->abortOnLimit((JobStep*) this);
continue;
} }
++fRowsReturned;
fRowGroupOut.incRowCount();
fRowOut.nextRow();
if (UNLIKELY(fRowGroupOut.getRowCount() >= rowgroup::rgCommonSize)) if (UNLIKELY(fRowGroupOut.getRowCount() >= rowgroup::rgCommonSize))
{ {
dataVec.push_back(rgDataOut); dataVec.push_back(rgDataOut);