Skip to main content

Plan

Enum Plan 

Source
pub enum Plan {
    Source(String),
    Join {
        left: Box<Plan>,
        right: Box<Plan>,
        join_key: String,
        kind: JoinKind,
        right_rename: BTreeMap<String, String>,
    },
    Filter {
        input: Box<Plan>,
        predicate: String,
    },
    Project {
        input: Box<Plan>,
        star: bool,
        items: Vec<Proj>,
    },
    Aggregate {
        input: Box<Plan>,
        time_column: String,
        window: Win,
        group_by: Vec<String>,
        pre: Vec<Proj>,
        aggs: Vec<AggSpec>,
        post: Vec<Proj>,
        having: Option<String>,
        trigger: Option<Trigger>,
    },
    TopN {
        input: Box<Plan>,
        group_by: Vec<String>,
        order_by: String,
        tie_by: Option<String>,
        descending: bool,
        n: usize,
    },
    Named {
        name: String,
        input: Box<Plan>,
    },
    Sink {
        input: Box<Plan>,
        name: String,
    },
}
Expand description

The typed logical plan. 5c-i covers the stateless shape (source → filter → project → sink); 5c-ii adds the windowed aggregate, the updating aggregate, and the joins.

Variants§

§

Source(String)

FROM <dataset> — a source dataset by name.

§

Join

FROM <left> JOIN <right> ON <key> [interval] — a two-input join.

Fields

§left: Box<Plan>
§right: Box<Plan>
§join_key: String
§kind: JoinKind
§right_rename: BTreeMap<String, String>

Right columns the query names with the right’s qualifier → their output name (the join’s rightRename), so a.ts can never mean the left’s ts.

§

Filter

WHERE <predicate> — the predicate as a value-dialect string.

Fields

§input: Box<Plan>
§predicate: String
§

Project

SELECT …. star = SELECT * (pass-through, no step); else the projected columns.

Fields

§input: Box<Plan>
§star: bool
§items: Vec<Proj>
§

Aggregate

SELECT … FROM … GROUP BY <window-fn>(ts,…), <keys> — a windowed keyed aggregate. A Some(trigger) makes it the 5a updating aggregate (early firing).

Fields

§input: Box<Plan>
§time_column: String
§window: Win
§group_by: Vec<String>
§pre: Vec<Proj>

Pre-aggregate computed columns (an aggregate’s expression argument, e.g. a CASE fed to count(DISTINCT …)) — lowered to applyExpression steps BEFORE the aggregate.

§aggs: Vec<AggSpec>
§post: Vec<Proj>

Post-aggregate computed columns — a SELECT expression over the window/group/aggregates (e.g. day = substring(epochToIso(windowStart), 1, 10)), lowered to applyExpression steps AFTER the aggregate (the q15/q16 day/minute columns).

§having: Option<String>

HAVING <predicate> — a filter over the aggregate’s output rows (the window, the group columns, the aggregate aliases), lowered to a filter step AFTER the aggregate and its post columns.

§trigger: Option<Trigger>
§

TopN

SELECT … FROM (SELECT …, ROW_NUMBER() OVER (PARTITION BY g ORDER BY c [DESC]) AS rn FROM s) WHERE rn <= n — the streaming top-N idiom → the topN operator.

Fields

§input: Box<Plan>
§group_by: Vec<String>
§order_by: String
§tie_by: Option<String>

A second ORDER BY column → the tie-break (tieBy, ascending).

§descending: bool
§

Named

A CTE (WITH <name> AS (<subquery>)): the sub-plan input materialises as its own stage under name, and downstream references to name read that stage. The multi-stage boundary — the SQL equivalent of a named intermediate dataset in the TOML [[transforms]] DAG.

Fields

§name: String
§input: Box<Plan>
§

Sink

INSERT INTO <dataset> — the terminal sink dataset by name.

Fields

§input: Box<Plan>
§name: String

Trait Implementations§

Source§

impl Clone for Plan

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Plan

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Plan

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Plan

Auto Trait Implementations§

§

impl Freeze for Plan

§

impl RefUnwindSafe for Plan

§

impl Send for Plan

§

impl Sync for Plan

§

impl Unpin for Plan

§

impl UnsafeUnpin for Plan

§

impl UnwindSafe for Plan

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.