关注 spark技术分享,
撸spark源码 玩spark最佳实践

GlobalTempViewManager — Management Interface of Global Temporary Views

GlobalTempViewManager — Management Interface of Global Temporary Views

GlobalTempViewManager is the interface to manage global temporary views (that SessionCatalog uses when requested to create, alter or drop global temporary views).

Strictly speaking, GlobalTempViewManager simply manages the names of the global temporary views registered (and the corresponding logical plans) and has no interaction with other services in Spark SQL.

GlobalTempViewManager is available as globalTempViewManager property of a SharedState.

spark sql GlobalTempViewManager.png
Figure 1. GlobalTempViewManager and SparkSession

Table 1. GlobalTempViewManager API
Method Description

clear

create

get

listViewNames

remove

rename

update

GlobalTempViewManager is created exclusively when SharedState is requested for one (for the very first time only as it is cached).

GlobalTempViewManager takes the name of the database when created.

spark sql GlobalTempViewManager creating instance.png
Figure 2. Creating GlobalTempViewManager
Table 2. GlobalTempViewManager’s Internal Properties (e.g. Registries, Counters and Flags)
Name Description

viewDefinitions

Registry of global temporary view definitions as logical plans per view name.

clear Method

clear simply removes all the entries in the viewDefinitions internal registry.

Note
clear is used when SessionCatalog is requested to reset (that happens to be exclusively in the Spark SQL internal tests).

Creating (Registering) Global Temporary View (Definition) — create Method

create simply registers (adds) the input LogicalPlan under the input name.

create throws an AnalysisException when the input overrideIfExists flag is off and the viewDefinitions internal registry contains the input name.

Note
create is used when SessionCatalog is requested to createGlobalTempView (when CreateViewCommand and CreateTempViewUsing logical commands are executed).

Retrieving Global View Definition Per Name — get Method

get simply returns the LogicalPlan that was registered under the name if it defined.

Note
get is used when SessionCatalog is requested to getGlobalTempView, getTempViewOrPermanentTableMetadata, lookupRelation, isTemporaryTable or refreshTable.

Listing Global Temporary Views For Pattern — listViewNames Method

listViewNames simply gives a list of the global temporary views with names matching the input pattern.

Note
listViewNames is used exclusively when SessionCatalog is requested to listTables

Removing (De-Registering) Global Temporary View — remove Method

remove simply tries to remove the name from the viewDefinitions internal registry and returns true when removed or false otherwise.

Note
remove is used when SessionCatalog is requested to drop a global temporary view or table.

rename Method

rename…​FIXME

Note
rename is used when…​FIXME

update Method

update…​FIXME

Note
update is used exclusively when SessionCatalog is requested to alter a global temporary view.
赞(0) 打赏
未经允许不得转载:spark技术分享 » GlobalTempViewManager — Management Interface of Global Temporary Views
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏