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:
- ResolveRelations logical analysis rule is executed (and lookupTableOrView and resolveRelation)
CatalogV2Util
is requested to loadRelationCatalogImpl
is requested to load a table
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:
CatalogV2Util
is requested to loadTableDataSourceV2Utils
is requested to loadV2Source
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)