Skip to main content

PhysicalPlan

Enum PhysicalPlan 

Source
pub enum PhysicalPlan {
Show 19 variants TableScan { table: String, }, IndexScan { table: String, index: String, range_start: Option<Value>, range_end: Option<Value>, include_start: bool, include_end: bool, limit: Option<usize>, offset: Option<usize>, reverse: bool, }, IndexGet { table: String, index: String, key: Value, limit: Option<usize>, }, IndexInGet { table: String, index: String, keys: Vec<Value>, }, GinIndexScan { table: String, index: String, key: String, value: Option<String>, query_type: String, }, GinIndexScanMulti { table: String, index: String, pairs: Vec<(String, String)>, }, Filter { input: Box<PhysicalPlan>, predicate: Expr, }, Project { input: Box<PhysicalPlan>, columns: Vec<Expr>, }, HashJoin { left: Box<PhysicalPlan>, right: Box<PhysicalPlan>, condition: Expr, join_type: JoinType, }, SortMergeJoin { left: Box<PhysicalPlan>, right: Box<PhysicalPlan>, condition: Expr, join_type: JoinType, }, NestedLoopJoin { left: Box<PhysicalPlan>, right: Box<PhysicalPlan>, condition: Expr, join_type: JoinType, }, IndexNestedLoopJoin { outer: Box<PhysicalPlan>, inner_table: String, inner_index: String, condition: Expr, join_type: JoinType, }, HashAggregate { input: Box<PhysicalPlan>, group_by: Vec<Expr>, aggregates: Vec<(AggregateFunc, Expr)>, }, Sort { input: Box<PhysicalPlan>, order_by: Vec<(Expr, SortOrder)>, }, TopN { input: Box<PhysicalPlan>, order_by: Vec<(Expr, SortOrder)>, limit: usize, offset: usize, }, Limit { input: Box<PhysicalPlan>, limit: usize, offset: usize, }, CrossProduct { left: Box<PhysicalPlan>, right: Box<PhysicalPlan>, }, NoOp { input: Box<PhysicalPlan>, }, Empty,
}
Expand description

Physical query plan node.

Variants§

§

TableScan

Full table scan.

Fields

§table: String
§

IndexScan

Index scan with a key range.

Fields

§table: String
§index: String
§range_start: Option<Value>
§range_end: Option<Value>
§include_start: bool
§include_end: bool
§limit: Option<usize>

Optional limit for early termination.

§offset: Option<usize>

Optional offset to skip rows.

§reverse: bool

Whether to scan in reverse order (for DESC sorting).

§

IndexGet

Index point lookup.

Fields

§table: String
§index: String
§key: Value
§limit: Option<usize>

Optional limit for early termination.

§

IndexInGet

Index multi-point lookup (for IN queries). Performs multiple index lookups and unions the results.

Fields

§table: String
§index: String
§keys: Vec<Value>
§

GinIndexScan

GIN index scan for JSONB queries.

Fields

§table: String
§index: String
§key: String

The key to search for (JSON path segment).

§value: Option<String>

The value to match (for equality queries).

§query_type: String

Query type: “eq”, “contains”, or “exists”.

§

GinIndexScanMulti

GIN index scan for multiple JSONB predicates (AND combination). More efficient than multiple single GIN scans followed by intersection.

Fields

§table: String
§index: String
§pairs: Vec<(String, String)>

Multiple key-value pairs to match (all must match - AND semantics).

§

Filter

Filter operator.

Fields

§predicate: Expr
§

Project

Projection operator.

Fields

§columns: Vec<Expr>
§

HashJoin

Hash join.

Fields

§condition: Expr
§join_type: JoinType
§

SortMergeJoin

Sort-merge join.

Fields

§condition: Expr
§join_type: JoinType
§

NestedLoopJoin

Nested loop join.

Fields

§condition: Expr
§join_type: JoinType
§

IndexNestedLoopJoin

Index nested loop join.

Fields

§inner_table: String
§inner_index: String
§condition: Expr
§join_type: JoinType
§

HashAggregate

Hash aggregate.

Fields

§group_by: Vec<Expr>
§aggregates: Vec<(AggregateFunc, Expr)>
§

Sort

Sort operator.

Fields

§order_by: Vec<(Expr, SortOrder)>
§

TopN

TopN operator - combines Sort and Limit for efficient top-k selection. Uses a heap to maintain only the top N elements, avoiding full sort.

Fields

§order_by: Vec<(Expr, SortOrder)>
§limit: usize
§offset: usize
§

Limit

Limit and offset.

Fields

§limit: usize
§offset: usize
§

CrossProduct

Cross product.

Fields

§

NoOp

No-op step (passes through input).

Fields

§

Empty

Empty result.

Implementations§

Source§

impl PhysicalPlan

Source

pub fn table_scan(table: impl Into<String>) -> Self

Creates a table scan plan.

Source

pub fn index_scan( table: impl Into<String>, index: impl Into<String>, range_start: Option<Value>, range_end: Option<Value>, ) -> Self

Creates an index scan plan.

Source

pub fn index_scan_with_limit( table: impl Into<String>, index: impl Into<String>, range_start: Option<Value>, range_end: Option<Value>, limit: Option<usize>, offset: Option<usize>, ) -> Self

Creates an index scan plan with limit and offset.

Source

pub fn index_scan_with_options( table: impl Into<String>, index: impl Into<String>, range_start: Option<Value>, range_end: Option<Value>, limit: Option<usize>, offset: Option<usize>, reverse: bool, ) -> Self

Creates an index scan plan with limit, offset, and reverse option.

Source

pub fn index_get( table: impl Into<String>, index: impl Into<String>, key: Value, ) -> Self

Creates an index point lookup plan.

Source

pub fn index_get_with_limit( table: impl Into<String>, index: impl Into<String>, key: Value, limit: Option<usize>, ) -> Self

Creates an index point lookup plan with limit.

Source

pub fn index_in_get( table: impl Into<String>, index: impl Into<String>, keys: Vec<Value>, ) -> Self

Creates an index multi-point lookup plan (for IN queries).

Source

pub fn gin_index_scan( table: impl Into<String>, index: impl Into<String>, key: impl Into<String>, value: Option<String>, query_type: impl Into<String>, ) -> Self

Creates a GIN index scan plan.

Source

pub fn gin_index_scan_multi( table: impl Into<String>, index: impl Into<String>, pairs: Vec<(String, String)>, ) -> Self

Creates a GIN index scan plan for multiple key-value pairs (AND combination).

Source

pub fn filter(input: PhysicalPlan, predicate: Expr) -> Self

Creates a filter plan.

Source

pub fn project(input: PhysicalPlan, columns: Vec<Expr>) -> Self

Creates a projection plan.

Source

pub fn hash_join( left: PhysicalPlan, right: PhysicalPlan, condition: Expr, join_type: JoinType, ) -> Self

Creates a hash join plan.

Source

pub fn sort_merge_join( left: PhysicalPlan, right: PhysicalPlan, condition: Expr, join_type: JoinType, ) -> Self

Creates a sort-merge join plan.

Source

pub fn nested_loop_join( left: PhysicalPlan, right: PhysicalPlan, condition: Expr, join_type: JoinType, ) -> Self

Creates a nested loop join plan.

Source

pub fn hash_aggregate( input: PhysicalPlan, group_by: Vec<Expr>, aggregates: Vec<(AggregateFunc, Expr)>, ) -> Self

Creates a hash aggregate plan.

Source

pub fn sort(input: PhysicalPlan, order_by: Vec<(Expr, SortOrder)>) -> Self

Creates a sort plan.

Source

pub fn top_n( input: PhysicalPlan, order_by: Vec<(Expr, SortOrder)>, limit: usize, offset: usize, ) -> Self

Creates a TopN plan for efficient top-k selection.

Source

pub fn limit(input: PhysicalPlan, limit: usize, offset: usize) -> Self

Creates a limit plan.

Source

pub fn is_incrementalizable(&self) -> bool

Checks if this plan can be incrementalized.

Source

pub fn inputs(&self) -> Vec<&PhysicalPlan>

Returns the input plan(s) of this node.

Trait Implementations§

Source§

impl Clone for PhysicalPlan

Source§

fn clone(&self) -> PhysicalPlan

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PhysicalPlan

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.