Skip to content

CatalogV2Util

Loading Table

loadTable(
  catalog: CatalogPlugin,
  ident: Identifier,
  timeTravelSpec: Option[TimeTravelSpec] = None): Option[Table]

loadTable loads the table (by the given identifier and the optional TimeTravelSpec in the given CatalogPlugin).

Note

loadTable is a Scala Option-aware wrapper around CatalogV2Util.getTable that may not only return null but also throw an exception.


loadTable is used when:

getTable

getTable(
  catalog: CatalogPlugin,
  ident: Identifier,
  timeTravelSpec: Option[TimeTravelSpec] = None): Table

getTable requests the given CatalogPlugin for the TableCatalog to load a table (possibly versioned based on the TimeTravelSpec).

NoSuchTableException for versioned tables

TableCatalog throws a NoSuchTableException exception for versioned tables by default (and leaves other behaviour to custom TableCatalogs, e.g. Delta Lake).


getTable is used when:

getTableProviderCatalog

getTableProviderCatalog(
  provider: SupportsCatalogOptions,
  catalogManager: CatalogManager,
  options: CaseInsensitiveStringMap): TableCatalog

getTableProviderCatalog...FIXME

getTableProviderCatalog is used when:

  • DataFrameReader is requested to load (for a data source that is a [SupportsCatalogOptions])

  • DataFrameWriter is requested to save (for a data source that is a [SupportsCatalogOptions])

Creating AlterTable Logical Command

createAlterTable(
  originalNameParts: Seq[String],
  catalog: CatalogPlugin,
  tableName: Seq[String],
  changes: Seq[TableChange]): AlterTable

createAlterTable converts the CatalogPlugin to a TableCatalog.

createAlterTable creates an AlterTable (with an UnresolvedV2Relation).

createAlterTable is used when:

  • ResolveCatalogs and ResolveSessionCatalog logical resolution rules are executed (and resolve AlterTableAddColumnsStatement, AlterTableReplaceColumnsStatement, AlterTableAlterColumnStatement, AlterTableRenameColumnStatement, AlterTableDropColumnsStatement, AlterTableSetPropertiesStatement, AlterTableUnsetPropertiesStatement, AlterTableSetLocationStatement operators)