Created an error message for when someone tries to time order a result

set > threshold limit
This commit is contained in:
Justin Borromeo 2019-02-06 15:36:24 -08:00
parent e8a4b49044
commit 7e872a8ebc
1 changed files with 168 additions and 161 deletions

View File

@ -91,14 +91,14 @@ public class ScanQueryQueryToolChest extends QueryToolChest<ScanResultValue, Sca
}
};
if (scanQuery.getTimeOrder().equals(ScanQuery.TIME_ORDER_NONE) ||
scanQuery.getLimit() > maxRowsForInMemoryTimeOrdering) {
if (scanQuery.getTimeOrder().equals(ScanQuery.TIME_ORDER_NONE)) {
if (scanQuery.getLimit() == Long.MAX_VALUE) {
return runner.run(queryPlusWithNonNullLegacy, responseContext);
}
return new BaseSequence<ScanResultValue, ScanQueryLimitRowIterator>(scanQueryLimitRowIteratorMaker);
} else if (scanQuery.getTimeOrder().equals(ScanQuery.TIME_ORDER_ASCENDING) ||
scanQuery.getTimeOrder().equals(ScanQuery.TIME_ORDER_DESCENDING)) {
} else if ((scanQuery.getTimeOrder().equals(ScanQuery.TIME_ORDER_ASCENDING) ||
scanQuery.getTimeOrder().equals(ScanQuery.TIME_ORDER_DESCENDING))
&& scanQuery.getLimit() <= scanQueryConfig.getMaxRowsTimeOrderedInMemory()) {
Iterator<ScanResultValue> scanResultIterator = scanQueryLimitRowIteratorMaker.make();
return new BaseSequence(
@ -119,6 +119,13 @@ public class ScanQueryQueryToolChest extends QueryToolChest<ScanResultValue, Sca
CloseQuietly.close(iterFromMake);
}
});
} else if (scanQuery.getLimit() > scanQueryConfig.getMaxRowsTimeOrderedInMemory()) {
throw new UOE(
"Time ordering for result set limit of %s is not supported. Try lowering the "
+ "result set size to less than or equal to the time ordering limit of %s.",
scanQuery.getLimit(),
scanQueryConfig.getMaxRowsTimeOrderedInMemory()
);
} else {
throw new UOE("Time ordering [%s] is not supported", scanQuery.getTimeOrder());
}