Search in sources :

Example 1 with HadoopBlockLocation

use of org.apache.flink.runtime.fs.hdfs.HadoopBlockLocation in project flink by apache.

the class MapRFileSystem method getFileBlockLocations.

@Override
public BlockLocation[] getFileBlockLocations(final FileStatus file, final long start, final long len) throws IOException {
    if (!(file instanceof HadoopFileStatus)) {
        throw new IOException("file is not an instance of DistributedFileStatus");
    }
    final HadoopFileStatus f = (HadoopFileStatus) file;
    final org.apache.hadoop.fs.BlockLocation[] blkLocations = fs.getFileBlockLocations(f.getInternalFileStatus(), start, len);
    // Wrap up HDFS specific block location objects
    final HadoopBlockLocation[] distBlkLocations = new HadoopBlockLocation[blkLocations.length];
    for (int i = 0; i < distBlkLocations.length; i++) {
        distBlkLocations[i] = new HadoopBlockLocation(blkLocations[i]);
    }
    return distBlkLocations;
}
Also used : HadoopBlockLocation(org.apache.flink.runtime.fs.hdfs.HadoopBlockLocation) IOException(java.io.IOException) HadoopBlockLocation(org.apache.flink.runtime.fs.hdfs.HadoopBlockLocation) BlockLocation(org.apache.flink.core.fs.BlockLocation) HadoopFileStatus(org.apache.flink.runtime.fs.hdfs.HadoopFileStatus)

Aggregations

IOException (java.io.IOException)1 BlockLocation (org.apache.flink.core.fs.BlockLocation)1 HadoopBlockLocation (org.apache.flink.runtime.fs.hdfs.HadoopBlockLocation)1 HadoopFileStatus (org.apache.flink.runtime.fs.hdfs.HadoopFileStatus)1