Source:
private SortedMap<KeyExtent,Files> computeMappingFromPlan(FileSystem fs, ID tableId, Path srcPath) throws IOException, AccumuloException, AccumuloSecurityException, TableNotFoundException { Map<String,List<Destination>> fileDestinations = plan.getDestinations().stream() .collect(groupingBy(Destination::getFileName)); FileStatus[] statuses = fs.listStatus(srcPath, p -> !p.getName().equals(Constants.BULK_LOAD_MAPPING)); Map<String,Long> fileLens = getFileLenMap(statuses); if (!fileDestinations.keySet().equals(fileLens.keySet())) { throw new IllegalArgumentException( "Load plan files differ from directory files, symmetric difference : " + Sets.symmetricDifference(fileDestinations.keySet(), fileLens.keySet())); } KeyExtentCache extentCache = new ConcurrentKeyExtentCache(tableId, context); fileDestinations.values().stream().flatMap(List::stream) .filter(dest -> dest.getRangeType() == RangeType.DATA) .flatMap(dest -> Stream.of(dest.getStartRow(), dest.getEndRow())).filter(row -> row != null) .map(Text::new).sorted().distinct().forEach(row -> { try { extentCache.lookup(row); } catch (Exception e) { throw new RuntimeException(e); } }); SortedMap<KeyExtent,Files> mapping = new TreeMap<>(); for (Entry<String,List<Destination>> entry : fileDestinations.entrySet()) { String fileName = entry.getKey(); List<Destination> destinations = entry.getValue(); Set<KeyExtent> extents = mapDesitnationsToExtents(tableId, extentCache, destinations); long estSize = (long) (fileLens.get(fileName) / (double) extents.size()); for (KeyExtent keyExtent : extents) { mapping.computeIfAbsent(keyExtent, k -> new Files()) .add(new FileInfo(fileName, estSize, 0)); } } return mergeOverlapping(mapping); }

Target:
private SortedMap<KeyExtent,Files> computeMappingFromPlan(FileSystem fs, ID tableId, Path srcPath) throws IOException, AccumuloException, AccumuloSecurityException, TableNotFoundException { Map<String,List<Destination>> fileDestinations = plan.getDestinations().stream() .collect(groupingBy(Destination::getFileName)); FileStatus[] statuses = fs.listStatus(srcPath, p -> !p.getName().equals(Constants.BULK_LOAD_MAPPING)); Map<String,Long> fileLens = getFileLenMap(statuses); if (!fileDestinations.keySet().equals(fileLens.keySet())) { throw new IllegalArgumentException( "Load plan files differ from directory files, symmetric difference : " + Sets.symmetricDifference(fileDestinations.keySet(), fileLens.keySet())); } KeyExtentCache extentCache = new ConcurrentKeyExtentCache(tableId, context); fileDestinations.values().stream().flatMap(List::stream) .filter(dest -> dest.getRangeType() == RangeType.FILE) .flatMap(dest -> Stream.of(dest.getStartRow(), dest.getEndRow())).filter(row -> row != null) .map(Text::new).sorted().distinct().forEach(row -> { try { extentCache.lookup(row); } catch (Exception e) { throw new RuntimeException(e); } }); SortedMap<KeyExtent,Files> mapping = new TreeMap<>(); for (Entry<String,List<Destination>> entry : fileDestinations.entrySet()) { String fileName = entry.getKey(); List<Destination> destinations = entry.getValue(); Set<KeyExtent> extents = mapDesitnationsToExtents(tableId, extentCache, destinations); long estSize = (long) (fileLens.get(fileName) / (double) extents.size()); for (KeyExtent keyExtent : extents) { mapping.computeIfAbsent(keyExtent, k -> new Files()) .add(new FileInfo(fileName, estSize, 0)); } } return mergeOverlapping(mapping); }