Skip to main content

LogicalPlan

Enum LogicalPlan 

Source
pub enum LogicalPlan {
Show 15 variants Scan { table: String, }, IndexScan { table: String, index: String, range_start: Option<Value>, range_end: Option<Value>, include_start: bool, include_end: bool, }, IndexGet { table: String, index: String, key: Value, }, IndexInGet { table: String, index: String, keys: Vec<Value>, }, GinIndexScan { table: String, index: String, column: String, column_index: usize, path: String, value: Option<Value>, query_type: String, }, GinIndexScanMulti { table: String, index: String, column: String, pairs: Vec<(String, Value)>, }, Filter { input: Box<LogicalPlan>, predicate: Expr, }, Project { input: Box<LogicalPlan>, columns: Vec<Expr>, }, Join { left: Box<LogicalPlan>, right: Box<LogicalPlan>, condition: Expr, join_type: JoinType, }, Aggregate { input: Box<LogicalPlan>, group_by: Vec<Expr>, aggregates: Vec<(AggregateFunc, Expr)>, }, Sort { input: Box<LogicalPlan>, order_by: Vec<(Expr, SortOrder)>, }, Limit { input: Box<LogicalPlan>, limit: usize, offset: usize, }, CrossProduct { left: Box<LogicalPlan>, right: Box<LogicalPlan>, }, Union { left: Box<LogicalPlan>, right: Box<LogicalPlan>, all: bool, }, Empty,
}
Expand description

Logical query plan node.

Variants§

§

Scan

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
§

IndexGet

Index point lookup.

Fields

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

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
§column: String

The JSONB column being queried.

§column_index: usize

The column index in the table schema.

§path: String

The JSON path being queried (e.g., “$.city”).

§value: Option<Value>

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
§column: String

The JSONB column being queried.

§pairs: Vec<(String, Value)>

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

§

Filter

Filter (WHERE clause).

Fields

§predicate: Expr
§

Project

Projection (SELECT columns).

Fields

§columns: Vec<Expr>
§

Join

Join two relations.

Fields

§condition: Expr
§join_type: JoinType
§

Aggregate

Aggregation (GROUP BY).

Fields

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

Sort

Sort (ORDER BY).

Fields

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

Limit

Limit and offset.

Fields

§limit: usize
§offset: usize
§

CrossProduct

Cross product (cartesian join).

Fields

§

Union

Union of two relations.

Fields

§all: bool
§

Empty

Empty relation.

Implementations§

Source§

impl LogicalPlan

Source

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

Creates a table scan plan.

Source

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

Creates a filter plan.

Source

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

Creates a projection plan.

Source

pub fn join( left: LogicalPlan, right: LogicalPlan, condition: Expr, join_type: JoinType, ) -> Self

Creates a join plan.

Source

pub fn inner_join( left: LogicalPlan, right: LogicalPlan, condition: Expr, ) -> Self

Creates an inner join plan.

Source

pub fn left_join(left: LogicalPlan, right: LogicalPlan, condition: Expr) -> Self

Creates a left outer join plan.

Source

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

Creates an aggregation plan.

Source

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

Creates a sort plan.

Source

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

Creates a limit plan.

Source

pub fn cross_product(left: LogicalPlan, right: LogicalPlan) -> Self

Creates a cross product plan.

Source

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

Returns the input plan(s) of this node.

Trait Implementations§

Source§

impl Clone for LogicalPlan

Source§

fn clone(&self) -> LogicalPlan

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 LogicalPlan

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.