Class TrinoS3FileSystem

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.hadoop.conf.Configurable, org.apache.hadoop.security.token.DelegationTokenIssuer

    public class TrinoS3FileSystem
    extends org.apache.hadoop.fs.FileSystem
    • Constructor Detail

      • TrinoS3FileSystem

        public TrinoS3FileSystem()
    • Method Detail

      • initialize

        public void initialize​(URI uri,
                               org.apache.hadoop.conf.Configuration conf)
                        throws IOException
        Overrides:
        initialize in class org.apache.hadoop.fs.FileSystem
        Throws:
        IOException
      • getUri

        public URI getUri()
        Specified by:
        getUri in class org.apache.hadoop.fs.FileSystem
      • getWorkingDirectory

        public org.apache.hadoop.fs.Path getWorkingDirectory()
        Specified by:
        getWorkingDirectory in class org.apache.hadoop.fs.FileSystem
      • setWorkingDirectory

        public void setWorkingDirectory​(org.apache.hadoop.fs.Path path)
        Specified by:
        setWorkingDirectory in class org.apache.hadoop.fs.FileSystem
      • listStatus

        public org.apache.hadoop.fs.FileStatus[] listStatus​(org.apache.hadoop.fs.Path path)
                                                     throws IOException
        Specified by:
        listStatus in class org.apache.hadoop.fs.FileSystem
        Throws:
        IOException
      • listFiles

        public org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listFiles​(org.apache.hadoop.fs.Path path,
                                                                                                     boolean recursive)
        Overrides:
        listFiles in class org.apache.hadoop.fs.FileSystem
      • listLocatedStatus

        public org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listLocatedStatus​(org.apache.hadoop.fs.Path path)
        Overrides:
        listLocatedStatus in class org.apache.hadoop.fs.FileSystem
      • getFileStatus

        public org.apache.hadoop.fs.FileStatus getFileStatus​(org.apache.hadoop.fs.Path path)
                                                      throws IOException
        Specified by:
        getFileStatus in class org.apache.hadoop.fs.FileSystem
        Throws:
        IOException
      • open

        public org.apache.hadoop.fs.FSDataInputStream open​(org.apache.hadoop.fs.Path path,
                                                           int bufferSize)
        Specified by:
        open in class org.apache.hadoop.fs.FileSystem
      • create

        public org.apache.hadoop.fs.FSDataOutputStream create​(org.apache.hadoop.fs.Path path,
                                                              org.apache.hadoop.fs.permission.FsPermission permission,
                                                              boolean overwrite,
                                                              int bufferSize,
                                                              short replication,
                                                              long blockSize,
                                                              org.apache.hadoop.util.Progressable progress)
                                                       throws IOException
        Specified by:
        create in class org.apache.hadoop.fs.FileSystem
        Throws:
        IOException
      • append

        public org.apache.hadoop.fs.FSDataOutputStream append​(org.apache.hadoop.fs.Path f,
                                                              int bufferSize,
                                                              org.apache.hadoop.util.Progressable progress)
        Specified by:
        append in class org.apache.hadoop.fs.FileSystem
      • rename

        public boolean rename​(org.apache.hadoop.fs.Path src,
                              org.apache.hadoop.fs.Path dst)
                       throws IOException
        Specified by:
        rename in class org.apache.hadoop.fs.FileSystem
        Throws:
        IOException
      • delete

        public boolean delete​(org.apache.hadoop.fs.Path path,
                              boolean recursive)
                       throws IOException
        Specified by:
        delete in class org.apache.hadoop.fs.FileSystem
        Throws:
        IOException
      • mkdirs

        public boolean mkdirs​(org.apache.hadoop.fs.Path f,
                              org.apache.hadoop.fs.permission.FsPermission permission)
        Specified by:
        mkdirs in class org.apache.hadoop.fs.FileSystem
      • keyFromPath

        public static String keyFromPath​(org.apache.hadoop.fs.Path path)
      • getBucketName

        protected String getBucketName​(URI uri)
      • extractBucketName

        public static String extractBucketName​(URI uri)
        Helper function used to work around the fact that if you use an S3 bucket with an '_' that java.net.URI behaves differently and sets the host value to null whereas S3 buckets without '_' have a properly set host field. '_' is only allowed in S3 bucket names in us-east-1.
        Parameters:
        uri - The URI from which to extract a host value.
        Returns:
        The host value where uri.getAuthority() is used when uri.getHost() returns null as long as no UserInfo is present.
        Throws:
        IllegalArgumentException - If the bucket cannot be determined from the URI.