pub struct TaskContext { /* private fields */ }Expand description
Task Execution Context
A TaskContext contains the state required during a single query’s
execution. Please see the documentation on SessionContext for more
information.
§Relationship with ExecutionProps
TaskContext is intentionally distinct from ExecutionProps.
ExecutionProps is state used while optimizing a logical
plan and constructing a physical plan.
TaskContext is the runtime context passed to physical operators when
executing a physical plan. It carries runtime services and session state
needed at that stage, such as RuntimeEnv, memory-pool access, session
configuration, and function lookup.
Keeping these structures separate avoids threading execution/runtime state through planning APIs, and avoids making execution depend on planner-only scratch state.
Implementations§
Source§impl TaskContext
impl TaskContext
Sourcepub fn new(
task_id: Option<String>,
session_id: String,
session_config: SessionConfig,
scalar_functions: HashMap<String, Arc<ScalarUDF>>,
higher_order_functions: HashMap<String, Arc<HigherOrderUDF>>,
aggregate_functions: HashMap<String, Arc<AggregateUDF>>,
window_functions: HashMap<String, Arc<WindowUDF>>,
runtime: Arc<RuntimeEnv>,
) -> TaskContext
pub fn new( task_id: Option<String>, session_id: String, session_config: SessionConfig, scalar_functions: HashMap<String, Arc<ScalarUDF>>, higher_order_functions: HashMap<String, Arc<HigherOrderUDF>>, aggregate_functions: HashMap<String, Arc<AggregateUDF>>, window_functions: HashMap<String, Arc<WindowUDF>>, runtime: Arc<RuntimeEnv>, ) -> TaskContext
Create a new TaskContext instance.
Most users will use SessionContext::task_ctx to create TaskContexts
Sourcepub fn session_config(&self) -> &SessionConfig
pub fn session_config(&self) -> &SessionConfig
Return the SessionConfig associated with this TaskContext
Sourcepub fn session_id(&self) -> String
pub fn session_id(&self) -> String
Return the session_id of this TaskContext
Sourcepub fn task_id(&self) -> Option<String>
pub fn task_id(&self) -> Option<String>
Return the task_id of this TaskContext
Sourcepub fn memory_pool(&self) -> &Arc<dyn MemoryPool> ⓘ
pub fn memory_pool(&self) -> &Arc<dyn MemoryPool> ⓘ
Return the MemoryPool associated with this TaskContext
Sourcepub fn runtime_env(&self) -> Arc<RuntimeEnv> ⓘ
pub fn runtime_env(&self) -> Arc<RuntimeEnv> ⓘ
Return the RuntimeEnv associated with this TaskContext
pub fn scalar_functions(&self) -> &HashMap<String, Arc<ScalarUDF>>
pub fn higher_order_functions(&self) -> &HashMap<String, Arc<HigherOrderUDF>>
pub fn aggregate_functions(&self) -> &HashMap<String, Arc<AggregateUDF>>
pub fn window_functions(&self) -> &HashMap<String, Arc<WindowUDF>>
Sourcepub fn with_session_config(self, session_config: SessionConfig) -> TaskContext
pub fn with_session_config(self, session_config: SessionConfig) -> TaskContext
Update the SessionConfig
Sourcepub fn with_runtime(self, runtime: Arc<RuntimeEnv>) -> TaskContext
pub fn with_runtime(self, runtime: Arc<RuntimeEnv>) -> TaskContext
Update the RuntimeEnv
Trait Implementations§
Source§impl Debug for TaskContext
impl Debug for TaskContext
Source§impl Default for TaskContext
impl Default for TaskContext
Source§fn default() -> TaskContext
fn default() -> TaskContext
Source§impl From<&SessionContext> for TaskContext
Create a new task context instance from SessionContext
impl From<&SessionContext> for TaskContext
Create a new task context instance from SessionContext
Source§fn from(session: &SessionContext) -> Self
fn from(session: &SessionContext) -> Self
Source§impl From<&SessionState> for TaskContext
Create a new task context instance from SessionState
impl From<&SessionState> for TaskContext
Create a new task context instance from SessionState
Source§fn from(state: &SessionState) -> Self
fn from(state: &SessionState) -> Self
Source§impl From<&dyn Session> for TaskContext
Create a new task context instance from Session
impl From<&dyn Session> for TaskContext
Create a new task context instance from Session
Source§fn from(state: &dyn Session) -> TaskContext
fn from(state: &dyn Session) -> TaskContext
Source§impl FunctionRegistry for TaskContext
impl FunctionRegistry for TaskContext
Source§fn udfs(&self) -> HashSet<String>
fn udfs(&self) -> HashSet<String>
Source§fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>, DataFusionError>
fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>, DataFusionError>
name.Source§fn higher_order_function(
&self,
name: &str,
) -> Result<Arc<HigherOrderUDF>, DataFusionError>
fn higher_order_function( &self, name: &str, ) -> Result<Arc<HigherOrderUDF>, DataFusionError>
name.Source§fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>, DataFusionError>
fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>, DataFusionError>
name.Source§fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>, DataFusionError>
fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>, DataFusionError>
name.Source§fn register_udaf(
&mut self,
udaf: Arc<AggregateUDF>,
) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>
fn register_udaf( &mut self, udaf: Arc<AggregateUDF>, ) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>
AggregateUDF, returning any previously registered
implementation. Read moreSource§fn register_udwf(
&mut self,
udwf: Arc<WindowUDF>,
) -> Result<Option<Arc<WindowUDF>>, DataFusionError>
fn register_udwf( &mut self, udwf: Arc<WindowUDF>, ) -> Result<Option<Arc<WindowUDF>>, DataFusionError>
Source§fn register_udf(
&mut self,
udf: Arc<ScalarUDF>,
) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>
fn register_udf( &mut self, udf: Arc<ScalarUDF>, ) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>
Source§fn register_higher_order_function(
&mut self,
function: Arc<HigherOrderUDF>,
) -> Result<Option<Arc<HigherOrderUDF>>, DataFusionError>
fn register_higher_order_function( &mut self, function: Arc<HigherOrderUDF>, ) -> Result<Option<Arc<HigherOrderUDF>>, DataFusionError>
HigherOrderUDF, returning any previously registered
implementation. Read moreSource§fn expr_planners(&self) -> Vec<Arc<dyn ExprPlanner>>
fn expr_planners(&self) -> Vec<Arc<dyn ExprPlanner>>
ExprPlannersSource§fn higher_order_function_names(&self) -> HashSet<String>
fn higher_order_function_names(&self) -> HashSet<String>
Source§fn udafs(&self) -> HashSet<String>
fn udafs(&self) -> HashSet<String>
Source§fn udwfs(&self) -> HashSet<String>
fn udwfs(&self) -> HashSet<String>
Source§fn deregister_udf(
&mut self,
_name: &str,
) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>
fn deregister_udf( &mut self, _name: &str, ) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>
Source§fn deregister_higher_order_function(
&mut self,
_name: &str,
) -> Result<Option<Arc<HigherOrderUDF>>, DataFusionError>
fn deregister_higher_order_function( &mut self, _name: &str, ) -> Result<Option<Arc<HigherOrderUDF>>, DataFusionError>
HigherOrderUDF, returning the implementation that was
deregistered. Read moreSource§fn deregister_udaf(
&mut self,
_name: &str,
) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>
fn deregister_udaf( &mut self, _name: &str, ) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>
AggregateUDF, returning the implementation that was
deregistered. Read moreSource§fn deregister_udwf(
&mut self,
_name: &str,
) -> Result<Option<Arc<WindowUDF>>, DataFusionError>
fn deregister_udwf( &mut self, _name: &str, ) -> Result<Option<Arc<WindowUDF>>, DataFusionError>
Source§fn register_function_rewrite(
&mut self,
_rewrite: Arc<dyn FunctionRewrite + Send + Sync>,
) -> Result<(), DataFusionError>
fn register_function_rewrite( &mut self, _rewrite: Arc<dyn FunctionRewrite + Send + Sync>, ) -> Result<(), DataFusionError>
FunctionRewrite with the registry. Read moreSource§fn register_expr_planner(
&mut self,
_expr_planner: Arc<dyn ExprPlanner>,
) -> Result<(), DataFusionError>
fn register_expr_planner( &mut self, _expr_planner: Arc<dyn ExprPlanner>, ) -> Result<(), DataFusionError>
ExprPlanner with the registry.Auto Trait Implementations§
impl !RefUnwindSafe for TaskContext
impl !UnwindSafe for TaskContext
impl Freeze for TaskContext
impl Send for TaskContext
impl Sync for TaskContext
impl Unpin for TaskContext
impl UnsafeUnpin for TaskContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more