Class TrinoS3FileSystem

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FileSystem
io.trino.hdfs.s3.TrinoS3FileSystem
All Implemented Interfaces:
FileSystemWithBatchDelete, MemoryAwareFileSystem, OpenTelemetryAwareFileSystem, Closeable, AutoCloseable, org.apache.hadoop.conf.Configurable, org.apache.hadoop.fs.PathCapabilities, org.apache.hadoop.security.token.DelegationTokenIssuer
Direct Known Subclasses:
TrinoCosFileSystem

public class TrinoS3FileSystem extends org.apache.hadoop.fs.FileSystem implements FileSystemWithBatchDelete, MemoryAwareFileSystem, OpenTelemetryAwareFileSystem
  • Field Details

  • Constructor Details

    • TrinoS3FileSystem

      public TrinoS3FileSystem()
  • Method Details

    • 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
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class org.apache.hadoop.fs.FileSystem
      Throws:
      IOException
    • setOpenTelemetry

      public void setOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry)
      Specified by:
      setOpenTelemetry in interface OpenTelemetryAwareFileSystem
    • getScheme

      public String getScheme()
      Overrides:
      getScheme in class org.apache.hadoop.fs.FileSystem
    • 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
    • create

      public org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path path, AggregatedMemoryContext aggregatedMemoryContext) throws IOException
      Specified by:
      create in interface MemoryAwareFileSystem
      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
    • deleteFiles

      public void deleteFiles(Collection<org.apache.hadoop.fs.Path> paths) throws IOException
      Specified by:
      deleteFiles in interface FileSystemWithBatchDelete
      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)
    • getS3Client

      public com.amazonaws.services.s3.AmazonS3 getS3Client()
    • 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.
    • getFileSystemStats

      public static TrinoS3FileSystemStats getFileSystemStats()