Node

Struct Node 

Source
pub struct Node {
    pub class: Class,
    pub brief: Option<Brief>,
    pub summary: Option<Comment>,
    pub node_type: NodeType,
    pub data_type: Option<Type>,
    pub data: Vec<NodeData>,
}
Expand description

Node for a semi-structured documentation-like tree representation of a parsed Substrait plan. The intention is for this to be serialized into some human-readable format.

Note: although it should be possible to reconstruct the entire plan from the information contained in the tree, the tree is only intended to be converted to structured human-readable documentation for the plan. It is expressly NOT intended to be read as a form of AST by a downstream process, and therefore isn’t nearly as strictly-typed as you would otherwise want it to be. Protobuf itself is already a reasonable format for this!

Fields§

§class: Class

The type of a node in terms of plan semantics.

§brief: Option<Brief>

An optional brief description of the node. This can be regarded as a comment placed at the start of the data vector, but it is usually only set at the end of the parse function.

§summary: Option<Comment>

An optional comment summarizing what this node does. This can be regarded as a comment placed at the start of the data vector (just after brief, if brief is also defined), but it is usually only set at the end of the parse function.

§node_type: NodeType

The type of node in terms of what it represents in the original data structure.

§data_type: Option<Type>

The type of data returned by this node, if any. Depending on the message and context, this may represent a table schema or scalar data.

§data: Vec<NodeData>

The information gathered about the message.

This normally includes all child nodes for this message, possibly interspersed with diagnostics, type information, and unstructured comment nodes to provide context, all ordered in a reasonable way. Note however that this information is intended to be understood by a human, not by the validator itself (aside from serialization to a human-readable notation).

Implementations§

Source§

impl Node

Source

pub fn iter_flattened_nodes(&self) -> FlattenedNodeIter<'_>

Returns an iterator that iterates over all nodes depth-first.

Source

pub fn iter_flattened_node_data(&self) -> FlattenedNodeDataIter<'_>

Returns an iterator that iterates over all NodeData objects in the order in which they were defined.

Source

pub fn iter_diagnostics(&self) -> impl Iterator<Item = &Diagnostic> + '_

Iterates over all diagnostics in the tree.

Source

pub fn get_diagnostic(&self) -> Option<&Diagnostic>

Returns the first diagnostic of the highest severity level in the tree.

Source

pub fn data_type(&self) -> Type

Returns a reference to the data type that this node returns at runtime or (for type nodes) represents. If no type information is attached, a reference to a default-generated unresolved type is returned.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

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 Node

Source§

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

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

impl From<&Node> for Node

Source§

fn from(node: &Node) -> Self

Converts to this type from the input type.
Source§

impl From<NodeType> for Node

Source§

fn from(node_type: NodeType) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Node

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl !RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl !UnwindSafe for Node

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> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
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, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,