Skip to content

AlterTableAddColumnsDeltaCommand

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

Note

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:

IgnoreCachedData

AlterTableAddColumnsDeltaCommand is an IgnoreCachedData (Spark SQL) logical operator.

Executing Command

run(
  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.