Interface TransactionBuilder

All Known Implementing Classes:
TransactionBuilderImpl

@Evolving public interface TransactionBuilder
Builder for creating a Transaction to mutate a Delta table.
Since:
3.2.0
  • Method Details

    • withSchema

      TransactionBuilder withSchema(Engine engine, StructType schema)
      Set the schema of the table when creating a new table.
      Parameters:
      engine - Engine instance to use.
      schema - The new schema of the table.
      Returns:
      updated TransactionBuilder instance.
    • withPartitionColumns

      TransactionBuilder withPartitionColumns(Engine engine, List<String> partitionColumns)
      Set the list of partitions columns when create a new partitioned table.
      Parameters:
      engine - Engine instance to use.
      partitionColumns - The partition columns of the table. These should be a subset of the columns in the schema.
      Returns:
      updated TransactionBuilder instance.
    • withTransactionId

      TransactionBuilder withTransactionId(Engine engine, String applicationId, long transactionVersion)
      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 - Engine instance 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 TransactionBuilder instance.
    • build

      Transaction build(Engine engine)
      Build the transaction. Also validates the given info to ensure that a valid transaction can be created.
      Parameters:
      engine - Engine instance to use.
      Throws:
      ConcurrentTransactionException - if the table already has a committed transaction with the same given transaction identifier.