pub struct LogicalPlan<T>where
    T: Default,{ /* private fields */ }
Expand description

Represents a PartiQL logical plan.

Implementations§

source§

impl<T> LogicalPlan<T>where T: Default,

source

pub fn new() -> Self

Creates a new default logical plan.

source

pub fn add_operator(&mut self, op: T) -> OpId

Adds a new operator to the plan.

source

pub fn add_flow(&mut self, src: OpId, dst: OpId)

Adds a data flow to the plan.

source

pub fn add_flow_with_branch_num(&mut self, src: OpId, dst: OpId, branch_num: u8)

Adds a data flow with a branch number.

source

pub fn extend_with_flows(&mut self, flows: &[(OpId, OpId)])

Extends the logical plan with the given data flows. #Examples:

use partiql_logical::{BindingsOp, GroupBy, GroupingStrategy, LimitOffset, LogicalPlan, OrderBy};
let mut p: LogicalPlan<BindingsOp> = LogicalPlan::new();

let a = p.add_operator(BindingsOp::OrderBy(OrderBy{specs: vec![]}));
let b = p.add_operator(BindingsOp::Sink);
let c = p.add_operator(BindingsOp::LimitOffset(LimitOffset{limit:None, offset:None}));
let d = p.add_operator(BindingsOp::GroupBy(GroupBy {
    strategy: GroupingStrategy::GroupFull,
    exprs: Default::default(),
    aggregate_exprs: vec![],
    group_as_alias: None,
}));

p.add_flow(a, b);

p.extend_with_flows(&[(a,c), (c, d)]);
assert_eq!(3, p.flows().len());
source

pub fn operator_count(&self) -> usize

Returns the number of operators in the plan.

source

pub fn operators(&self) -> &Vec<T>

Returns the operators of the plan.

source

pub fn operators_by_id(&self) -> impl Iterator<Item = (OpId, &T)>

Returns the operators of the plan with their OpId.

source

pub fn flows(&self) -> &Vec<(OpId, OpId, u8)>

Returns the data flows of the plan.

source

pub fn operator(&self, id: OpId) -> Option<&T>

source

pub fn operator_as_mut(&mut self, id: OpId) -> Option<&mut T>

Trait Implementations§

source§

impl<T> Clone for LogicalPlan<T>where T: Default + Clone,

source§

fn clone(&self) -> LogicalPlan<T>

Returns a copy 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<T> Debug for LogicalPlan<T>where T: Default + Debug,

source§

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

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

impl<T> Default for LogicalPlan<T>where T: Default + Default,

source§

fn default() -> LogicalPlan<T>

Returns the “default value” for a type. Read more
source§

impl<T> Display for LogicalPlan<T>where T: Default + Debug,

source§

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

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

impl<T> PartialEq<LogicalPlan<T>> for LogicalPlan<T>where T: Default + PartialEq,

source§

fn eq(&self, other: &LogicalPlan<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Eq for LogicalPlan<T>where T: Default + Eq,

source§

impl<T> StructuralEq for LogicalPlan<T>where T: Default,

source§

impl<T> StructuralPartialEq for LogicalPlan<T>where T: Default,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for LogicalPlan<T>where T: RefUnwindSafe,

§

impl<T> Send for LogicalPlan<T>where T: Send,

§

impl<T> Sync for LogicalPlan<T>where T: Sync,

§

impl<T> Unpin for LogicalPlan<T>where T: Unpin,

§

impl<T> UnwindSafe for LogicalPlan<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.