CatalogV2Util¶
Load Table¶
loadTable(
catalog: CatalogPlugin,
ident: Identifier,
timeTravelSpec: Option[TimeTravelSpec] = None,
writePrivilegesString: Option[String] = None): Option[Table]
loadTable loads a table (by the given Identifier and the optional TimeTravelSpec using the given CatalogPlugin).
Note
loadTable is a Scala Option-aware wrapper around CatalogV2Util.getTable.
loadTable is used when:
- ResolveRelations logical analysis rule is executed (and lookupTableOrView and resolveRelation)
CatalogV2Utilis requested to loadRelationCatalogImplis requested to load a table
Load Table¶
getTable(
catalog: CatalogPlugin,
ident: Identifier,
timeTravelSpec: Option[TimeTravelSpec] = None,
writePrivilegesString: Option[String] = None): Table
getTable assumes the given CatalogPlugin to be a TableCatalog to load a table (by the given Identifier).
getTable requests the given CatalogPlugin for the TableCatalog to load a table (possibly versioned based on the TimeTravelSpec).
Note
It is not allowed for getTable to be called with both timeTravelSpec and writePrivilegesString defined.
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:
CatalogV2Utilis requested to load a tableDataSourceV2Utilsis requested to loadV2Source
getTableProviderCatalog¶
getTableProviderCatalog(
provider: SupportsCatalogOptions,
catalogManager: CatalogManager,
options: CaseInsensitiveStringMap): TableCatalog
getTableProviderCatalog...FIXME
getTableProviderCatalog is used when:
-
DataFrameReaderis requested to load (for a data source that is a [SupportsCatalogOptions]) -
DataFrameWriteris 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,AlterTableSetLocationStatementoperators)