pub struct SelectPlan {
pub tables: Vec<TableRef>,
pub joins: Vec<JoinMetadata>,
pub projections: Vec<SelectProjection>,
pub filter: Option<SelectFilter>,
pub having: Option<Expr<'static, String>>,
pub scalar_subqueries: Vec<ScalarSubquery>,
pub aggregates: Vec<AggregateExpr>,
pub order_by: Vec<OrderByPlan>,
pub distinct: bool,
pub compound: Option<CompoundSelectPlan>,
pub group_by: Vec<String>,
pub value_table_mode: Option<ValueTableMode>,
}Expand description
Logical query plan for SELECT operations.
The tables collection preserves the FROM clause order while Self::joins
captures how adjacent tables are connected via JoinMetadata. This keeps
join semantics alongside table references instead of parallel vectors and
mirrors what the executor expects when materialising join pipelines.
Fields§
§tables: Vec<TableRef>Tables to query. Empty vec means no FROM clause (e.g., SELECT 42). Single element for simple queries, multiple for joins/cross products.
joins: Vec<JoinMetadata>Join metadata describing how tables are joined.
If empty, all tables are implicitly cross-joined (Cartesian product).
Each entry describes a join between tables[i] and tables[i + 1].
projections: Vec<SelectProjection>§filter: Option<SelectFilter>Optional WHERE predicate plus dependent correlated subqueries.
having: Option<Expr<'static, String>>Optional HAVING predicate applied after grouping.
scalar_subqueries: Vec<ScalarSubquery>Scalar subqueries referenced by projections, keyed by SubqueryId.
aggregates: Vec<AggregateExpr>§order_by: Vec<OrderByPlan>§distinct: bool§compound: Option<CompoundSelectPlan>Optional compound (set-operation) plan.
group_by: Vec<String>Columns used in GROUP BY clauses (canonical names).
value_table_mode: Option<ValueTableMode>Optional value table output mode (BigQuery style).
Implementations§
Source§impl SelectPlan
impl SelectPlan
Sourcepub fn new(table: impl Into<String>) -> SelectPlan
pub fn new(table: impl Into<String>) -> SelectPlan
Create a SelectPlan for a single table.
Sourcepub fn with_tables(tables: Vec<TableRef>) -> SelectPlan
pub fn with_tables(tables: Vec<TableRef>) -> SelectPlan
Create a SelectPlan with multiple tables for cross product/joins.
The returned plan leaves Self::joins empty, which means any
evaluation engine should treat the tables as a Cartesian product until
Self::with_joins populates concrete join relationships.
pub fn with_projections(self, projections: Vec<SelectProjection>) -> SelectPlan
pub fn with_filter(self, filter: Option<SelectFilter>) -> SelectPlan
pub fn with_having(self, having: Option<Expr<'static, String>>) -> SelectPlan
Sourcepub fn with_scalar_subqueries(
self,
scalar_subqueries: Vec<ScalarSubquery>,
) -> SelectPlan
pub fn with_scalar_subqueries( self, scalar_subqueries: Vec<ScalarSubquery>, ) -> SelectPlan
Attach scalar subqueries discovered during SELECT translation.
pub fn with_aggregates(self, aggregates: Vec<AggregateExpr>) -> SelectPlan
pub fn with_order_by(self, order_by: Vec<OrderByPlan>) -> SelectPlan
pub fn with_distinct(self, distinct: bool) -> SelectPlan
Sourcepub fn with_joins(self, joins: Vec<JoinMetadata>) -> SelectPlan
pub fn with_joins(self, joins: Vec<JoinMetadata>) -> SelectPlan
Attach join metadata describing how tables are connected.
Each JoinMetadata entry pairs tables[i] with tables[i + 1]. The
builder should supply exactly tables.len().saturating_sub(1) entries
when explicit joins are required; otherwise consumers fall back to a
Cartesian product.
Sourcepub fn with_compound(self, compound: CompoundSelectPlan) -> SelectPlan
pub fn with_compound(self, compound: CompoundSelectPlan) -> SelectPlan
Attach a compound (set operation) plan.
pub fn with_group_by(self, group_by: Vec<String>) -> SelectPlan
pub fn with_value_table_mode(self, mode: Option<ValueTableMode>) -> SelectPlan
Trait Implementations§
Source§impl Clone for SelectPlan
impl Clone for SelectPlan
Source§fn clone(&self) -> SelectPlan
fn clone(&self) -> SelectPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SelectPlan
impl RefUnwindSafe for SelectPlan
impl Send for SelectPlan
impl Sync for SelectPlan
impl Unpin for SelectPlan
impl UnwindSafe for SelectPlan
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more