Class S3FileIO
- java.lang.Object
-
- org.apache.iceberg.aws.s3.S3FileIO
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Serializable,java.lang.AutoCloseable,org.apache.iceberg.io.CredentialSupplier,org.apache.iceberg.io.DelegateFileIO,org.apache.iceberg.io.FileIO,org.apache.iceberg.io.SupportsBulkOperations,org.apache.iceberg.io.SupportsPrefixOperations,org.apache.iceberg.io.SupportsRecoveryOperations
public class S3FileIO extends java.lang.Object implements org.apache.iceberg.io.CredentialSupplier, org.apache.iceberg.io.DelegateFileIO, org.apache.iceberg.io.SupportsRecoveryOperationsFileIO implementation backed by S3.Locations used must follow the conventions for S3 URIs (e.g. s3://bucket/path...). URIs with schemes s3a, s3n, https are also treated as s3 file paths. Using this FileIO with other schemes will result in
ValidationException.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description S3FileIO()No-arg constructor to load the FileIO dynamically.S3FileIO(org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3Client> s3)Constructor with custom s3 supplier and S3FileIO properties.S3FileIO(org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3Client> s3, S3FileIOProperties s3FileIOProperties)Constructor with custom s3 supplier and S3FileIO properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description software.amazon.awssdk.services.s3.S3Clientclient()voidclose()voiddeleteFile(java.lang.String path)voiddeleteFiles(java.lang.Iterable<java.lang.String> paths)Deletes the given paths in a batched manner.voiddeletePrefix(java.lang.String prefix)This method provides a "best-effort" to delete all objects under the given prefix.protected voidfinalize()java.lang.StringgetCredential()voidinitialize(java.util.Map<java.lang.String,java.lang.String> props)java.lang.Iterable<org.apache.iceberg.io.FileInfo>listPrefix(java.lang.String prefix)org.apache.iceberg.io.InputFilenewInputFile(java.lang.String path)org.apache.iceberg.io.InputFilenewInputFile(java.lang.String path, long length)org.apache.iceberg.io.OutputFilenewOutputFile(java.lang.String path)java.util.Map<java.lang.String,java.lang.String>properties()booleanrecoverFile(java.lang.String path)
-
-
-
Constructor Detail
-
S3FileIO
public S3FileIO()
No-arg constructor to load the FileIO dynamically.All fields are initialized by calling
initialize(Map)later.
-
S3FileIO
public S3FileIO(org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3Client> s3)
Constructor with custom s3 supplier and S3FileIO properties.Calling
initialize(Map)will overwrite information set in this constructor.- Parameters:
s3- s3 supplier
-
S3FileIO
public S3FileIO(org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3Client> s3, S3FileIOProperties s3FileIOProperties)Constructor with custom s3 supplier and S3FileIO properties.Calling
initialize(Map)will overwrite information set in this constructor.- Parameters:
s3- s3 suppliers3FileIOProperties- S3 FileIO properties
-
-
Method Detail
-
newInputFile
public org.apache.iceberg.io.InputFile newInputFile(java.lang.String path)
- Specified by:
newInputFilein interfaceorg.apache.iceberg.io.FileIO
-
newInputFile
public org.apache.iceberg.io.InputFile newInputFile(java.lang.String path, long length)- Specified by:
newInputFilein interfaceorg.apache.iceberg.io.FileIO
-
newOutputFile
public org.apache.iceberg.io.OutputFile newOutputFile(java.lang.String path)
- Specified by:
newOutputFilein interfaceorg.apache.iceberg.io.FileIO
-
deleteFile
public void deleteFile(java.lang.String path)
- Specified by:
deleteFilein interfaceorg.apache.iceberg.io.FileIO
-
properties
public java.util.Map<java.lang.String,java.lang.String> properties()
- Specified by:
propertiesin interfaceorg.apache.iceberg.io.FileIO
-
deleteFiles
public void deleteFiles(java.lang.Iterable<java.lang.String> paths) throws org.apache.iceberg.io.BulkDeletionFailureExceptionDeletes the given paths in a batched manner.The paths are grouped by bucket, and deletion is triggered when we either reach the configured batch size or have a final remainder batch for each bucket.
- Specified by:
deleteFilesin interfaceorg.apache.iceberg.io.SupportsBulkOperations- Parameters:
paths- paths to delete- Throws:
org.apache.iceberg.io.BulkDeletionFailureException
-
listPrefix
public java.lang.Iterable<org.apache.iceberg.io.FileInfo> listPrefix(java.lang.String prefix)
- Specified by:
listPrefixin interfaceorg.apache.iceberg.io.SupportsPrefixOperations
-
deletePrefix
public void deletePrefix(java.lang.String prefix)
This method provides a "best-effort" to delete all objects under the given prefix.Bulk delete operations are used and no reattempt is made for deletes if they fail, but will log any individual objects that are not deleted as part of the bulk operation.
- Specified by:
deletePrefixin interfaceorg.apache.iceberg.io.SupportsPrefixOperations- Parameters:
prefix- prefix to delete
-
client
public software.amazon.awssdk.services.s3.S3Client client()
-
getCredential
public java.lang.String getCredential()
- Specified by:
getCredentialin interfaceorg.apache.iceberg.io.CredentialSupplier
-
initialize
public void initialize(java.util.Map<java.lang.String,java.lang.String> props)
- Specified by:
initializein interfaceorg.apache.iceberg.io.FileIO
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceorg.apache.iceberg.io.FileIO
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
recoverFile
public boolean recoverFile(java.lang.String path)
- Specified by:
recoverFilein interfaceorg.apache.iceberg.io.SupportsRecoveryOperations
-
-