BaseSessionStateBuilder — Generic Builder of SessionState
BaseSessionStateBuilder is the contract of builder objects that coordinate construction of a new SessionState.
| BaseSessionStateBuilder | Description |
|---|---|
BaseSessionStateBuilder is created when SparkSession is requested for a SessionState.
|
1 2 3 4 5 6 7 8 9 |
scala> :type spark org.apache.spark.sql.SparkSession scala> :type spark.sessionState org.apache.spark.sql.internal.SessionState |
BaseSessionStateBuilder requires that implementations define newBuilder method that SparkSession uses (indirectly) when requested for the SessionState (per spark.sql.catalogImplementation internal configuration property).
|
1 2 3 4 5 |
newBuilder: (SparkSession, Option[SessionState]) => BaseSessionStateBuilder |
|
Note
|
BaseSessionStateBuilder and spark.sql.catalogImplementation configuration property allow for Hive and non-Hive Spark deployments.
|
BaseSessionStateBuilder holds properties that (together with newBuilder) are used to create a SessionState.
| Name | Description | ||
|---|---|---|---|
|
analyzer |
|||
|
|
Used to create Analyzer, Optimizer and a SessionState itself
|
||
|
|
|||
|
|
Custom operator optimization rules to add to the base Operator Optimization batch. When requested for the custom rules, |
||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
SparkOptimizer (that is downcast to the base Optimizer) that is created with the SessionCatalog and the ExperimentalMethods. Note that the
|
||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|
Note
|
|
|
Note
|
BaseSessionStateBuilder is an experimental and unstable API.
|
Creating Function to Build SessionState — createClone Method
|
1 2 3 4 5 |
createClone: (SparkSession, SessionState) => SessionState |
createClone gives a function of SparkSession and SessionState that executes newBuilder followed by build.
|
Note
|
createClone is used exclusively when BaseSessionStateBuilder is requested for a SessionState
|
Creating SessionState Instance — build Method
|
1 2 3 4 5 |
build(): SessionState |
build creates a SessionState with the following:
|
Note
|
|
Creating BaseSessionStateBuilder Instance
BaseSessionStateBuilder takes the following when created:
-
Optional SessionState
Getting Function to Create QueryExecution For LogicalPlan — createQueryExecution Method
|
1 2 3 4 5 |
createQueryExecution: LogicalPlan => QueryExecution |
createQueryExecution simply returns a function that takes a LogicalPlan and creates a QueryExecution with the SparkSession and the logical plan.
|
Note
|
createQueryExecution is used exclusively when BaseSessionStateBuilder is requested to create a SessionState instance.
|
spark技术分享