Struct datafusion_optimizer::optimizer::Optimizer
source · pub struct Optimizer {
pub rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>,
}
Expand description
A rule-based optimizer.
Fields§
§rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>
All optimizer rules to apply
Implementations§
source§impl Optimizer
impl Optimizer
sourcepub fn with_rules(rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>) -> Self
pub fn with_rules(rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>) -> Self
Create a new optimizer with the given rules
sourcepub fn optimize<F>(
&self,
plan: &LogicalPlan,
config: &dyn OptimizerConfig,
observer: F
) -> Result<LogicalPlan>where
F: FnMut(&LogicalPlan, &dyn OptimizerRule),
pub fn optimize<F>( &self, plan: &LogicalPlan, config: &dyn OptimizerConfig, observer: F ) -> Result<LogicalPlan>where F: FnMut(&LogicalPlan, &dyn OptimizerRule),
Optimizes the logical plan by applying optimizer rules, and invoking observer function after each call
sourcepub fn optimize_recursively(
&self,
rule: &Arc<dyn OptimizerRule + Send + Sync>,
plan: &LogicalPlan,
config: &dyn OptimizerConfig
) -> Result<Option<LogicalPlan>>
pub fn optimize_recursively( &self, rule: &Arc<dyn OptimizerRule + Send + Sync>, plan: &LogicalPlan, config: &dyn OptimizerConfig ) -> Result<Option<LogicalPlan>>
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 !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