Skip to main content

AdaptiveContext

Struct AdaptiveContext 

Source
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

Source

pub fn new() -> Self

Creates a new adaptive context with default settings.

Source

pub fn with_thresholds(threshold: f64, min_rows: u64) -> Self

Creates a context with custom thresholds.

Source

pub fn set_estimate(&mut self, operator_id: &str, estimate: f64)

Sets the estimated cardinality for an operator.

Source

pub fn record_actual(&mut self, operator_id: &str, actual: u64)

Records the actual cardinality for an operator.

Source

pub fn apply_feedback(&mut self, feedback: &CardinalityFeedback)

Applies feedback from a CardinalityFeedback collector.

Source

pub fn has_significant_deviation(&self) -> bool

Checks if any checkpoint shows significant deviation.

Source

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
Source

pub fn trigger_operator(&self) -> Option<&str>

Returns the operator that triggered re-optimization, if any.

Source

pub fn get_checkpoint( &self, operator_id: &str, ) -> Option<&CardinalityCheckpoint>

Gets the checkpoint for an operator.

Source

pub fn all_checkpoints(&self) -> &HashMap<String, CardinalityCheckpoint>

Returns all checkpoints.

Source

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.

Source

pub fn summary(&self) -> AdaptiveSummary

Returns summary statistics about the adaptive execution.

Source

pub fn reset(&mut self)

Resets the context for a new execution.

Trait Implementations§

Source§

impl Debug for AdaptiveContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AdaptiveContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.