public interface OverwriteFiles extends SnapshotUpdate<OverwriteFiles>
This API accumulates file additions and produces a new
Snapshot of the table by replacing
all the files that match the filter expression with the set of additions. This operation is used
to implement idempotent writes that always replace a section of a table with new data.
Overwrites can be validated
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. This has no requirements for the latest snapshot and will not fail based on other snapshot changes.
|Modifier and Type||Method and Description|
Delete files that match an
Signal that each file added to the table must match the overwrite expression.
OverwriteFiles overwriteByRowFilter(Expression expr)
Expressionon data rows from the table.
A file is selected to be deleted by the expression if it could contain any rows that match the
expression (candidate files are selected using an
inclusive projection). These candidate files are
deleted if all of the rows in the file must match the expression (the partition data matches
Projections.strict(PartitionSpec) strict projection}). This guarantees
that files are deleted if and only if all rows in the file must match the expression.
Files that may contain some rows that match the expression and some rows that do not will
result in a
expr- an expression on rows in the table
ValidationException- If a file can contain both rows that match and rows that do not
OverwriteFiles addFile(DataFile file)
DataFileto the table.
file- a data file
If this method is called, each added file is validated on commit to ensure that it matches the overwrite row filter. This is used to ensure that writes are idempotent: that files cannot be added during a commit that would not be removed if the operation were run a second time.