RowDelta interface provides an API for encoding row-level changes to an Iceberg table, including inserts, updates, and deletes using delete files.
Overview
RowDelta accumulates data and delete file changes, produces a new snapshot of the table, and commits that snapshot as the current. This is the primary interface for implementing UPDATE, DELETE, and MERGE operations at the row level.Interface
Core Methods
addRows()
Adds a data file of rows to insert.inserts- A data file of rows to insert
addDeletes()
Adds a delete file of rows to delete.deletes- A delete file of rows to delete
removeRows()
Removes a data file from the table.file- A data file to remove
removeDeletes()
Removes a rewritten delete file from the table.deletes- A delete file that can be removed from the table
Validation Methods
validateFromSnapshot()
Sets the snapshot ID used in any reads for this operation.snapshotId- A snapshot ID
caseSensitive()
Enables or disables case sensitive expression binding.caseSensitive- Whether expression binding should be case sensitive
validateDataFilesExist()
Adds data file paths that must not be removed by conflicting commits.referencedFiles- File paths that are referenced by a position delete file
validateFromSnapshot(), 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().
validateDeletedFiles()
Enables validation that referenced data files have not been removed by a delete operation.conflictDetectionFilter()
Sets a conflict detection filter for validating concurrent changes.conflictDetectionFilter- An expression on rows in the table
validateNoConflictingDataFiles()
Enables validation that concurrently added data files do not conflict.validateFromSnapshot().
validateNoConflictingDeleteFiles()
Enables validation that concurrently added delete files do not conflict.Examples
Basic Row Delete
Update Operation (Delete + Insert)
Merge Operation
Row Delta with Validation
Serializable Update
Position Delete with File References
Rewriting Delete Files
File Rewrite with Row Delta
Equality Delete
Concurrent Modification Protection
Delete with File Existence Validation
Complex Merge with Multiple Deltas
Isolation Levels
Snapshot Isolation (Default)
Serializable Isolation
Delete File Types
Position Deletes
Delete specific rows by file and position:Equality Deletes
Delete rows matching equality conditions:See Also
- AppendFiles - Append files to a table
- OverwriteFiles - Overwrite files in a table
- DeleteFiles - Delete files from a table
- DeleteFile - Delete file metadata