Example usage for org.apache.hadoop.fs LocatedFileStatus LocatedFileStatus

List of usage examples for org.apache.hadoop.fs LocatedFileStatus LocatedFileStatus

Introduction

In this page you can find the example usage for org.apache.hadoop.fs LocatedFileStatus LocatedFileStatus.

Prototype

public LocatedFileStatus(FileStatus stat, BlockLocation[] locations) 

Source Link

Document

Constructor

Usage

From source file:com.facebook.presto.hive.PrestoS3FileSystem.java

License:Apache License

private LocatedFileStatus createLocatedFileStatus(FileStatus status) {
    try {//  w ww .  ja  v a 2 s  . co  m
        BlockLocation[] fakeLocation = getFileBlockLocations(status, 0, status.getLen());
        return new LocatedFileStatus(status, fakeLocation);
    } catch (IOException e) {
        throw propagate(e);
    }
}

From source file:com.facebook.presto.hive.s3.PrestoS3FileSystem.java

License:Apache License

private LocatedFileStatus createLocatedFileStatus(FileStatus status) {
    try {// w  ww  .  ja v  a 2s .  co m
        BlockLocation[] fakeLocation = getFileBlockLocations(status, 0, status.getLen());
        return new LocatedFileStatus(status, fakeLocation);
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
}

From source file:com.facebook.presto.hive.util.TestAsyncRecursiveWalker.java

License:Apache License

private static FileSystem createMockFileSystem(final Map<String, List<FileStatus>> paths) {
    return new StubFileSystem() {
        @Override/* w w  w  . ja v  a 2 s  . c o m*/
        public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException {
            ImmutableList.Builder<LocatedFileStatus> list = ImmutableList.builder();
            for (FileStatus status : paths.get(f.toString())) {
                list.add(new LocatedFileStatus(status, new BlockLocation[0]));
            }
            return remoteIterator(list.build().iterator());
        }

        @Override
        public FileStatus[] listStatus(Path f) throws IOException {
            List<FileStatus> fileStatuses = paths.get(f.toString());
            return fileStatuses.toArray(new FileStatus[fileStatuses.size()]);
        }
    };
}

From source file:com.ibm.stocator.fs.cos.COSAPIClient.java

License:Apache License

/**
 * Build a {@link LocatedFileStatus} from a {@link FileStatus} instance.
 * @param status file status//from   ww w  .  j av a2s  . c om
 * @return a located status with block locations set up from this FS
 * @throws IOException IO Problems
 */
LocatedFileStatus toLocatedFileStatus(FileStatus status) throws IOException {
    return new LocatedFileStatus(status, null);
}

From source file:io.prestosql.plugin.hive.s3.PrestoS3FileSystem.java

License:Apache License

private LocatedFileStatus createLocatedFileStatus(FileStatus status) {
    try {/*from   w  w w.j  a va2  s. c o m*/
        BlockLocation[] fakeLocation = getFileBlockLocations(status, 0, status.getLen());
        return new LocatedFileStatus(status, fakeLocation);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:org.apache.hive.common.util.MockFileSystem.java

License:Apache License

private LocatedFileStatus createLocatedStatus(MockFile file) throws IOException {
    FileStatus fileStatus = createStatus(file);
    return new LocatedFileStatus(fileStatus,
            getFileBlockLocationsImpl(fileStatus, 0, fileStatus.getLen(), false));
}

From source file:org.apache.hive.common.util.MockFileSystem.java

License:Apache License

private LocatedFileStatus createLocatedDirectory(Path dir) throws IOException {
    FileStatus fileStatus = createDirectory(dir);
    return new LocatedFileStatus(fileStatus,
            getFileBlockLocationsImpl(fileStatus, 0, fileStatus.getLen(), false));
}