Source:
<code>private List<Range> getIndexRanges(String indexTable, Multimap<AccumuloColumnConstraint, Range> constraintRanges, Collection<Range> rowIDRanges, Authorizations auths) throws TableNotFoundException, InterruptedException { Set<Range> finalRanges = new HashSet<>(); List<Future<Set<Range>>> tasks = new ArrayList<>(); CompletionService<Set<Range>> executor = new ExecutorCompletionService<>(executorService); for (Entry<AccumuloColumnConstraint, Collection<Range>> constraintEntry : constraintRanges.asMap().entrySet()) { tasks.add(executor.submit(() -> { BatchScanner scan = connector.createBatchScanner(indexTable, auths, 10); scan.setRanges(constraintEntry.getValue()); scan.fetchColumnFamily(new Text(Indexer.getIndexColumnFamily(constraintEntry.getKey().getFamily().getBytes(), constraintEntry.getKey().getQualifier().getBytes()).array())); Text tmpQualifier = new Text(); Set<Range> columnRanges = new HashSet<>(); for (Entry<Key, Value> entry : scan) { entry.getKey().getColumnQualifier(tmpQualifier); if (inRange(tmpQualifier, rowIDRanges)) { columnRanges.add(new Range(tmpQualifier)); } } LOG.info("Retrieved %d ranges for index column %s", columnRanges.size(), constraintEntry.getKey().getName()); scan.close(); return columnRanges; })); <START> } <END> tasks.forEach(future -> { try { if (finalRanges.isEmpty()) { finalRanges.addAll(future.get()); } else { finalRanges.retainAll(future.get()); } } catch (ExecutionException | InterruptedException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Exception when getting index ranges", e); } }); return ImmutableList.copyOf(finalRanges); }</code><technical_language>Formatting nit: this previous line</technical_language>

Target:
private List<Range> getIndexRanges(String indexTable, Multimap<AccumuloColumnConstraint, Range> constraintRanges, Collection<Range> rowIDRanges, Authorizations auths) throws TableNotFoundException, InterruptedException { Set<Range> finalRanges = new HashSet<>(); List<Future<Set<Range>>> tasks = new ArrayList<>(); CompletionService<Set<Range>> executor = new ExecutorCompletionService<>(executorService); for (Entry<AccumuloColumnConstraint, Collection<Range>> constraintEntry : constraintRanges.asMap().entrySet()) { tasks.add(executor.submit(() -> { BatchScanner scan = connector.createBatchScanner(indexTable, auths, 10); scan.setRanges(constraintEntry.getValue()); scan.fetchColumnFamily(new Text(Indexer.getIndexColumnFamily(constraintEntry.getKey().getFamily().getBytes(), constraintEntry.getKey().getQualifier().getBytes()).array())); Text tmpQualifier = new Text(); Set<Range> columnRanges = new HashSet<>(); for (Entry<Key, Value> entry : scan) { entry.getKey().getColumnQualifier(tmpQualifier); if (inRange(tmpQualifier, rowIDRanges)) { columnRanges.add(new Range(tmpQualifier)); } } LOG.debug("Retrieved %d ranges for index column %s", columnRanges.size(), constraintEntry.getKey().getName()); scan.close(); return columnRanges; })); } tasks.forEach(future -> { try { if (finalRanges.isEmpty()) { finalRanges.addAll(future.get()); } else { finalRanges.retainAll(future.get()); } } catch (ExecutionException | InterruptedException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Exception when getting index ranges", e.getCause()); } }); return ImmutableList.copyOf(finalRanges); }