pub struct AdaptiveContext { /* private fields */ }Expand description
Context for adaptive query execution.
Holds both estimated and actual cardinalities, and provides methods to determine when re-optimization should occur.
Implementations§
Source§impl AdaptiveContext
impl AdaptiveContext
Sourcepub fn with_thresholds(threshold: f64, min_rows: u64) -> Self
pub fn with_thresholds(threshold: f64, min_rows: u64) -> Self
Creates a context with custom thresholds.
Sourcepub fn set_estimate(&mut self, operator_id: &str, estimate: f64)
pub fn set_estimate(&mut self, operator_id: &str, estimate: f64)
Sets the estimated cardinality for an operator.
Sourcepub fn record_actual(&mut self, operator_id: &str, actual: u64)
pub fn record_actual(&mut self, operator_id: &str, actual: u64)
Records the actual cardinality for an operator.
Sourcepub fn apply_feedback(&mut self, feedback: &CardinalityFeedback)
pub fn apply_feedback(&mut self, feedback: &CardinalityFeedback)
Applies feedback from a CardinalityFeedback collector.
Sourcepub fn has_significant_deviation(&self) -> bool
pub fn has_significant_deviation(&self) -> bool
Checks if any checkpoint shows significant deviation.
Sourcepub fn should_reoptimize(&mut self) -> bool
pub fn should_reoptimize(&mut self) -> bool
Determines if re-optimization should be triggered.
Returns true if:
- There’s significant deviation from estimates
- We’ve processed enough rows to make a meaningful decision
- Re-optimization hasn’t already been triggered
Sourcepub fn trigger_operator(&self) -> Option<&str>
pub fn trigger_operator(&self) -> Option<&str>
Returns the operator that triggered re-optimization, if any.
Sourcepub fn get_checkpoint(
&self,
operator_id: &str,
) -> Option<&CardinalityCheckpoint>
pub fn get_checkpoint( &self, operator_id: &str, ) -> Option<&CardinalityCheckpoint>
Gets the checkpoint for an operator.
Sourcepub fn all_checkpoints(&self) -> &HashMap<String, CardinalityCheckpoint>
pub fn all_checkpoints(&self) -> &HashMap<String, CardinalityCheckpoint>
Returns all checkpoints.
Sourcepub fn correction_factor(&self, operator_id: &str) -> f64
pub fn correction_factor(&self, operator_id: &str) -> f64
Calculates a correction factor for a specific operator.
This factor can be used to adjust remaining cardinality estimates.
Sourcepub fn summary(&self) -> AdaptiveSummary
pub fn summary(&self) -> AdaptiveSummary
Returns summary statistics about the adaptive execution.
Trait Implementations§
Source§impl Debug for AdaptiveContext
impl Debug for AdaptiveContext
Auto Trait Implementations§
impl Freeze for AdaptiveContext
impl RefUnwindSafe for AdaptiveContext
impl Send for AdaptiveContext
impl Sync for AdaptiveContext
impl Unpin for AdaptiveContext
impl UnsafeUnpin for AdaptiveContext
impl UnwindSafe for AdaptiveContext
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
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 more