Skip to content

V2SessionCatalog

V2SessionCatalog is a TableCatalog that makes the good ol' SessionCatalog available in the modern Catalog Plugin API-based infrastructure.

V2SessionCatalog is known under the name of spark_catalog.

V2SessionCatalog is a SupportsNamespaces.

V2SessionCatalog is the default session catalog of CatalogManager.

Creating Instance

V2SessionCatalog takes the following to be created:

V2SessionCatalog is created when:

  • BaseSessionStateBuilder is requested for one

capabilities

TableCatalog
capabilities(): Set[TableCatalogCapability]

capabilities is part of the TableCatalog abstraction.

capabilities is SUPPORT_COLUMN_DEFAULT_VALUE.

Default Namespace

CatalogPlugin
defaultNamespace: Array[String]

defaultNamespace is part of the CatalogPlugin abstraction.

defaultNamespace is default.

Name

CatalogPlugin
name: String

name is part of the CatalogPlugin abstraction.

The name of V2SessionCatalog is spark_catalog.

Loading Table

TableCatalog
loadTable(
  ident: Identifier): Table

loadTable is part of the TableCatalog abstraction.

loadTable creates a V1Table for a table metadata (from the SessionCatalog).

Loading Function

FunctionCatalog
loadFunction(
  ident: Identifier): UnboundFunction

loadFunction is part of the FunctionCatalog abstraction.

loadFunction...FIXME

Creating Table

FunctionCatalog
createTable(
  ident: Identifier,
  columns: Array[Column],
  partitions: Array[Transform],
  properties: Map[String, String]): Table
createTable(
  ident: Identifier,
  schema: StructType,
  partitions: Array[Transform],
  properties: util.Map[String, String]): Table // (1)!
  1. Deprecated

createTable is part of the FunctionCatalog abstraction.

createTable creates a CatalogTable and requests the SessionCatalog to createTable (with ignoreIfExists flag disabled so when the table already exists a TableAlreadyExistsException is reported).

In the end, createTable loads the table.