pub struct AqeOptimizer { /* private fields */ }Expand description
AQE optimizer that automatically skips partition-changing rules for streaming plans.
Rules added via add_guarded_rule are
not applied when StreamingAqeGuard::plan_is_streaming returns true.
Rules added via add_rule always run regardless
of execution kind — use this for rules that are safe on streaming plans
(e.g., pure statistics collection).
Implementations§
Source§impl AqeOptimizer
impl AqeOptimizer
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty AQE optimizer backed by StaticCostModel.
Sourcepub fn with_cost_model(self, model: Arc<dyn CostModel>) -> Self
pub fn with_cost_model(self, model: Arc<dyn CostModel>) -> Self
Replace the default cost model with a custom implementation.
Sourcepub fn add_rule(&mut self, rule: Box<dyn AqeRule>)
pub fn add_rule(&mut self, rule: Box<dyn AqeRule>)
Add a rule that always runs, including on streaming plans.
Sourcepub fn add_guarded_rule(&mut self, rule: Box<dyn AqeRule>)
pub fn add_guarded_rule(&mut self, rule: Box<dyn AqeRule>)
Add a rule that is skipped when the plan is a streaming plan.
Use this for coalescing, repartitioning, and any other AQE rule that changes partition count or assignment.
Sourcepub fn apply(
&self,
plan: PhysicalPlan,
stats: &[RuntimeStats],
) -> OptimizerResult<(PhysicalPlan, Vec<String>)>
pub fn apply( &self, plan: PhysicalPlan, stats: &[RuntimeStats], ) -> OptimizerResult<(PhysicalPlan, Vec<String>)>
Apply all applicable rules given per-stage runtime statistics.
When stats is empty the cost model is used to synthesise a single
RuntimeStats entry (from the logical plan cost estimate) so that rules
that need size information can still make a first-pass decision.
Returns the (possibly rewritten) plan and the names of rules that fired.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AqeOptimizer
impl !UnwindSafe for AqeOptimizer
impl Freeze for AqeOptimizer
impl Send for AqeOptimizer
impl Sync for AqeOptimizer
impl Unpin for AqeOptimizer
impl UnsafeUnpin for AqeOptimizer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request