val spark: SparkSession = ...
spark.sessionState
SessionState
SessionState
is the state separation layer between Spark SQL sessions, including SQL configuration, tables, functions, UDFs, SQL parser, and everything else that depends on a SQLConf.
You can access SessionState
of a SparkSession
through sessionState property.
SessionState
is created when…FIXME
Name | Type | Description |
---|---|---|
Used when…FIXME |
||
Manages tables and databases. Used when…FIXME |
||
Used when…FIXME |
||
Used when…FIXME |
||
Used when…FIXME |
||
|
Used when…FIXME |
|
Used when…FIXME |
||
Logical query plan optimizer Used exclusively when |
||
Used when…FIXME |
||
|
Used when…FIXME |
|
Used when…FIXME |
||
|
Used when…FIXME |
|
Interface to register user-defined functions. Used when…FIXME |
Note
|
SessionState is a private[sql] class and, given the package org.apache.spark.sql.internal , SessionState should be considered internal.
|
Creating SessionState Instance
SessionState
takes the following when created:
-
StreamingQueryManager
-
SessionResourceLoader
-
Function to create QueryExecution for a given logical plan
-
Function to clone the current
SessionState
for a given pair of SparkSession andSessionState
SessionState
initializes the attributes.
apply
Factory Methods
Caution
|
FIXME |
apply(sparkSession: SparkSession): SessionState (1)
apply(sparkSession: SparkSession, sqlConf: SQLConf): SessionState
-
Passes
sparkSession
to the otherapply
with a newSQLConf
Note
|
apply is used when SparkSession is requested for SessionState .
|
createAnalyzer
Internal Method
createAnalyzer(
sparkSession: SparkSession,
catalog: SessionCatalog,
sqlConf: SQLConf): Analyzer
createAnalyzer
creates a logical query plan Analyzer with rules specific to a non-Hive SessionState
.
Method | Rules | Description |
---|---|---|
extendedResolutionRules |
FindDataSourceTable |
Replaces |
ResolveSQLOnFile |
||
postHocResolutionRules |
PreprocessTableCreation |
|
PreprocessTableInsertion |
||
extendedCheckRules |
PreWriteCheck |
|
HiveOnlyCheck |
Executing Logical Plan — executePlan
Method
executePlan(plan: LogicalPlan): QueryExecution
executePlan
executes the input LogicalPlan to produce a QueryExecution in the current SparkSession.
Creating New Hadoop Configuration — newHadoopConf
Method
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 ScriptTransformation , ParquetRelation , StateStoreRDD , and SessionState itself, and few other places.
|
Caution
|
FIXME What is ScriptTransformation ? StateStoreRDD ?
|