Struct partiql_logical::LogicalPlan
source · 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,
impl<T> LogicalPlan<T>where T: Default,
sourcepub fn add_operator(&mut self, op: T) -> OpId
pub fn add_operator(&mut self, op: T) -> OpId
Adds a new operator to the plan.
sourcepub fn add_flow_with_branch_num(&mut self, src: OpId, dst: OpId, branch_num: u8)
pub fn add_flow_with_branch_num(&mut self, src: OpId, dst: OpId, branch_num: u8)
Adds a data flow with a branch number.
sourcepub fn extend_with_flows(&mut self, flows: &[(OpId, OpId)])
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());
sourcepub fn operator_count(&self) -> usize
pub fn operator_count(&self) -> usize
Returns the number of operators in the plan.
sourcepub fn operators_by_id(&self) -> impl Iterator<Item = (OpId, &T)>
pub fn operators_by_id(&self) -> impl Iterator<Item = (OpId, &T)>
Returns the operators of the plan with their OpId
.
pub fn operator(&self, id: OpId) -> Option<&T>
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,
impl<T> Clone for LogicalPlan<T>where T: Default + Clone,
source§fn clone(&self) -> LogicalPlan<T>
fn clone(&self) -> LogicalPlan<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Default for LogicalPlan<T>where
T: Default + Default,
impl<T> Default for LogicalPlan<T>where T: Default + Default,
source§fn default() -> LogicalPlan<T>
fn default() -> LogicalPlan<T>
Returns the “default value” for a type. Read more
source§impl<T> PartialEq<LogicalPlan<T>> for LogicalPlan<T>where
T: Default + PartialEq,
impl<T> PartialEq<LogicalPlan<T>> for LogicalPlan<T>where T: Default + PartialEq,
source§fn eq(&self, other: &LogicalPlan<T>) -> bool
fn eq(&self, other: &LogicalPlan<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<T> Eq for LogicalPlan<T>where T: Default + Eq,
impl<T> StructuralEq for LogicalPlan<T>where T: Default,
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> 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
Mutably borrows from an owned value. Read more