Skip to content


DeleteCommand is a DeltaCommand that represents DeltaDelete logical command at execution.

DeleteCommand is a RunnableCommand (Spark SQL) logical operator.

Creating Instance

DeleteCommand takes the following to be created:

DeleteCommand is created (also using apply factory utility) when:

Performance Metrics

Name web UI
numRemovedFiles number of files removed.
numAddedFiles number of files added.
numDeletedRows number of rows deleted.

Executing Command

  sparkSession: SparkSession): Seq[Row]

run is part of the RunnableCommand (Spark SQL) abstraction.

run requests the TahoeFileIndex for the DeltaLog (and asserts that the table is removable).

run requests the DeltaLog to start a new transaction for performDelete.

In the end, run re-caches all cached plans (incl. this relation itself) by requesting the CacheManager (Spark SQL) to recache the target.


  sparkSession: SparkSession,
  deltaLog: DeltaLog,
  txn: OptimisticTransaction): Unit

Number of Table Files

performDelete requests the given DeltaLog for the current Snapshot that is in turn requested for the number of files in the delta table.

Finding Delete Actions

performDelete branches off based on the optional condition:

  1. No condition to delete the whole table
  2. Condition defined on metadata only
  3. Other conditions

Delete Condition Undefined


Metadata-Only Delete Condition


Other Delete Conditions


Delete Actions Available


Creating DeleteCommand

  delete: DeltaDelete): DeleteCommand

apply creates a DeleteCommand.