pub trait PhysicalOptimizerRule: Debug {
// Required methods
fn optimize(
&self,
plan: Arc<dyn ExecutionPlan>,
config: &ConfigOptions,
) -> Result<Arc<dyn ExecutionPlan>>;
fn name(&self) -> &str;
fn schema_check(&self) -> bool;
}
Expand description
PhysicalOptimizerRule
transforms one [‘ExecutionPlan’] into another which
computes the same results, but in a potentially more efficient way.
Use SessionState::add_physical_optimizer_rule
to register additional
PhysicalOptimizerRule
s.
Required Methods§
Sourcefn optimize(
&self,
plan: Arc<dyn ExecutionPlan>,
config: &ConfigOptions,
) -> Result<Arc<dyn ExecutionPlan>>
fn optimize( &self, plan: Arc<dyn ExecutionPlan>, config: &ConfigOptions, ) -> Result<Arc<dyn ExecutionPlan>>
Rewrite plan
to an optimized form
Sourcefn schema_check(&self) -> bool
fn schema_check(&self) -> bool
A flag to indicate whether the physical planner should valid the rule will not change the schema of the plan after the rewriting. Some of the optimization rules might change the nullable properties of the schema and should disable the schema check.
Implementors§
impl PhysicalOptimizerRule for AggregateStatistics
impl PhysicalOptimizerRule for CoalesceBatches
impl PhysicalOptimizerRule for CombinePartialFinalAggregate
impl PhysicalOptimizerRule for EnforceDistribution
impl PhysicalOptimizerRule for EnforceSorting
The boolean flag repartition_sorts
defined in the config indicates
whether we elect to transform CoalescePartitionsExec
+ SortExec
cascades
into SortExec
+ SortPreservingMergeExec
cascades, which enables us to
perform sorting in parallel.