Class S3FileIO
- All Implemented Interfaces:
Closeable,Serializable,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,org.apache.iceberg.io.SupportsStorageCredentials
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:
-
Constructor Summary
ConstructorsConstructorDescriptionS3FileIO()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, org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3AsyncClient> s3Async) Constructor with custom s3 supplier and s3Async supplier. -
Method Summary
Modifier and TypeMethodDescriptionsoftware.amazon.awssdk.services.s3.S3AsyncClientsoftware.amazon.awssdk.services.s3.S3AsyncClientasyncClient(String storagePath) software.amazon.awssdk.services.s3.S3Clientclient()software.amazon.awssdk.services.s3.S3Clientvoidclose()List<org.apache.iceberg.io.StorageCredential>voiddeleteFile(String path) voiddeleteFiles(Iterable<String> paths) Deletes the given paths in a batched manner.voiddeletePrefix(String prefix) This method provides a "best-effort" to delete all objects under the given prefix.protected voidfinalize()voidinitialize(Map<String, String> props) Iterable<org.apache.iceberg.io.FileInfo>listPrefix(String prefix) org.apache.iceberg.io.InputFilenewInputFile(String path) org.apache.iceberg.io.InputFilenewInputFile(String path, long length) org.apache.iceberg.io.OutputFilenewOutputFile(String path) booleanrecoverFile(String path) voidsetCredentials(List<org.apache.iceberg.io.StorageCredential> credentials) Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.io.FileIO
deleteFile, deleteFile, newInputFile, newInputFile, newInputFile, newInputFile
-
Constructor Details
-
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, org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3AsyncClient> s3Async) Constructor with custom s3 supplier and s3Async supplier.Calling
initialize(Map)will overwrite information set in this constructor.- Parameters:
s3- s3 suppliers3Async- s3Async supplier
-
-
Method Details
-
newInputFile
- Specified by:
newInputFilein interfaceorg.apache.iceberg.io.FileIO
-
newInputFile
- Specified by:
newInputFilein interfaceorg.apache.iceberg.io.FileIO
-
newOutputFile
- Specified by:
newOutputFilein interfaceorg.apache.iceberg.io.FileIO
-
deleteFile
- Specified by:
deleteFilein interfaceorg.apache.iceberg.io.FileIO
-
properties
- Specified by:
propertiesin interfaceorg.apache.iceberg.io.FileIO
-
deleteFiles
public void deleteFiles(Iterable<String> paths) throws org.apache.iceberg.io.BulkDeletionFailureException Deletes 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
- Specified by:
listPrefixin interfaceorg.apache.iceberg.io.SupportsPrefixOperations
-
deletePrefix
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() -
client
-
asyncClient
public software.amazon.awssdk.services.s3.S3AsyncClient asyncClient() -
asyncClient
-
getCredential
- Specified by:
getCredentialin interfaceorg.apache.iceberg.io.CredentialSupplier
-
initialize
- Specified by:
initializein interfaceorg.apache.iceberg.io.FileIO
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.apache.iceberg.io.FileIO
-
finalize
-
recoverFile
- Specified by:
recoverFilein interfaceorg.apache.iceberg.io.SupportsRecoveryOperations
-
setCredentials
- Specified by:
setCredentialsin interfaceorg.apache.iceberg.io.SupportsStorageCredentials
-
credentials
- Specified by:
credentialsin interfaceorg.apache.iceberg.io.SupportsStorageCredentials
-