List of usage examples for org.apache.hadoop.fs BlockLocation BlockLocation
public BlockLocation(String[] names, String[] hosts, String[] topologyPaths, long offset, long length)
From source file:org.apache.hive.common.util.MockFileSystem.java
License:Apache License
private BlockLocation[] getFileBlockLocationsImpl(final FileStatus stat, final long start, final long len, final boolean updateStats) throws IOException { if (updateStats) { statistics.incrementReadOps(1);// ww w. jav a 2s . c om } checkAccess(); List<BlockLocation> result = new ArrayList<BlockLocation>(); MockFile file = findFile(stat.getPath()); if (file != null) { for (MockBlock block : file.blocks) { if (getOverlap(block.offset, block.length, start, len) > 0) { String[] topology = new String[block.hosts.length]; for (int i = 0; i < topology.length; ++i) { topology[i] = "/rack/ " + block.hosts[i]; } result.add(new BlockLocation(block.hosts, block.hosts, topology, block.offset, block.length)); } } return result.toArray(new BlockLocation[result.size()]); } return new BlockLocation[0]; }