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:
- CatalogTable
-
ignoreIfExistsflag
CreateDataSourceTableCommand is created when:
- DataSourceAnalysis posthoc logical resolution rule is executed (to resolve CreateTable logical operators with DataSource Tables)
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):
- The tableType of the CatalogTable is not
view - The provider of the CatalogTable is defined