Skip to content

UnresolvedCatalogRelation Leaf Logical Operator -- Placeholder of Catalog Tables

UnresolvedCatalogRelation is a[leaf logical operator] that acts as a placeholder in a logical query plan for FindDataSourceTable logical evaluation rule to resolve it to a concrete relation logical operator (i.e.[LogicalRelations] for data source tables or hive/[HiveTableRelations] for hive tables).

UnresolvedCatalogRelation is <> when SessionCatalog is requested to find a relation (for[DescribeTableCommand] logical command or ResolveRelations logical evaluation rule).

[source, scala]

// non-temporary global or local view // database defined // externalCatalog.getTable returns non-VIEW table // Make the example reproducible val tableName = "t1" spark.sharedState.externalCatalog.dropTable( db = "default", table = tableName, ignoreIfNotExists = true, purge = true) spark.range(10).write.saveAsTable(tableName)

scala> :type spark.sessionState.catalog org.apache.spark.sql.catalyst.catalog.SessionCatalog

import org.apache.spark.sql.catalyst.TableIdentifier val plan = spark.sessionState.catalog.lookupRelation(TableIdentifier(tableName)) scala> println(plan.numberedTreeString) 00 'SubqueryAlias t1 01 +- 'UnresolvedCatalogRelation default.t1,

When <>, UnresolvedCatalogRelation asserts that the database is specified.

[[resolved]] UnresolvedCatalogRelation can never be <> and is converted to a <> for a data source table or a hive/[HiveTableRelation] for a hive table at analysis phase.

[[output]] UnresolvedCatalogRelation uses an empty <>.

[[creating-instance]] [[tableMeta]] UnresolvedCatalogRelation takes a single CatalogTable when created.

Last update: 2020-11-07