Java Code Examples for org.apache.hadoop.fs.FSError

The following examples show how to use org.apache.hadoop.fs.FSError. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dremio-oss   Source File: HadoopFileSystem.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Canonicalizes a path if supported by the filesystem
 *
 * @param fs   the filesystem to use
 * @param path the path to canonicalize
 * @return the canonicalized path, or the same path if not supported by the filesystem.
 * @throws IOException
 */
public static Path canonicalizePath(org.apache.hadoop.fs.FileSystem fs, Path path) throws IOException {
  try {
    if (fs instanceof PathCanonicalizer) {
      final org.apache.hadoop.fs.Path hadoopPath = toHadoopPath(path);
      final org.apache.hadoop.fs.Path result = ((PathCanonicalizer) fs).canonicalizePath(hadoopPath);
      if (hadoopPath == result) {
        return path;
      }
      return fromHadoopPath(result);
    }
    return path;
  } catch (FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 2
Source Project: dremio-oss   Source File: HadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Deprecated
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission, boolean overwrite, int bufferSize,
    short replication, long blockSize, Progressable progress) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.createNonRecursive(f, permission, overwrite, bufferSize, replication,
        blockSize, progress));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 3
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int read(ByteBuffer dst) throws IOException {
  try {
    return underlyingIs.read(dst);
  } catch(FSError e) {
    throw DremioHadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 4
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(int b) throws IOException {
  try {
    underlyingOS.write(b);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 5
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int available() throws IOException {
  try {
    return underlyingIs.available();
  } catch(FSError e) {
    throw DremioHadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 6
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void hflush() throws IOException {
  try {
    underlyingOS.hflush();
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 7
Source Project: dremio-oss   Source File: HadoopFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setPermission(Path p, Set<PosixFilePermission> permissions) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.setPermission(toHadoopPath(p), toFsPermission(permissions));
  } catch (FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 8
Source Project: dremio-oss   Source File: HadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Deprecated
public boolean delete(Path f) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.delete(f);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 9
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void flush() throws IOException {
  try {
    underlyingOS.flush();
  } catch(FSError e) {
    propagateFSError(e);
  }
}
 
Example 10
Source Project: dremio-oss   Source File: HadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean createNewFile(Path f) throws IOException {
 try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.createNewFile(f);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 11
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public long skip(long n) throws IOException {
  try {
    return is.skip(n);
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 12
Source Project: dremio-oss   Source File: HadoopFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public DirectoryStream<FileAttributes> glob(Path pattern, Predicate<Path> filter)
  throws FileNotFoundException, IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return new ArrayDirectoryStream(underlyingFs.globStatus(toHadoopPath(pattern), toPathFilter(filter)));
  } catch (FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 13
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(byte[] b) throws IOException {
  try {
    underlyingOS.write(b);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 14
Source Project: dremio-oss   Source File: DremioHadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean isDirectory(Path f) throws IOException {
  final org.apache.hadoop.fs.Path p = toHadoopPath(f);
  boolean exists = false;
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    exists = underlyingFs.isDirectory(p);
    if (!exists && isNAS) {
      forceRefresh(f);
      exists = underlyingFs.isDirectory(p);
    }
  } catch(FSError e) {
    throw propagateFSError(e);
  }
  return exists;
}
 
Example 15
Source Project: dremio-oss   Source File: HadoopFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean isDirectory(Path f) throws IOException {
  final org.apache.hadoop.fs.Path p = toHadoopPath(f);
  boolean exists = false;
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    exists = underlyingFs.isDirectory(p);
    if (!exists && isNAS) {
      forceRefresh(f);
      exists = underlyingFs.isDirectory(p);
    }
  } catch (FSError e) {
    throw propagateFSError(e);
  }
  return exists;
}
 
Example 16
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public long skip(long n) throws IOException {
  try {
    return underlyingIs.skip(n);
  } catch(FSError e) {
    throw DremioHadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 17
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void reset() throws IOException {
  try {
    underlyingIs.reset();
  } catch(FSError e) {
    throw DremioHadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 18
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int available() throws IOException {
  try{
    return is.available();
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 19
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Most of the read are going to be block reads which use {@link #read(byte[], int,
 * int)}. So not adding stats for single byte reads.
 */
@Override
public int read() throws IOException {
  try {
    return is.read();
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 20
Source Project: dremio-oss   Source File: HadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void copyFromLocalFile(boolean delSrc, boolean overwrite, Path[] srcs, Path dst) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.copyFromLocalFile(delSrc, overwrite, srcs, dst);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 21
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setDropBehind(Boolean dropBehind) throws IOException {
  try {
    underlyingOS.setDropBehind(dropBehind);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 22
Source Project: dremio-oss   Source File: DremioHadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public FSOutputStream create(Path f) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.create(toHadoopPath(f)), f.toString());
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 23
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setDropBehind(Boolean dropBehind) throws IOException {
  try {
    underlyingOS.setDropBehind(dropBehind);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 24
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int read(byte[] b, int off, int len) throws IOException {
  try {
    return underlyingIs.read(b, off, len);
  } catch(FSError e) {
    throw HadoopFileSystem.propagateFSError(e);
  }
}
 
Example 25
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int read(ByteBuffer dst) throws IOException {
  try {
    return underlyingIs.read(dst);
  } catch(FSError e) {
    throw HadoopFileSystem.propagateFSError(e);
  }
}
 
Example 26
Source Project: dremio-oss   Source File: HadoopFileSystemWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public byte[] getXAttr(final Path path, final String name) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.getXAttr(path, name);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 27
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(byte[] b) throws IOException {
  try {
    underlyingOS.write(b);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example 28
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setDropBehind(Boolean dropBehind) throws IOException, UnsupportedOperationException {
  try {
    underlyingIs.setDropBehind(dropBehind);
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example 29
Source Project: dremio-oss   Source File: FSDataInputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int available() throws IOException {
  try {
    return underlyingIs.available();
  } catch(FSError e) {
    throw HadoopFileSystem.propagateFSError(e);
  }
}
 
Example 30
Source Project: dremio-oss   Source File: FSDataOutputStreamWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void flush() throws IOException {
  try {
    underlyingOS.flush();
  } catch(FSError e) {
    propagateFSError(e);
  }
}