Skip to content

CreateDataSourceTableCommand Logical Command

CreateDataSourceTableCommand is a LeafRunnableCommand that represents a CreateTable logical operator (with DataSource Tables) at execution.

CreateDataSourceTableCommand uses the SessionCatalog to create a table when executed.

Creating Instance

CreateDataSourceTableCommand takes the following to be created:

CreateDataSourceTableCommand is created when:

Executing Command

RunnableCommand
run(
  sparkSession: SparkSession): Seq[Row]

run is part of the RunnableCommand abstraction.

run requests the SessionCatalog to tableExists. With ignoreIfExists flag enabled, run exits. Otherwise, run reports a TableAlreadyExistsException.

run uses the locationUri as the path option.

run uses the current database (of the SessionCatalog) unless defined.

run sets the tracksPartitionsInCatalog to the value of spark.sql.hive.manageFilesourcePartitions configuration property.

run creates a DataSource to resolveRelation.

In the end, run requests the SessionCatalog to create a table.

AssertionError

run expects the following (or reports an AssertionError):