private TreeSet<IntermediateSplitInfo> getIntermediateSplits(
final JobContext context,
final Integer maxSplits )
throws IOException {
final Index[] indices = getIndices(context);
final DistributableQuery query = getQuery(context);
final String tableNamespace = getTableNamespace(context);
final TreeSet<IntermediateSplitInfo> splits = new TreeSet<IntermediateSplitInfo>();
for (final Index index : indices) {
if ((query != null) && !query.isSupported(index)) {
continue;
}
final String tableName = AccumuloUtils.getQualifiedTableName(
tableNamespace,
index.getId().getString());
final NumericIndexStrategy indexStrategy = index.getIndexStrategy();
final TreeSet<Range> ranges;
if (query != null) {
final MultiDimensionalNumericData indexConstraints = query.getIndexConstraints(indexStrategy);
if ((maxSplits != null) && (maxSplits > 0)) {
ranges = AccumuloUtils.byteArrayRangesToAccumuloRanges(AccumuloUtils.constraintsToByteArrayRanges(
indexConstraints,
indexStrategy,
maxSplits));