ExternalCatalog Contract — External Catalog (Metastore) of Permanent Relational Entities
ExternalCatalog
is the contract of an external system catalog (aka metadata registry or metastore) of permanent relational entities, i.e. databases, tables, partitions, and functions.
Feature | Database | Function | Partition | Table |
---|---|---|---|---|
Alter |
||||
Create |
||||
Drop |
||||
Get |
||||
List |
||||
Load |
||||
Rename |
||||
Check Existence |
||||
Set |
Method | Description | ||
---|---|---|---|
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
ExternalCatalog
is available as externalCatalog of SharedState (in SparkSession
).
1 2 3 4 5 6 7 8 9 |
scala> :type spark org.apache.spark.sql.SparkSession scala> :type spark.sharedState.externalCatalog org.apache.spark.sql.catalyst.catalog.ExternalCatalog |
ExternalCatalog
is available as ephemeral in-memory or persistent hive-aware.
ExternalCatalog | Alias | Description |
---|---|---|
A persistent system catalog using a Hive metastore. |
||
An in-memory (ephemeral) system catalog that does not require setting up external systems (like a Hive metastore). It is intended for testing or exploration purposes only and therefore should not be used in production. |
The concrete ExternalCatalog
is chosen using Builder.enableHiveSupport that enables the Hive support (and sets spark.sql.catalogImplementation configuration property to hive when the Hive classes are available).
1 2 3 4 5 6 7 8 9 10 11 |
import org.apache.spark.sql.internal.StaticSQLConf val catalogType = spark.conf.get(StaticSQLConf.CATALOG_IMPLEMENTATION.key) scala> println(catalogType) hive scala> spark.sessionState.conf.getConf(StaticSQLConf.CATALOG_IMPLEMENTATION) res1: String = hive |
Tip
|
Set
|
Important
|
You cannot change
|
ExternalCatalog
is a ListenerBus
of ExternalCatalogEventListener
listeners that handle ExternalCatalogEvent
events.
Tip
|
Use Read ListenerBus Event Bus Contract in Mastering Apache Spark 2 gitbook to learn more about Spark Core’s |
Altering Table Statistics — alterTableStats
Method
1 2 3 4 5 |
alterTableStats(db: String, table: String, stats: Option[CatalogStatistics]): Unit |
alterTableStats
…FIXME
Note
|
alterTableStats is used exclusively when SessionCatalog is requested for altering the statistics of a table in a metastore (that can happen when any logical command is executed that could change the table statistics).
|
Altering Table — alterTable
Method
1 2 3 4 5 |
alterTable(tableDefinition: CatalogTable): Unit |
alterTable
…FIXME
Note
|
alterTable is used exclusively when SessionCatalog is requested for altering the statistics of a table in a metastore.
|
createTable
Method
1 2 3 4 5 |
createTable(tableDefinition: CatalogTable, ignoreIfExists: Boolean): Unit |
createTable
…FIXME
Note
|
createTable is used when…FIXME
|
alterTableDataSchema
Method
1 2 3 4 5 |
alterTableDataSchema(db: String, table: String, newDataSchema: StructType): Unit |
alterTableDataSchema
…FIXME
Note
|
alterTableDataSchema is used exclusively when SessionCatalog is requested to alterTableDataSchema.
|