public class S3FileIO
extends java.lang.Object
implements org.apache.iceberg.io.CredentialSupplier, org.apache.iceberg.io.DelegateFileIO
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.
| Constructor and 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.
|
| Modifier and Type | Method and Description |
|---|---|
software.amazon.awssdk.services.s3.S3Client |
client() |
void |
close() |
void |
deleteFile(java.lang.String path) |
void |
deleteFiles(java.lang.Iterable<java.lang.String> paths)
Deletes the given paths in a batched manner.
|
void |
deletePrefix(java.lang.String prefix)
This method provides a "best-effort" to delete all objects under the given prefix.
|
protected void |
finalize() |
java.lang.String |
getCredential() |
void |
initialize(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.InputFile |
newInputFile(java.lang.String path) |
org.apache.iceberg.io.InputFile |
newInputFile(java.lang.String path,
long length) |
org.apache.iceberg.io.OutputFile |
newOutputFile(java.lang.String path) |
java.util.Map<java.lang.String,java.lang.String> |
properties() |
public S3FileIO()
All fields are initialized by calling initialize(Map) later.
public S3FileIO(org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3Client> s3)
Calling initialize(Map) will overwrite information set in this constructor.
s3 - s3 supplierpublic S3FileIO(org.apache.iceberg.util.SerializableSupplier<software.amazon.awssdk.services.s3.S3Client> s3,
S3FileIOProperties s3FileIOProperties)
Calling initialize(Map) will overwrite information set in this constructor.
s3 - s3 suppliers3FileIOProperties - S3 FileIO propertiespublic org.apache.iceberg.io.InputFile newInputFile(java.lang.String path)
newInputFile in interface org.apache.iceberg.io.FileIOpublic org.apache.iceberg.io.InputFile newInputFile(java.lang.String path,
long length)
newInputFile in interface org.apache.iceberg.io.FileIOpublic org.apache.iceberg.io.OutputFile newOutputFile(java.lang.String path)
newOutputFile in interface org.apache.iceberg.io.FileIOpublic void deleteFile(java.lang.String path)
deleteFile in interface org.apache.iceberg.io.FileIOpublic java.util.Map<java.lang.String,java.lang.String> properties()
properties in interface org.apache.iceberg.io.FileIOpublic void deleteFiles(java.lang.Iterable<java.lang.String> paths)
throws org.apache.iceberg.io.BulkDeletionFailureException
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.
deleteFiles in interface org.apache.iceberg.io.SupportsBulkOperationspaths - paths to deleteorg.apache.iceberg.io.BulkDeletionFailureExceptionpublic java.lang.Iterable<org.apache.iceberg.io.FileInfo> listPrefix(java.lang.String prefix)
listPrefix in interface org.apache.iceberg.io.SupportsPrefixOperationspublic void deletePrefix(java.lang.String 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.
deletePrefix in interface org.apache.iceberg.io.SupportsPrefixOperationsprefix - prefix to deletepublic software.amazon.awssdk.services.s3.S3Client client()
public java.lang.String getCredential()
getCredential in interface org.apache.iceberg.io.CredentialSupplierpublic void initialize(java.util.Map<java.lang.String,java.lang.String> props)
initialize in interface org.apache.iceberg.io.FileIOpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface org.apache.iceberg.io.FileIOprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable