avoid creating mergeSeqence when not required

This commit is contained in:
Nishant 2015-08-06 14:25:13 +05:30
parent b33c644da0
commit 1a46c4c71c
1 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@ package io.druid.query;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.metamx.common.guava.Sequence;
import com.metamx.common.guava.Sequences;
@ -90,9 +91,11 @@ public class RetryQueryRunner<T> implements QueryRunner<T>
if (!config.isReturnPartialResults() && !finalMissingSegs.isEmpty()) {
throw new SegmentMissingException("No results found for segments[%s]", finalMissingSegs);
}
return toolChest.mergeSequencesUnordered(Sequences.simple(listOfSequences)).toYielder(initValue, accumulator);
}
else {
return Iterables.getOnlyElement(listOfSequences).toYielder(initValue, accumulator);
}
return toolChest.mergeSequencesUnordered(Sequences.simple(listOfSequences)).toYielder(initValue, accumulator);
}
};
}