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
Expris BINDING-ROW scoped (a.x→Idiom[Field("a"),Field("x")]), with 3VL guards already inserted; MatchPredicate::depsis 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
impl MatchPlan
Sourcepub fn has_mutations(&self) -> bool
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
impl MatchPlan
Sourcepub fn binding(&self, id: BindingId) -> &BindingDef
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§
impl Eq for MatchPlan
impl StructuralPartialEq for MatchPlan
Source§impl ToSql for MatchPlan
Deterministic GQL-ish rendering of a MatchPlan.
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.
Auto Trait Implementations§
impl !Freeze for MatchPlan
impl RefUnwindSafe for MatchPlan
impl Send for MatchPlan
impl Sync for MatchPlan
impl Unpin for MatchPlan
impl UnsafeUnpin for MatchPlan
impl UnwindSafe for MatchPlan
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.