Skip to content


AlterTableAddColumnsDeltaCommand is a LeafRunnableCommand (Spark SQL) that represents ALTER TABLE ADD COLUMNS SQL command.


AlterTableAddColumnsDeltaCommand is a variant of Spark SQL's AlterTableAddColumnsCommand for Delta Lake to support ALTER TABLE ADD COLUMNS command.

Otherwise, Spark SQL would throw an AnalysisException.

AlterTableAddColumnsDeltaCommand is an AlterDeltaTableCommand.

Creating Instance

AlterTableAddColumnsDeltaCommand takes the following to be created:

AlterTableAddColumnsDeltaCommand is created when:


AlterTableAddColumnsDeltaCommand is an IgnoreCachedData (Spark SQL) logical operator.

Executing Command

  sparkSession: SparkSession): Seq[Row]

run starts a transaction and requests it for the current Metadata (of the DeltaTableV2).

run alters the current schema (creates a new metadata) and notifies the transaction.

In the end, run commits the transaction (as ADD COLUMNS operation).

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