pub trait OptimizerRuleProvider: Send + Sync {
// Required method
fn phase(&self) -> OptimizerPhase;
// Provided methods
fn rule(&self) -> Arc<dyn OptimizerRule + Send + Sync> ⓘ { ... }
fn physical_rule(
&self,
) -> Option<Arc<dyn PhysicalOptimizerRule + Send + Sync>> { ... }
fn precedence(&self) -> i32 { ... }
}Expand description
A registered optimizer-rule provider.
A provider that runs at the logical phase returns a logical
OptimizerRule from rule; a provider that runs at
the physical phase returns a PhysicalOptimizerRule from
physical_rule. A Both provider must
supply both. The host iterates the registered providers, inspects
phase, and installs each rule into the matching DataFusion
optimizer chain.
The default physical_rule returns None, so existing
logical-only providers compile unchanged across the 1.6 → 1.7
minor bump.
Required Methods§
Sourcefn phase(&self) -> OptimizerPhase
fn phase(&self) -> OptimizerPhase
Phase the rule runs at.
Provided Methods§
Sourcefn rule(&self) -> Arc<dyn OptimizerRule + Send + Sync> ⓘ
fn rule(&self) -> Arc<dyn OptimizerRule + Send + Sync> ⓘ
The DataFusion logical OptimizerRule to apply.
Logical-phase and Both-phase providers must return a real
rule. Physical-only providers may return any rule (the host
ignores it when phase() is OptimizerPhase::Physical);
returning a sentinel/no-op is conventional. The default impl
returns a no-op rule that never rewrites.
Sourcefn physical_rule(&self) -> Option<Arc<dyn PhysicalOptimizerRule + Send + Sync>>
fn physical_rule(&self) -> Option<Arc<dyn PhysicalOptimizerRule + Send + Sync>>
The DataFusion physical PhysicalOptimizerRule to apply.
Physical-phase and Both-phase providers should return
Some(...). The default None keeps existing logical-only
providers source-compatible.
Sourcefn precedence(&self) -> i32
fn precedence(&self) -> i32
Ordering hint — lower precedence rules run first.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".