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
sourceimpl 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.
Trait Implementations
sourceimpl Clone for SessionState
impl Clone for SessionState
sourcefn clone(&self) -> SessionState
fn clone(&self) -> SessionState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl ContextProvider for SessionState
impl ContextProvider for SessionState
sourcefn get_table_provider(
&self,
name: TableReference<'_>
) -> Result<Arc<dyn TableSource>>
fn get_table_provider(
&self,
name: TableReference<'_>
) -> Result<Arc<dyn TableSource>>
Getter for a datasource
sourcefn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>
fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>
Getter for a UDAF description
sourcefn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>
fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>
Getter for system/user-defined variable type
sourceimpl Debug for SessionState
impl Debug for SessionState
sourceimpl From<&SessionState> for TaskContext
impl From<&SessionState> for TaskContext
Create a new task context instance from SessionState
sourcefn from(state: &SessionState) -> Self
fn from(state: &SessionState) -> Self
Converts to this type from the input type.
sourceimpl FunctionRegistry for SessionState
impl FunctionRegistry for SessionState
Auto Trait Implementations
impl !RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl !UnwindSafe for SessionState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more