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 |
conflictDetectionFilter(Expression conflictDetectionFilter)
Sets a conflict detection filter used to validate concurrently added data and delete files.
|
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.
|
default RowDelta |
validateNoConflictingAppends(Expression conflictDetectionFilter)
Deprecated.
since 0.13.0, will be removed in 0.14.0; use
conflictDetectionFilter(Expression) and
validateNoConflictingDataFiles() instead. |
RowDelta |
validateNoConflictingDataFiles()
Enables validation that data files added concurrently do not conflict with this commit's operation.
|
RowDelta |
validateNoConflictingDeleteFiles()
Enables validation that delete 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.
@Deprecated default RowDelta validateNoConflictingAppends(Expression conflictDetectionFilter)
conflictDetectionFilter(Expression)
and
validateNoConflictingDataFiles()
instead.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 tableRowDelta conflictDetectionFilter(Expression conflictDetectionFilter)
If not called, a true literal will be used as the conflict detection filter.
conflictDetectionFilter
- an expression on rows in the tableRowDelta validateNoConflictingDataFiles()
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, this operation will detect this during retries and fail.
Calling this method is required to maintain serializable isolation for update/delete operations. Otherwise, the isolation level will be snapshot isolation.
Validation uses the conflict detection filter passed to conflictDetectionFilter(Expression)
and
applies to operations that happened after the snapshot passed to validateFromSnapshot(long)
.
RowDelta validateNoConflictingDeleteFiles()
This method must be called when the table is queried to produce a row delta for UPDATE and MERGE operations independently of the isolation level. Calling this method isn't required for DELETE operations as it is OK to delete a record that is also deleted concurrently.
Validation uses the conflict detection filter passed to conflictDetectionFilter(Expression)
and
applies to operations that happened after the snapshot passed to validateFromSnapshot(long)
.