Skip to main content

MatchPlan

Struct MatchPlan 

Source
pub struct MatchPlan {
    pub bindings: Vec<BindingDef>,
    pub stages: Vec<MatchStage>,
    pub output: Option<MatchOutput>,
}
Expand description

The declarative plan for a single GQL MATCH query.

Invariants the lowering guarantees (the planner relies on these and never re-derives them):

  • every Expr is BINDING-ROW scoped (a.x → Idiom[Field("a"),Field("x")]), with 3VL guards already inserted;
  • MatchPredicate::deps is the exact set of bindings the expr reads;
  • conjuncts are NNF-split and live on the clause whose pattern scope owns them (critical for OPTIONAL);
  • column names are final (naming rules applied; duplicates rejected);
  • ORDER BY aliases are resolved (non-DISTINCT → source exprs; DISTINCT → columns);
  • repeated pattern variables are rewritten to hidden bindings + equality conjuncts; anonymous edges needing DIFFERENT-EDGES tracking have hidden bindings;
  • every pattern is anchorable (rule in V2_DESIGN §0).

Fields§

§bindings: Vec<BindingDef>

All bindings; index equals the BindingId.

§stages: Vec<MatchStage>

The query’s steps in textual order: read clauses and write stages, interleaved as written. May be empty only for a bare RETURN (rejected in lowering).

§output: Option<MatchOutput>

The RETURN projection, or None for a mutation-only query (no trailing RETURN).

Implementations§

Source§

impl MatchPlan

Source

pub fn has_mutations(&self) -> bool

Whether this plan carries any write stage. Drives the transaction type (a mutation-bearing plan is not read-only, so the executor opens a write transaction) — see Expr::read_only.

Source§

impl MatchPlan

Source

pub fn binding(&self, id: BindingId) -> &BindingDef

Look up a binding by id.

§Panics

Panics if id is not a valid index into MatchPlan::bindings. Callers (the streaming planner) only ever pass ids that the lowering placed into this same plan’s bindings/patterns, so the index is always in range; an out-of-range id is an internal-consistency bug, not a user-reachable path. For the never-panicking rendering path use MatchPlan::binding_name.

Trait Implementations§

Source§

impl Clone for MatchPlan

Source§

fn clone(&self) -> Self

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 MatchPlan

Source§

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

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

impl Eq for MatchPlan

Source§

impl Hash for MatchPlan

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MatchPlan

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MatchPlan

Source§

impl ToSql for MatchPlan

Deterministic GQL-ish rendering of a MatchPlan.

Used by EXPLAIN, Debug-adjacent tooling, and logs: it must be stable and must never panic on any plan, well-formed or not. Predicate, column, order, and skip/limit slots delegate to Expr’s ToSql so 3VL guard shapes stay textually diffable. The rendering is single-line regardless of fmt.

Source§

fn fmt_sql(&self, f: &mut String, _fmt: SqlFormat)

Format the type to a SQL string.
Source§

fn to_sql(&self) -> String

Convert the type to a SQL string.
Source§

fn to_sql_pretty(&self) -> String

Convert the type to a pretty-printed SQL string with indentation.

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SetEntry<T> for T
where T: Hash + Eq,

Source§

fn into_owned(self) -> T

Source§

fn equal(&self, other: &T) -> bool

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool