public interface RowDelta extends SnapshotUpdate<RowDelta>
This API accumulates data and delete file changes, produces a new Snapshot
of the table, 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.
Modifier and Type | Method and Description |
---|---|
RowDelta |
addDeletes(DeleteFile deletes)
Add a
DeleteFile to the table. |
RowDelta |
addRows(DataFile inserts)
Add a
DataFile to the table. |
RowDelta |
caseSensitive(boolean caseSensitive)
Enables or disables case sensitive expression binding for validations that accept expressions.
|
RowDelta |
validateDataFilesExist(java.lang.Iterable<? extends java.lang.CharSequence> referencedFiles)
Add data file paths that must not be removed by conflicting commits for this RowDelta to succeed.
|
RowDelta |
validateDeletedFiles()
Enable validation that referenced data files passed to
validateDataFilesExist(Iterable) have not been
removed by a delete operation. |
RowDelta |
validateFromSnapshot(long snapshotId)
Set the snapshot ID used in any reads for this operation.
|
RowDelta |
validateNoConflictingAppends(Expression conflictDetectionFilter)
Enables validation that files added concurrently do not conflict with this commit's operation.
|
deleteWith, set, stageOnly
apply, commit, updateEvent
RowDelta addRows(DataFile inserts)
DataFile
to the table.inserts
- a data file of rows to insertRowDelta addDeletes(DeleteFile deletes)
DeleteFile
to the table.deletes
- a delete file of rows to deleteRowDelta validateFromSnapshot(long snapshotId)
Validations will check changes after this snapshot ID. If the from snapshot is not set, all ancestor snapshots through the table's initial snapshot are validated.
snapshotId
- a snapshot IDRowDelta caseSensitive(boolean caseSensitive)
caseSensitive
- whether expression binding should be case sensitiveRowDelta validateDataFilesExist(java.lang.Iterable<? extends java.lang.CharSequence> referencedFiles)
If any path has been removed by a conflicting commit in the table since the snapshot passed to
validateFromSnapshot(long)
, the operation will fail with a
ValidationException
.
By default, this validation checks only rewrite and overwrite commits. To apply validation to delete commits, call
validateDeletedFiles()
.
referencedFiles
- file paths that are referenced by a position delete fileRowDelta validateDeletedFiles()
validateDataFilesExist(Iterable)
have not been
removed by a delete operation.
If a data file has a row deleted using a position delete file, rewriting or overwriting the data file concurrently would un-delete the row. Deleting the data file is normally allowed, but a delete may be part of a transaction that reads and re-appends a row. This method is used to validate deletes for the transaction case.
RowDelta validateNoConflictingAppends(Expression conflictDetectionFilter)
This method should be called when the table is queried to determine which files to delete/append. If a concurrent operation commits a new file after the data was read and that file might contain rows matching the specified conflict detection filter, the overwrite operation will detect this during retries and fail.
Calling this method with a correct conflict detection filter is required to maintain serializable isolation for update/delete operations. Otherwise, the isolation level will be snapshot isolation.
Validation applies to files added to the table since the snapshot passed to validateFromSnapshot(long)
.
conflictDetectionFilter
- an expression on rows in the table