SessionState
is the default separation layer for isolating state across sessions, including SQL configuration, tables, functions, UDFs, the SQL parser, and everything else that depends on a SQLConf.
Caution
|
FIXME Elaborate please. |
It requires a SparkSession and manages its own SQLConf.
Note
|
Given the package org.apache.spark.sql.internal that SessionState belongs to, this one is truly internal. You’ve been warned.
|
Note
|
SessionState is a private[sql] class.
|
SessionState
offers the following services:
-
newHadoopConf to create a new Hadoop’s
Configuration
.
catalog: SessionCatalog
catalog
attribute points at shared internal SessionCatalog for managing tables and databases.
SessionCatalog
is a proxy between SparkSession and the underlying metastore, e.g. HiveSessionCatalog
.
optimizer: Optimizer
optimizer
is an optimizer for logical query plans.
It is (lazily) set to SparkOptimizer that is a specialization of Catalyst optimizer. It is created for the session-owned SessionCatalog, SQLConf, and ExperimentalMethods.
executePlan(plan: LogicalPlan): QueryExecution
executePlan
executes the input LogicalPlan to produce a QueryExecution in the current SparkSession.
streamingQueryManager: StreamingQueryManager
streamingQueryManager
attribute points at shared StreamingQueryManager (e.g. to start streaming queries in DataStreamWriter
).
udf: UDFRegistration
udf
attribute points at shared UDFRegistration
for a given Spark session.
newHadoopConf(): Configuration
newHadoopConf
returns Hadoop’s Configuration
that it builds using SparkContext.hadoopConfiguration (through SparkSession) with all configuration settings added.
Note
|
newHadoopConf is used by HiveSessionState (for HiveSessionCatalog ), ScriptTransformation , ParquetRelation , StateStoreRDD , and SessionState itself, and few other places.
|
Caution
|
FIXME What is ScriptTransformation ? StateStoreRDD ?
|