Struct datafusion::execution::context::SessionState
source · pub struct SessionState {
pub session_id: String,
pub optimizer: Optimizer,
pub physical_optimizers: Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>,
pub query_planner: Arc<dyn QueryPlanner + Send + Sync>,
pub catalog_list: Arc<dyn CatalogList>,
pub scalar_functions: HashMap<String, Arc<ScalarUDF>>,
pub aggregate_functions: HashMap<String, Arc<AggregateUDF>>,
pub config: SessionConfig,
pub execution_props: ExecutionProps,
pub runtime_env: Arc<RuntimeEnv>,
}
Expand description
Execution context for registering data sources and executing queries
Fields§
§session_id: String
Uuid for the session
optimizer: Optimizer
Responsible for optimizing a logical plan
physical_optimizers: Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>
Responsible for optimizing a physical execution plan
query_planner: Arc<dyn QueryPlanner + Send + Sync>
Responsible for planning LogicalPlan
s, and ExecutionPlan
catalog_list: Arc<dyn CatalogList>
Collection of catalogs containing schemas and ultimately TableProviders
scalar_functions: HashMap<String, Arc<ScalarUDF>>
Scalar functions that are registered with the context
aggregate_functions: HashMap<String, Arc<AggregateUDF>>
Aggregate functions registered in the context
config: SessionConfig
Session configuration
execution_props: ExecutionProps
Execution properties
runtime_env: Arc<RuntimeEnv>
Runtime environment
Implementations§
source§impl SessionState
impl SessionState
sourcepub fn with_config_rt(config: SessionConfig, runtime: Arc<RuntimeEnv>) -> Self
pub fn with_config_rt(config: SessionConfig, runtime: Arc<RuntimeEnv>) -> Self
Returns new SessionState using the provided configuration and runtime
sourcepub fn with_query_planner(
self,
query_planner: Arc<dyn QueryPlanner + Send + Sync>
) -> Self
pub fn with_query_planner(
self,
query_planner: Arc<dyn QueryPlanner + Send + Sync>
) -> Self
Replace the default query planner
sourcepub fn with_optimizer_rules(
self,
rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>
) -> Self
pub fn with_optimizer_rules(
self,
rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>
) -> Self
Replace the optimizer rules
sourcepub fn with_physical_optimizer_rules(
self,
physical_optimizers: Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>
) -> Self
pub fn with_physical_optimizer_rules(
self,
physical_optimizers: Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>
) -> Self
Replace the physical optimizer rules
sourcepub fn add_optimizer_rule(
self,
optimizer_rule: Arc<dyn OptimizerRule + Send + Sync>
) -> Self
pub fn add_optimizer_rule(
self,
optimizer_rule: Arc<dyn OptimizerRule + Send + Sync>
) -> Self
Adds a new OptimizerRule
sourcepub fn add_physical_optimizer_rule(
self,
optimizer_rule: Arc<dyn PhysicalOptimizerRule + Send + Sync>
) -> Self
pub fn add_physical_optimizer_rule(
self,
optimizer_rule: Arc<dyn PhysicalOptimizerRule + Send + Sync>
) -> Self
Adds a new PhysicalOptimizerRule
sourcepub fn optimize(&self, plan: &LogicalPlan) -> Result<LogicalPlan>
pub fn optimize(&self, plan: &LogicalPlan) -> Result<LogicalPlan>
Optimizes the logical plan by applying optimizer rules.
sourcepub async fn create_physical_plan(
&self,
logical_plan: &LogicalPlan
) -> Result<Arc<dyn ExecutionPlan>>
pub async fn create_physical_plan(
&self,
logical_plan: &LogicalPlan
) -> Result<Arc<dyn ExecutionPlan>>
Creates a physical plan from a logical plan.
sourcepub fn config_options(&self) -> Arc<RwLock<ConfigOptions>>
pub fn config_options(&self) -> Arc<RwLock<ConfigOptions>>
return the configuration options
Trait Implementations§
source§impl Clone for SessionState
impl Clone for SessionState
source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ContextProvider for SessionState
impl ContextProvider for SessionState
source§fn get_table_provider(
&self,
name: TableReference<'_>
) -> Result<Arc<dyn TableSource>>
fn get_table_provider(
&self,
name: TableReference<'_>
) -> Result<Arc<dyn TableSource>>
source§fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>>
fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>>
source§fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>
fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>
source§fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>
fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>
source§fn get_config_option(&self, variable: &str) -> Option<ScalarValue>
fn get_config_option(&self, variable: &str) -> Option<ScalarValue>
source§impl Debug for SessionState
impl Debug for SessionState
source§impl From<&SessionState> for TaskContext
impl From<&SessionState> for TaskContext
Create a new task context instance from SessionState