small optimization in timeseries if 'skipEmptyBuckets' is true and cursor completed (#5178)

This commit is contained in:
Clint Wylie 2017-12-19 14:47:00 -08:00 committed by Himanshu
parent f18eba50ee
commit 1181411901
1 changed files with 4 additions and 4 deletions

View File

@ -62,6 +62,10 @@ public class TimeseriesQueryEngine
@Override @Override
public Result<TimeseriesResultValue> apply(Cursor cursor) public Result<TimeseriesResultValue> apply(Cursor cursor)
{ {
if (skipEmptyBuckets && cursor.isDone()) {
return null;
}
Aggregator[] aggregators = new Aggregator[aggregatorSpecs.size()]; Aggregator[] aggregators = new Aggregator[aggregatorSpecs.size()];
String[] aggregatorNames = new String[aggregatorSpecs.size()]; String[] aggregatorNames = new String[aggregatorSpecs.size()];
@ -70,10 +74,6 @@ public class TimeseriesQueryEngine
aggregatorNames[i] = aggregatorSpecs.get(i).getName(); aggregatorNames[i] = aggregatorSpecs.get(i).getName();
} }
if (skipEmptyBuckets && cursor.isDone()) {
return null;
}
try { try {
while (!cursor.isDone()) { while (!cursor.isDone()) {
for (Aggregator aggregator : aggregators) { for (Aggregator aggregator : aggregators) {