Skip to content

DeltaTableOperations — Delta DML Operations

DeltaTableOperations is an abstraction of management services for DeltaTable commands.

Implementations

DeltaTable

DeltaTableOperations uses Scala's self-type feature which forces it to be mixed into DeltaTable or its subtypes.

DeltaTable Commands

executeDelete

executeDelete(
  condition: Option[Expression]): Unit

executeDelete creates a DeleteFromTable (Spark SQL) logical command (for the analyzed query plan of the DataFrame of the DeltaTable and the given condition).

executeDelete creates a DataFrame for the DeleteFromTable.

DeleteFromTable and DeltaDelete

DeleteFromTable is resolved to DeltaDelete logical command.

executeDelete is used when:

  • DeltaTable is requested to delete

executeGenerate

executeGenerate(
  tblIdentifier: String, mode: String): Unit

executeGenerate creates a DataFrame for a DeltaGenerateCommand.

executeGenerate is used when:

executeHistory

executeHistory(
  deltaLog: DeltaLog,
  limit: Option[Int] = None,
  tableId: Option[TableIdentifier] = None): DataFrame

executeHistory requests the given DeltaLog for the DeltaHistoryManager for the history.

executeHistory is used when:

  • DeltaTable is requested to history

executeRestore

executeRestore(
  table: DeltaTableV2,
  versionAsOf: Option[Long],
  timestampAsOf: Option[String]): DataFrame

executeRestore creates a RestoreTableStatement for a new DataSourceV2Relation (Spark SQL) (for the given DeltaTableV2 and the given versionAsOf and timestampAsOf time travel metadata).

executeRestore creates a DataFrame for the DeleteFromTable.

executeRestore is used when:

executeUpdate

executeUpdate(
  set: Map[String, Column],
  condition: Option[Column]): Unit

executeUpdate creates a UpdateTable (Spark SQL) logical command (for the analyzed query plan of the DataFrame of the DeltaTable and the given condition).

executeDelete creates a DataFrame for the UpdateTable.

UpdateTable and DeltaUpdateTable

UpdateTable is resolved to DeltaUpdateTable logical command.

executeUpdate is used when:

executeVacuum

executeVacuum(
  deltaLog: DeltaLog,
  retentionHours: Option[Double],
  tableId: Option[TableIdentifier] = None): DataFrame

executeVacuum runs garbage collection of the given DeltaLog.

executeVacuum is used when:

  • DeltaTable is requested to vacuum