Skip to content


= VacuumTableCommand

VacuumTableCommand is a logical command (RunnableCommand) for[VACUUM] SQL command.

TIP: Read up on[RunnableCommand] in[The Internals of Spark SQL] online book.

VacuumTableCommand is <> exclusively when DeltaSqlAstBuilder is requested to <>.

VacuumTableCommand <> that either the <> or the <> is defined and it is the root directory of a delta table. Partition directories are not supported.

[[output]] The output of VacuumTableCommand is a single path column (of type StringType).

== [[creating-instance]] Creating VacuumTableCommand Instance

VacuumTableCommand takes the following to be created:

  • [[path]] Path (optional)
  • [[table]] TableIdentifier (optional)
  • [[horizonHours]] Optional horizonHours
  • [[dryRun]] dryRun flag

== [[run]] Running Command -- run Method

[source, scala]

run(sparkSession: SparkSession): Seq[Row]

NOTE: run is part of the RunnableCommand contract to...FIXME.

run takes the path to vacuum (i.e. either the <> or the <>) and <>.

run <> for the delta table and executes <> utility (passing in the DeltaLog instance, the <> and the <> options).

run throws an AnalysisException when executed for a non-root directory of a delta table:

Please provide the base path ([baseDeltaPath]) when Vacuuming Delta tables. Vacuuming specific partitions is currently not supported.

run throws an AnalysisException when executed for a DeltaLog with the snapshot version being -1:

[deltaTableIdentifier] is not a Delta table. VACUUM is only supported for Delta tables.

Last update: 2020-09-24