Search in sources :

Example 1 with HadoopFileStatus

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

the class MapRFileSystem method listStatus.

@Override
public FileStatus[] listStatus(final Path f) throws IOException {
    final org.apache.hadoop.fs.FileStatus[] hadoopFiles = this.fs.listStatus(new org.apache.hadoop.fs.Path(f.toString()));
    final FileStatus[] files = new FileStatus[hadoopFiles.length];
    // Convert types
    for (int i = 0; i < files.length; i++) {
        files[i] = new HadoopFileStatus(hadoopFiles[i]);
    }
    return files;
}
Also used : FileStatus(org.apache.flink.core.fs.FileStatus) HadoopFileStatus(org.apache.flink.runtime.fs.hdfs.HadoopFileStatus) HadoopFileStatus(org.apache.flink.runtime.fs.hdfs.HadoopFileStatus)

Example 2 with HadoopFileStatus

use of org.apache.flink.runtime.fs.hdfs.HadoopFileStatus 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

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