Skip to main content

ReadOp

Enum ReadOp 

Source
#[non_exhaustive]
pub enum ReadOp {
Show 13 variants Source { label: Option<LabelSet>, bind: VarId, }, Expand { input: OpId, from: VarId, rel: RelSpec, to: NodeSpec, bind_rel: VarId, bind_to: VarId, }, Filter { input: OpId, predicate: Expr, }, Project { input: OpId, items: Vec<Projection>, }, Aggregate { input: OpId, keys: Vec<Expr>, aggs: Vec<AggExpr>, }, OrderBy { input: OpId, keys: Vec<OrderKey>, }, Skip { input: OpId, count: Expr, }, Limit { input: OpId, count: Expr, }, Distinct { input: OpId, }, Unwind { input: OpId, list: Expr, bind: VarId, }, Union { left: OpId, right: OpId, kind: UnionKind, }, With { input: OpId, items: Vec<Projection>, filter: Option<Expr>, }, OptionalJoin { input: OpId, pattern: Box<ReadOp>, },
}
Expand description

Logical read-plan operator tree. Spec §12.1.

Operators form a DAG — each variant that has an input field references its source by OpId. The OptionalJoin variant embeds a sub-tree directly via Box<ReadOp> because its inner pattern is always a fresh tree introduced by OPTIONAL MATCH.

Consumers iterate the tree in whatever order suits their executor. This crate imposes no evaluation semantics.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Source

Scan all nodes, optionally filtered to those carrying a set of labels.

When label is None this is an all-node scan; when Some it is a label-index scan (or filtered full scan, depending on the consumer’s storage). Spec §12.1 N1.

Fields

§label: Option<LabelSet>

Labels to filter on, or None for every node.

§bind: VarId

Variable that receives each scanned node.

§

Expand

Expand a node into its adjacent relationships and neighbour nodes.

Starting from from (already bound in input), traverse relationships matching rel to reach a node matching to. Spec §12.1 N2.

Fields

§input: OpId

Source operator that provides the from variable.

§from: VarId

Variable holding the start node.

§rel: RelSpec

Relationship type / direction / length specification.

§to: NodeSpec

Target node specification (labels + optional property predicate).

§bind_rel: VarId

Variable that receives the traversed relationship.

§bind_to: VarId

Variable that receives the reached node.

§

Filter

Predicate filter — keeps only rows where predicate is truthy.

Implements WHERE and inline pattern predicates. Spec §12.1 N3.

Fields

§input: OpId

Source operator.

§predicate: Expr

Boolean expression; rows where it evaluates to false or null are dropped.

§

Project

Column projection — renames / computes output columns.

Implements the output column list of RETURN and WITH. Spec §12.1 N4.

Fields

§input: OpId

Source operator.

§items: Vec<Projection>

Ordered list of output columns.

§

Aggregate

Aggregation — groups rows and applies aggregate functions.

keys are the grouping expressions; aggs are the aggregate calls. An empty keys vec aggregates the entire input into a single row. Spec §12.1 N5.

Fields

§input: OpId

Source operator.

§keys: Vec<Expr>

Grouping expressions (the non-aggregate columns in the output).

§aggs: Vec<AggExpr>

Aggregate function calls.

§

OrderBy

Sort — orders rows by a list of sort keys. Spec §12.1 N6.

Fields

§input: OpId

Source operator.

§keys: Vec<OrderKey>

Ordered list of sort keys (primary first).

§

Skip

Skip — discards the first count rows. Spec §12.1 N7.

Fields

§input: OpId

Source operator.

§count: Expr

Number of rows to skip; must evaluate to a non-negative integer.

§

Limit

Limit — keeps only the first count rows. Spec §12.1 N8.

Fields

§input: OpId

Source operator.

§count: Expr

Maximum number of rows to pass through.

§

Distinct

Distinct — removes duplicate rows. Spec §12.1 N9.

Row equality is Cypher value equality (null != null).

Fields

§input: OpId

Source operator.

§

Unwind

Unwind — flattens a list expression into one row per element.

Implements UNWIND list AS var. Spec §12.1 N10.

Fields

§input: OpId

Source operator.

§list: Expr

List expression to iterate.

§bind: VarId

Variable that receives each list element.

§

Union

Union — concatenates rows from two sub-plans. Spec §12.1 N11.

Fields

§left: OpId

Left source operator.

§right: OpId

Right source operator.

§kind: UnionKind

Whether to deduplicate the combined output.

§

With

With — projects columns and optionally filters, resetting scope.

Implements the WITH clause. Differs from ReadOp::Project in that WITH starts a new variable scope. Spec §12.1 N12.

Fields

§input: OpId

Source operator.

§items: Vec<Projection>

Output columns.

§filter: Option<Expr>

Optional WHERE predicate applied after projection.

§

OptionalJoin

Optional join — left-outer-join a sub-plan. Spec §12.1 N13.

Implements OPTIONAL MATCH. Rows from input that have no match in pattern are kept with null-bound variables.

Fields

§input: OpId

Outer source operator.

§pattern: Box<ReadOp>

Inner pattern (embedded tree, not an OpId, because it is always a fresh sub-tree introduced by OPTIONAL MATCH).

Trait Implementations§

Source§

impl Clone for ReadOp

Source§

fn clone(&self) -> ReadOp

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 ReadOp

Source§

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

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

impl<'de> Deserialize<'de> for ReadOp

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ReadOp

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Serialize for ReadOp

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ReadOp

Source§

impl StructuralPartialEq for ReadOp

Auto Trait Implementations§

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,