Package io.delta.kernel
Interface TransactionBuilder
- All Known Implementing Classes:
TransactionBuilderImpl
Builder for creating a
Transaction to mutate a Delta table.- Since:
- 3.2.0
-
Method Summary
Modifier and TypeMethodDescriptionBuild the transaction.withPartitionColumns(Engine engine, List<String> partitionColumns) Set the list of partitions columns when create a new partitioned table.withSchema(Engine engine, StructType schema) Set the schema of the table when creating a new table.withTransactionId(Engine engine, String applicationId, long transactionVersion) Set the transaction identifier for idempotent writes.
-
Method Details
-
withSchema
Set the schema of the table when creating a new table.- Parameters:
engine-Engineinstance to use.schema- The new schema of the table.- Returns:
- updated
TransactionBuilderinstance.
-
withPartitionColumns
Set the list of partitions columns when create a new partitioned table.- Parameters:
engine-Engineinstance to use.partitionColumns- The partition columns of the table. These should be a subset of the columns in the schema.- Returns:
- updated
TransactionBuilderinstance.
-
withTransactionId
Set the transaction identifier for idempotent writes. Incremental processing systems (e.g., streaming systems) that track progress using their own application-specific versions need to record what progress has been made, in order to avoid duplicating data in the face of failures and retries during writes. By setting the transaction identifier, the Delta table can ensure that the data with same identifier is not written multiple times. For more information refer to the Delta protocol section Transaction Identifiers.- Parameters:
engine-Engineinstance to use.applicationId- The application ID that is writing to the table.transactionVersion- The version of the transaction. This should be monotonically increasing with each write for the same application ID.- Returns:
- updated
TransactionBuilderinstance.
-
build
Build the transaction. Also validates the given info to ensure that a valid transaction can be created.- Parameters:
engine-Engineinstance to use.- Throws:
ConcurrentTransactionException- if the table already has a committed transaction with the same given transaction identifier.
-