pub struct Optimizer {
pub rules: Vec<Arc<dyn OptimizerRule + Sync + Send>>,
}
Expand description
A rule-based optimizer.
Fields§
§rules: Vec<Arc<dyn OptimizerRule + Sync + Send>>
All optimizer rules to apply
Implementations§
source§impl Optimizer
impl Optimizer
sourcepub fn with_rules(rules: Vec<Arc<dyn OptimizerRule + Sync + Send>>) -> Optimizer
pub fn with_rules(rules: Vec<Arc<dyn OptimizerRule + Sync + Send>>) -> Optimizer
Create a new optimizer with the given rules
sourcepub fn optimize<F>(
&self,
plan: &LogicalPlan,
config: &dyn OptimizerConfig,
observer: F
) -> Result<LogicalPlan, DataFusionError>
pub fn optimize<F>( &self, plan: &LogicalPlan, config: &dyn OptimizerConfig, observer: F ) -> Result<LogicalPlan, DataFusionError>
Optimizes the logical plan by applying optimizer rules, and invoking observer function after each call
sourcepub fn optimize_recursively(
&self,
rule: &Arc<dyn OptimizerRule + Sync + Send>,
plan: &LogicalPlan,
config: &dyn OptimizerConfig
) -> Result<Option<LogicalPlan>, DataFusionError>
pub fn optimize_recursively( &self, rule: &Arc<dyn OptimizerRule + Sync + Send>, plan: &LogicalPlan, config: &dyn OptimizerConfig ) -> Result<Option<LogicalPlan>, DataFusionError>
Use a rule to optimize the whole plan.
If the rule with ApplyOrder
, we don’t need to recursively handle children in rule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Optimizer
impl !RefUnwindSafe for Optimizer
impl Send for Optimizer
impl Sync for Optimizer
impl Unpin for Optimizer
impl !UnwindSafe for Optimizer
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
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.