ExecutionContext

Struct ExecutionContext 

Source
pub struct ExecutionContext<'a> {
    pub schema: &'a CombinedSchema,
    pub database: &'a Database,
    pub outer_row: Option<&'a Row>,
    pub outer_schema: Option<&'a CombinedSchema>,
    pub procedural_context: Option<&'a ExecutionContext>,
    pub cte_context: Option<&'a HashMap<String, CteResult>>,
    pub window_mapping: Option<&'a HashMap<WindowFunctionKey, usize>>,
}
Expand description

Execution context that bundles all information needed for query execution.

This struct consolidates the various optional contexts (outer row, procedural, CTE, windows) that were previously passed separately, reducing the number of evaluator constructor variants needed.

§Example

let ctx = ExecutionContext::new(schema, database)
    .with_cte_context(cte_results)
    .with_outer_context(outer_row, outer_schema);

let evaluator = ctx.create_evaluator();

Fields§

§schema: &'a CombinedSchema

The combined schema for column resolution

§database: &'a Database

Database reference for table access and subqueries

§outer_row: Option<&'a Row>

Optional outer row for correlated subqueries

§outer_schema: Option<&'a CombinedSchema>

Optional outer schema for correlated subqueries

§procedural_context: Option<&'a ExecutionContext>

Optional procedural context for stored procedures/functions

§cte_context: Option<&'a HashMap<String, CteResult>>

Optional CTE context for WITH clause results

§window_mapping: Option<&'a HashMap<WindowFunctionKey, usize>>

Optional window function mapping

Implementations§

Source§

impl<'a> ExecutionContext<'a>

Source

pub fn new(schema: &'a CombinedSchema, database: &'a Database) -> Self

Create a new execution context with required parameters.

§Arguments
  • schema - The combined schema for column resolution
  • database - Database reference for table access
Source

pub fn with_outer_context( self, outer_row: &'a Row, outer_schema: &'a CombinedSchema, ) -> Self

Add outer context for correlated subqueries.

§Arguments
  • outer_row - The current row from the outer query
  • outer_schema - The schema of the outer query
Source

pub fn with_procedural_context(self, proc_ctx: &'a ExecutionContext) -> Self

Add procedural context for stored procedures/functions.

§Arguments
  • proc_ctx - The procedural execution context
Source

pub fn with_cte_context(self, cte_ctx: &'a HashMap<String, CteResult>) -> Self

Add CTE context for WITH clause results.

§Arguments
  • cte_ctx - Map of CTE names to their results
Source

pub fn with_window_mapping( self, window_mapping: &'a HashMap<WindowFunctionKey, usize>, ) -> Self

Add window function mapping.

§Arguments
  • window_mapping - Map of window function keys to result column indices
Source

pub fn create_evaluator(&self) -> CombinedExpressionEvaluator<'a>

Create a CombinedExpressionEvaluator with all the context from this struct.

This replaces the many constructor variants like:

  • with_database()
  • with_database_and_cte()
  • with_database_and_outer_context()
  • with_database_and_outer_context_and_cte()
  • with_database_and_procedural_context()
  • with_database_and_procedural_context_and_cte()
  • with_database_and_windows()
  • with_database_and_windows_and_cte()

By using a builder pattern, we consolidate all 8+ variants into a single method.

Source

pub fn has_outer_context(&self) -> bool

Check if this context has outer context (for correlated subqueries).

Source

pub fn has_cte_context(&self) -> bool

Check if this context has CTE context.

Source

pub fn has_procedural_context(&self) -> bool

Check if this context has procedural context.

Auto Trait Implementations§

§

impl<'a> Freeze for ExecutionContext<'a>

§

impl<'a> !RefUnwindSafe for ExecutionContext<'a>

§

impl<'a> Send for ExecutionContext<'a>

§

impl<'a> Sync for ExecutionContext<'a>

§

impl<'a> Unpin for ExecutionContext<'a>

§

impl<'a> !UnwindSafe for ExecutionContext<'a>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool