pub struct ExecutionContext<'a> {
pub catalog: &'a mut Catalog,
/* private fields */
}Expand description
Shared state threaded through every physical operator during execution. Exposes MVCC helpers, storage access, expression evaluation and DDL utilities.
Fields§
§catalog: &'a mut CatalogMutable reference to the global catalog (schema + metadata).
Implementations§
Source§impl<'a> ExecutionContext<'a>
impl<'a> ExecutionContext<'a>
pub fn new( catalog: &'a mut Catalog, txn: &'a mut Transaction, txn_mgr: &'a TransactionManager, storage: Arc<dyn StorageEngine>, ) -> Self
pub fn command_id(&self) -> CommandId
pub fn snapshot(&self) -> &TransactionSnapshot
pub fn is_visible(&self, meta: &TupleMeta) -> bool
Sourcepub fn read_visible_tuple(
&mut self,
table: &TableReference,
rid: RecordId,
meta: &TupleMeta,
tuple: Tuple,
) -> QuillSQLResult<Option<Tuple>>
pub fn read_visible_tuple( &mut self, table: &TableReference, rid: RecordId, meta: &TupleMeta, tuple: Tuple, ) -> QuillSQLResult<Option<Tuple>>
Perform MVCC visibility checks (and shared locks) based on the current isolation level, returning the tuple only if it is visible.
Sourcepub fn eval_predicate(&self, expr: &Expr, tuple: &Tuple) -> QuillSQLResult<bool>
pub fn eval_predicate(&self, expr: &Expr, tuple: &Tuple) -> QuillSQLResult<bool>
Evaluate an expression expected to produce a boolean result.
Sourcepub fn eval_expr(
&self,
expr: &Expr,
tuple: &Tuple,
) -> QuillSQLResult<ScalarValue>
pub fn eval_expr( &self, expr: &Expr, tuple: &Tuple, ) -> QuillSQLResult<ScalarValue>
Evaluate an arbitrary scalar expression.
Sourcepub fn insert_tuple_with_indexes(
&mut self,
table: &TableReference,
tuple: &Tuple,
) -> QuillSQLResult<()>
pub fn insert_tuple_with_indexes( &mut self, table: &TableReference, tuple: &Tuple, ) -> QuillSQLResult<()>
Insert a tuple, update all indexes, and register undo state.
Sourcepub fn apply_delete(
&mut self,
table_heap: Arc<TableHeap>,
rid: RecordId,
prev_meta: TupleMeta,
prev_tuple: Tuple,
) -> QuillSQLResult<()>
pub fn apply_delete( &mut self, table_heap: Arc<TableHeap>, rid: RecordId, prev_meta: TupleMeta, prev_tuple: Tuple, ) -> QuillSQLResult<()>
Mark a row deleted via MVCC and enqueue undo data.
Sourcepub fn apply_update(
&mut self,
table: &TableReference,
table_heap: Arc<TableHeap>,
rid: RecordId,
new_tuple: Tuple,
prev_meta: TupleMeta,
prev_tuple: Tuple,
) -> QuillSQLResult<()>
pub fn apply_update( &mut self, table: &TableReference, table_heap: Arc<TableHeap>, rid: RecordId, new_tuple: Tuple, prev_meta: TupleMeta, prev_tuple: Tuple, ) -> QuillSQLResult<()>
Create a new MVCC version, update indexes, and log undo.
Sourcepub fn prepare_row_for_write(
&mut self,
table: &TableReference,
rid: RecordId,
table_heap: &Arc<TableHeap>,
observed_meta: &TupleMeta,
) -> QuillSQLResult<Option<(TupleMeta, Tuple)>>
pub fn prepare_row_for_write( &mut self, table: &TableReference, rid: RecordId, table_heap: &Arc<TableHeap>, observed_meta: &TupleMeta, ) -> QuillSQLResult<Option<(TupleMeta, Tuple)>>
Acquire an exclusive lock and re-check visibility before mutating a row. Returns the current tuple version if it is still visible.
pub fn lock_table( &mut self, table: TableReference, mode: LockMode, ) -> QuillSQLResult<()>
pub fn lock_row_exclusive( &mut self, table: &TableReference, rid: RecordId, ) -> QuillSQLResult<()>
Sourcepub fn ensure_writable(
&self,
table: &TableReference,
operation: &str,
) -> QuillSQLResult<()>
pub fn ensure_writable( &self, table: &TableReference, operation: &str, ) -> QuillSQLResult<()>
Ensure that the current transaction is allowed to perform a write on the given table.
pub fn txn(&self) -> &Transaction
pub fn txn_mut(&mut self) -> &mut Transaction
pub fn txn_manager(&self) -> &TransactionManager
pub fn txn_runtime(&self) -> &TxnRuntime<'a>
pub fn txn_id(&self) -> TransactionId
pub fn unlock_row(&self, table: &TableReference, rid: RecordId)
Sourcepub fn table_heap(
&self,
table: &TableReference,
) -> QuillSQLResult<Arc<TableHeap>>
pub fn table_heap( &self, table: &TableReference, ) -> QuillSQLResult<Arc<TableHeap>>
Look up the table heap through the storage engine.
Sourcepub fn table_indexes(
&self,
table: &TableReference,
) -> QuillSQLResult<Vec<Arc<BPlusTreeIndex>>>
pub fn table_indexes( &self, table: &TableReference, ) -> QuillSQLResult<Vec<Arc<BPlusTreeIndex>>>
Fetch all indexes defined on a table.
Sourcepub fn try_table_heap(&self, table: &TableReference) -> Option<Arc<TableHeap>>
pub fn try_table_heap(&self, table: &TableReference) -> Option<Arc<TableHeap>>
Non-allocating helper used by DDL to test for table existence.
Sourcepub fn create_table(
&mut self,
table: TableReference,
schema: Arc<Schema>,
) -> QuillSQLResult<()>
pub fn create_table( &mut self, table: TableReference, schema: Arc<Schema>, ) -> QuillSQLResult<()>
Create a table (used by the CREATE TABLE physical operator).
Sourcepub fn drop_table(&mut self, table: &TableReference) -> QuillSQLResult<bool>
pub fn drop_table(&mut self, table: &TableReference) -> QuillSQLResult<bool>
Drop a table, returning whether it existed.
Sourcepub fn create_index(
&mut self,
name: String,
table: &TableReference,
key_schema: Arc<Schema>,
) -> QuillSQLResult<()>
pub fn create_index( &mut self, name: String, table: &TableReference, key_schema: Arc<Schema>, ) -> QuillSQLResult<()>
Create an index (used by CREATE INDEX).
Sourcepub fn drop_index(
&mut self,
table: &TableReference,
name: &str,
) -> QuillSQLResult<bool>
pub fn drop_index( &mut self, table: &TableReference, name: &str, ) -> QuillSQLResult<bool>
Drop an index, returning whether it existed.
Sourcepub fn find_index_owner(
&self,
catalog: Option<&str>,
schema: Option<&str>,
name: &str,
) -> Option<TableReference>
pub fn find_index_owner( &self, catalog: Option<&str>, schema: Option<&str>, name: &str, ) -> Option<TableReference>
Resolve the table that owns catalog.schema.index.
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> 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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
Source§fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
Source§fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
Source§fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
Source§fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
Source§fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
Source§fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Source§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Source§fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
Source§fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
Source§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Source§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Source§fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Source§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Source§fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Source§fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Source§fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
Source§fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
Source§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
Source§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
Source§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Source§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Source§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Source§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Source§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Source§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Source§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Source§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Source§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Source§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Source§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Source§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Source§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Source§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Source§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Source§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Source§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Source§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Source§fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
Source§fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
Source§fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
Source§fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
Source§fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
Source§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
Source§fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
Source§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more