@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { // In some places (e.g. FileInputFormat) this BlockLocation is used to // figure out sizes/offsets and so a completely blank one will not work. String [] hosts = {"DUMMY_HOST"}; return new BlockLocation[]{new BlockLocation(null, hosts, 0, file.getLen())}; }
private static LocatedFileStatus locatedFileStatus(Path path) { return new LocatedFileStatus( 0L, false, 0, 0L, 0L, 0L, null, null, null, null, path, new BlockLocation[] {new BlockLocation()}); }
String[] host = {"localhost"}; return new BlockLocation[] { new BlockLocation(name, host, 0, file.getLen()) };
String[] hosts = addresses.stream().map(HostAndPort::getHost).toArray(String[]::new); blockLocations.add( new BlockLocation(names, hosts, offset, fileBlockInfo.getBlockInfo().getLength()));
blockLocations = new BlockLocation[] {new BlockLocation()};
private BlockLocation[] getFileBlockLocationsImpl(final FileStatus stat, final long start, final long len, final boolean updateStats) throws IOException { if (updateStats) { statistics.incrementReadOps(1); System.out.println("STATS: getFileBlockLocationsImpl - " + stat.getPath()); } checkAccess(); List<BlockLocation> result = new ArrayList<BlockLocation>(); MockFile file = findFile(stat.getPath()); if (file != null) { for(MockBlock block: file.blocks) { if (OrcInputFormat.SplitGenerator.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]; }
private BlockLocation[] getFileBlockLocationsImpl(final FileStatus stat, final long start, final long len, final boolean updateStats) throws IOException { if (updateStats) { statistics.incrementReadOps(1); } 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]; }
@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { return new BlockLocation[] { new BlockLocation(new String[] { "localhost:9866", "otherhost:9866" }, new String[] { "localhost", "otherhost" }, new String[] { "localhost" }, new String[0], 0, len, false) }; }
@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { return new BlockLocation[] { new BlockLocation(new String[] { "localhost:9866", "otherhost:9866" }, new String[] { "localhost", "otherhost" }, new String[] { "localhost" }, new String[0], 0, len, false) }; }
public Writable newInstance() { return new BlockLocation(); } });
@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { // In some places (e.g. FileInputFormat) this BlockLocation is used to // figure out sizes/offsets and so a completely blank one will not work. String [] hosts = {"DUMMY_HOST"}; return new BlockLocation[]{new BlockLocation(null, hosts, 0, file.getLen())}; }
@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { // In some places (e.g. FileInputFormat) this BlockLocation is used to // figure out sizes/offsets and so a completely blank one will not work. String [] hosts = {"DUMMY_HOST"}; return new BlockLocation[]{new BlockLocation(null, hosts, 0, file.getLen())}; }
@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { // In some places (e.g. FileInputFormat) this BlockLocation is used to // figure out sizes/offsets and so a completely blank one will not work. String [] hosts = {"DUMMY_HOST"}; return new BlockLocation[]{new BlockLocation(null, hosts, 0, file.getLen())}; }
@Override public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException { // In some places (e.g. FileInputFormat) this BlockLocation is used to // figure out sizes/offsets and so a completely blank one will not work. String [] hosts = {"DUMMY_HOST"}; return new BlockLocation[]{new BlockLocation(null, hosts, 0, file.getLen())}; }
public BlockLocation[] buildBlockLocations(String[] hosts, long blockSize) { String[] names = new String[hosts.length]; for (int i = 0; i < hosts.length; i++) { hosts[i] = "host" + i; names[i] = "host:" + port; } BlockLocation[] blockLocations = new BlockLocation[3]; blockLocations[0] = new BlockLocation(new String[]{names[0], names[1], names[2]}, new String[]{hosts[0], hosts[1], hosts[2]}, 0, blockSize); blockLocations[1] = new BlockLocation(new String[]{names[0], names[2], names[3]}, new String[]{hosts[0], hosts[2], hosts[3]}, blockSize, blockSize); blockLocations[2] = new BlockLocation(new String[]{names[0], names[1], names[3]}, new String[]{hosts[0], hosts[1], hosts[3]}, blockSize*2, blockSize); return blockLocations; }
private BlockLocation[] mockBlockLocations(long size, long splitSize) { int numLocations = (int) (size / splitSize); if (size % splitSize != 0) numLocations++; BlockLocation[] blockLocations = new BlockLocation[numLocations]; for (int i = 0; i < numLocations; i++) { String[] names = new String[] { "b" + i }; String[] hosts = new String[] { "host" + i }; blockLocations[i] = new BlockLocation(names, hosts, i * splitSize, Math.min(splitSize, size - (splitSize * i))); } return blockLocations; } }
private BlockLocation[] mockBlockLocations(long size, long splitSize) { int numLocations = (int) (size / splitSize); if (size % splitSize != 0) numLocations++; BlockLocation[] blockLocations = new BlockLocation[numLocations]; for (int i = 0; i < numLocations; i++) { String[] names = new String[] { "b" + i }; String[] hosts = new String[] { "host" + i }; blockLocations[i] = new BlockLocation(names, hosts, i * splitSize, Math.min(splitSize, size - (splitSize * i))); } return blockLocations; } }
private static LocatedFileStatus locatedFileStatus(Path path) { return new LocatedFileStatus( 0L, false, 0, 0L, 0L, 0L, null, null, null, null, path, new BlockLocation[] {new BlockLocation()}); }
private static LocatedFileStatus locatedFileStatus(Path path) { return new LocatedFileStatus( 0L, false, 0, 0L, 0L, 0L, null, null, null, null, path, new BlockLocation[] {new BlockLocation()}); }
private static LocatedFileStatus locatedFileStatus(Path path) { return new LocatedFileStatus( 0L, false, 0, 0L, 0L, 0L, null, null, null, null, path, new BlockLocation[] {new BlockLocation()}); }