Package org.apache.iceberg
Interface RewriteFiles
-
- All Superinterfaces:
PendingUpdate<Snapshot>
,SnapshotUpdate<RewriteFiles>
public interface RewriteFiles extends SnapshotUpdate<RewriteFiles>
API for replacing files in a table.This API accumulates file additions and deletions, produces a new
Snapshot
of the changes, and commits that snapshot as the current.When committing, these changes will be applied to the latest table snapshot. Commit conflicts will be resolved by applying the changes to the new latest snapshot and reattempting the commit. If any of the deleted files are no longer in the latest snapshot when reattempting, the commit will throw a
ValidationException
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RewriteFiles
rewriteFiles(java.util.Set<DataFile> filesToDelete, java.util.Set<DataFile> filesToAdd)
Add a rewrite that replaces one set of data files with another set that contains the same data.RewriteFiles
rewriteFiles(java.util.Set<DataFile> filesToDelete, java.util.Set<DataFile> filesToAdd, long sequenceNumber)
Add a rewrite that replaces one set of data files with another set that contains the same data.RewriteFiles
rewriteFiles(java.util.Set<DataFile> dataFilesToReplace, java.util.Set<DeleteFile> deleteFilesToReplace, java.util.Set<DataFile> dataFilesToAdd, java.util.Set<DeleteFile> deleteFilesToAdd)
Add a rewrite that replaces one set of files with another set that contains the same data.RewriteFiles
validateFromSnapshot(long snapshotId)
Set the snapshot ID used in any reads for this operation.-
Methods inherited from interface org.apache.iceberg.PendingUpdate
apply, commit, updateEvent
-
Methods inherited from interface org.apache.iceberg.SnapshotUpdate
deleteWith, scanManifestsWith, set, stageOnly, toBranch
-
-
-
-
Method Detail
-
rewriteFiles
default RewriteFiles rewriteFiles(java.util.Set<DataFile> filesToDelete, java.util.Set<DataFile> filesToAdd)
Add a rewrite that replaces one set of data files with another set that contains the same data.- Parameters:
filesToDelete
- files that will be replaced (deleted), cannot be null or empty.filesToAdd
- files that will be added, cannot be null or empty.- Returns:
- this for method chaining
-
rewriteFiles
RewriteFiles rewriteFiles(java.util.Set<DataFile> filesToDelete, java.util.Set<DataFile> filesToAdd, long sequenceNumber)
Add a rewrite that replaces one set of data files with another set that contains the same data. The sequence number provided will be used for all the data files added.- Parameters:
filesToDelete
- files that will be replaced (deleted), cannot be null or empty.filesToAdd
- files that will be added, cannot be null or empty.sequenceNumber
- sequence number to use for all data files added- Returns:
- this for method chaining
-
rewriteFiles
RewriteFiles rewriteFiles(java.util.Set<DataFile> dataFilesToReplace, java.util.Set<DeleteFile> deleteFilesToReplace, java.util.Set<DataFile> dataFilesToAdd, java.util.Set<DeleteFile> deleteFilesToAdd)
Add a rewrite that replaces one set of files with another set that contains the same data.- Parameters:
dataFilesToReplace
- data files that will be replaced (deleted).deleteFilesToReplace
- delete files that will be replaced (deleted).dataFilesToAdd
- data files that will be added.deleteFilesToAdd
- delete files that will be added.- Returns:
- this for method chaining.
-
validateFromSnapshot
RewriteFiles validateFromSnapshot(long snapshotId)
Set the snapshot ID used in any reads for this operation.Validations will check changes after this snapshot ID. If this is not called, all ancestor snapshots through the table's initial snapshot are validated.
- Parameters:
snapshotId
- a snapshot ID- Returns:
- this for method chaining
-
-