pub struct Node {
    pub class: Class,
    pub brief: Option<Brief>,
    pub summary: Option<Comment>,
    pub node_type: NodeType,
    pub data_type: Option<Arc<DataType>>,
    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<Arc<DataType>>

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

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

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

Iterates over all diagnostics in the tree.

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.