GlobalTempViewManager -- Management Interface of Global Temporary Views¶
GlobalTempViewManager is the <SessionCatalog uses when requested to create, alter or drop global temporary views).
Strictly speaking, GlobalTempViewManager simply <
GlobalTempViewManager is available as SharedState.md#globalTempViewManager[globalTempViewManager] property of a SharedState.
.GlobalTempViewManager and SparkSession image::images/spark-sql-GlobalTempViewManager.png[align="center"]
[source, scala]¶
scala> :type spark org.apache.spark.sql.SparkSession
scala> :type spark.sharedState.globalTempViewManager org.apache.spark.sql.catalyst.catalog.GlobalTempViewManager
[[methods]] .GlobalTempViewManager API [cols="1,2",options="header",width="100%"] |=== | Method | Description
| <
[source, scala]¶
clear(): Unit¶
| <
[source, scala]¶
create( name: String, viewDefinition: LogicalPlan, overrideIfExists: Boolean): Unit
Registers (creates) a global temporary view (as a spark-sql-LogicalPlan.md[LogicalPlan]) by name
Used when SessionCatalog is requested to createGlobalTempView
| <
[source, scala]¶
get( name: String): Option[LogicalPlan]
Finds the global view definition (as a spark-sql-LogicalPlan.md[LogicalPlan]) for the given name if available
Used when SessionCatalog is requested to getGlobalTempView, getTempViewOrPermanentTableMetadata, lookupRelation, isTemporaryTable, refreshTable
| <
[source, scala]¶
listViewNames(pattern: String): Seq[String]¶
| <
[source, scala]¶
remove(name: String): Boolean¶
| <
[source, scala]¶
rename(oldName: String, newName: String): Boolean¶
| <
[source, scala]¶
update(name: String, viewDefinition: LogicalPlan): Boolean¶
|===
GlobalTempViewManager is <SharedState is requested for <
[[database]] [[creating-instance]] GlobalTempViewManager takes the name of the database when created.
.Creating GlobalTempViewManager image::images/spark-sql-GlobalTempViewManager-creating-instance.png[align="center"]
[[internal-registries]] .GlobalTempViewManager's Internal Properties (e.g. Registries, Counters and Flags) [cols="1m,2",options="header",width="100%"] |=== | Name | Description
| viewDefinitions | [[viewDefinitions]] Registry of global temporary view definitions as <
=== [[clear]] clear Method
[source, scala]¶
clear(): Unit¶
clear simply removes all the entries in the <
NOTE: clear is used when SessionCatalog is requested to reset (that happens to be exclusively in the Spark SQL internal tests).
=== [[create]] Creating (Registering) Global Temporary View (Definition) -- create Method
[source, scala]¶
create( name: String, viewDefinition: LogicalPlan, overrideIfExists: Boolean): Unit
create simply registers (adds) the input <name.
create throws an AnalysisException when the input overrideIfExists flag is off and the <name.
Temporary view '[table]' already exists
NOTE: create is used when SessionCatalog is requested to createGlobalTempView (when <
=== [[get]] Retrieving Global View Definition Per Name -- get Method
[source, scala]¶
get(name: String): Option[LogicalPlan]¶
get simply returns the <name if it defined.
NOTE: get is used when SessionCatalog is requested to getGlobalTempView, getTempViewOrPermanentTableMetadata, lookupRelation, isTemporaryTable or refreshTable.
=== [[listViewNames]] Listing Global Temporary Views For Pattern -- listViewNames Method
[source, scala]¶
listViewNames(pattern: String): Seq[String]¶
listViewNames simply gives a list of the global temporary views with names matching the input pattern.
listViewNames is used when SessionCatalog is requested to listTables
=== [[remove]] Removing (De-Registering) Global Temporary View -- remove Method
[source, scala]¶
remove(name: String): Boolean¶
remove simply tries to remove the name from the <true when removed or false otherwise.
remove is used when SessionCatalog is requested to drop a global temporary view or table.
=== [[rename]] rename Method
[source, scala]¶
rename(oldName: String, newName: String): Boolean¶
rename...FIXME
NOTE: rename is used when...FIXME
=== [[update]] update Method
[source, scala]¶
update(name: String, viewDefinition: LogicalPlan): Boolean¶
update...FIXME
update is used when SessionCatalog is requested to alter a global temporary view.