Optimization

This commit is contained in:
Justin Borromeo 2019-03-12 11:09:08 -07:00
parent cce917ab84
commit 45e95bb1f4
1 changed files with 3 additions and 2 deletions

View File

@ -259,13 +259,14 @@ public class ScanQueryEngine
} }
/** /**
* If we're performing time-ordering, we want to scan through every row in the segment (hence the maximum limit) * If we're performing time-ordering, we want to scan through the first `limit` rows ignoring the number
* of rows already counted on other segments.
*/ */
private long calculateLimit(ScanQuery query, Map<String, Object> responseContext) private long calculateLimit(ScanQuery query, Map<String, Object> responseContext)
{ {
if (query.getTimeOrder().equals(ScanQuery.TimeOrder.NONE)) { if (query.getTimeOrder().equals(ScanQuery.TimeOrder.NONE)) {
return query.getLimit() - (long) responseContext.get(ScanQueryRunnerFactory.CTX_COUNT); return query.getLimit() - (long) responseContext.get(ScanQueryRunnerFactory.CTX_COUNT);
} }
return Long.MAX_VALUE; return query.getLimit();
} }
} }