Skip to main content

Crate relate_executor

Crate relate_executor 

Source

Re-exports§

pub use graph::AppliedTokenChanges;
pub use graph::Graph;
pub use graph::Procedure;
pub use graph::QueryStats;
pub use graph::SnapshotPin;

Structs§

AppliedTokenChanges
The interned tokens the writes applied since the last drain changed — label ids, relationship-type ids and property-key ids, one dense append-only id space (crate::store::interner) — plus whether a schema op landed among them.
BatchFacts
The batch chain’s PROFILE facts for one clause, carried as one value so the record never holds a loose flag beside its counter.
BulkCursor
Cursor into the target space: the next entity index (DELETE) or combination index (row-driven writes) to process.
BulkTargets
The snapshotted target identity space of a BulkWrite (phase 1). Opaque: the only public fact is BulkTargets::total_work.
BulkWrite
A plan-time eligible global bulk write (ADR-0209 §1).
ClauseMetricsRecord
One clause operator’s PROFILE metrics, reported to the sink (ADR-0344 phase 2 + the metric-fields phase): the position key (stage, part, clause) — the same walk the plan tree construction uses — beside the operator’s actuals. Bundled so the sink signature stays at one argument however many metrics a later phase adds.
CommittedIndexFact
One committed index as the facade’s open tail hands it to the DDL home (ADR-0649 §6): the catalog row’s identity, its typed detail, and its evaluated options — borrowed from the codec’s carrier, so no second owned spelling of the carrier exists.
CsvPolicy
Validated, immutable source capability for LOAD CSV: the local-file root (ADR-0081) and, independently, the host’s remote fetcher (ADR-0723).
DeprecatedBy
A catalog entry’s replacement (CIP-157’s deprecatedBy): the display text SHOW FUNCTIONS/SHOW PROCEDURES render and the replacement’s syntactic form. The form keeps a function/procedure identifier apart from a Cypher clause, so a notification remedy can name each one for what it is instead of guessing from the string.
ExecGraph
Read view of committed graph plus optional overlay (ADR-0016).
ExecRequest
The plan, parameters, source text, and authenticated principal shared by every execution entry point. query_text is the source text of the statement (exposed as SHOW TRANSACTIONS’ currentQuery column); the statement’s CIP-150 version preamble rides on the plan. principal is the connection’s authenticated principal (ADR-0273), read by dbms.showCurrentUser; None reports the documented placeholder. Copy: every field is a reference (or an optional reference) — the commit path reuses the caller’s request with its own batch-commit sink attached, without rebuilding the bundle field by field.
ExpandIntoCounters
The ExpandInto walk counters of one clause (probes and reversed probes).
FrontierCounters
The frontier family’s run counters (ADR-0478), one clause’s sum over its per-seed BFS runs: the edge visits (the work the walk budget caps), the completed levels, the accepted endpoints, and the NFA rung’s own PROFILE facts — the (node, state) cells the runs created, the re-arrival work spent, the rule memo’s hits and misses, and the admission asks by verdict. Zero on every clause the frontier declined — levels > 0 is the engagement marker (a run always completes its level 0).
GatedCapability
One preview-gated capability row of dbms.listCapabilities (ADR-0741): the feature whose opt-in lists it, and the row’s three columns. A gated row is a content row, not a call gate — the procedure stays callable with the opt-in off and its always-on rows are unchanged; the gated row is simply absent.
GradeProbe
One execution’s plan-grade probe (ADR-0687 decision 6): the store-read counters armed and snapshotted at Self::begin, the reading taken at Self::finish. Dropping an unfinished probe restores the counters’ arm flag and nothing else — an execution that never finished grades nothing, and the counters it left armed never extend past the run.
Graph
GraphStats
Construction goes through GraphStats::new (the ADR-0218 one- construction idiom the sibling plan-time stats impls use), so an inline build cannot drift from it.
GraphTypeSpec
The typed, serde-serializable form of a parsed GraphTypeBody (CIP-176/178/180). Graph-type redo ops (RedoOp::PutGraphType / RedoOp::SetCurrentGraphType) carry this model and TheaterData stores it: parsing happens once at DDL-execution time (GraphTypeSpec::from_body), and redo replay converts back with GraphTypeSpec::to_body – an infallible, mechanical conversion, never a re-parse of Cypher text.
HashJoinCounters
The HashJoin walk counters of one clause.
InMemoryQueryEngine
Execution plus the in-memory graph and index layout.
InTxBatches
The CALL { … } IN TRANSACTIONS batch facts one CallSubquery operator reports to PROFILE (REL8-2047): the batch counters — how many batches ran, how many committed, how many rolled back under the ON ERROR policy — and the per-batch maxima: the input batch’s retained row bytes, the installed output’s, the scratch the batch created (entities, adjacency and property state — the redo log excluded, its bytes are the WAL figure), and the redo log’s reserved bytes at commit, the WAL payload the batch wrote. The counters are arm-local (not global counter snapshots): the batch loop notes each finished batch into the shared cell the clause’s record reads once its consumer drains the stream. All-zero on every other clause, and on an unprofiled run.
IndexDetailSpec
Typed payload of RedoOp::CatalogIndexDetail: the catalog facts of a CREATE INDEX, captured once at DDL-execution time from the parsed clause. apply_redo stores it verbatim – it never formats a CREATE INDEX string and re-parses it.
IndexFacts
One index’s typed facts as every reader resolves them, through the fixed precedence the SHOW INDEXES row and the 00NA0 note share: the index’s IndexDetailSpec, then the owning constraint (a constraint-backed index), then the legacy IndexDef encoding. No reader re-spells the chain, so a new detail field lands in every rendering at once.
MemoCounters
The expression-memo counters of one operator or statement (ADR-0654, ADR-0640): the per-memo facts summed over the memos the unit ran, read once when each memo finishes — a memo’s increments are the ones already on its path, so collecting them adds none. Zero on every unit that probed no memo.
PhaseTimes
The clause’s inclusive phase times (LABS-448): the elapsed time spent resolving node candidates (the seek — the store work behind the Nodes kind) and following relationships (the walk — the store work behind the Rels/Degree kinds); the per-candidate admission checks and the arm’s binding/cloning stay unattributed. Inclusive of the nesting a compound operator performs: a walk that triggers nested seeks counts both, like the table’s Total column. Merged across one streamed stage’s PROFILE windows (profile_chain.rs), the store-read mix’s shape.
ProcSignature
Static signature and catalog metadata of a built-in procedure.
Procedure
QueryResult
QueryStats
A statement’s mutation counters. Two families count different things:
ReadAdmission
A read admitted at a caller-pinned timestamp: the graph, the pinned snapshot_ts, and the schema captured together with that pin under the publication read guard, plus the request to run and its optional cooperative cancellation token (ADR-0111; None is never cancelled).
SchemaSnapshot
Catalog facts captured alongside an entity pin at read admission. The caller serializes capture with commit publication; execution needs no publication lock and never consults newer named schema.
ScratchCheckpoint
Rollback image of a WriteScratch: its two state halves — the per-batch state (via the one embedded capture) and the statement-spanning state ([StatementState]: counters and applied count as of the capture) — plus the redo log’s positional cursor. Cloning the maps is shallow once node and relationship payloads are Arcs; the redo ops stay with the live log, and the id allocators are not captured (they never roll back).
SnapshotPin
Registered snapshot_ts until drop (ADR-0023 / ADR-0038).
StatementMark
The pipelined write batch’s pre-statement rollback image (WriteScratch::mark_statement): the redo cursor and the statement-spanning state as of the statement’s entry. Opaque to the facade, which marks once per batched statement and rolls back when it fails.
StatementMemoRecord
The statement-level memo facts (ADR-0654 §3): the constructor memos live in the query overlay and serve any expression, so they report once for the whole statement, attached at the plan root — the counters summed over them and the memo types that were probed.
StoreReads
The store-read mix a clause’s arm performed (LABS-369): the kinds the single Db Hits total blends. A Rows=103 operator that spent 300k relationship hops and 0 node reads is a different animal from one that read 103 nodes — the one-glance diagnosis for the scan-turned-traversal family. Merged across one streamed stage’s PROFILE windows (profile_chain.rs): the stage’s record is the checked sum over its batches, minus the immediate downstream stage’s sum.
StreamSink
The engine-side handle a statement carries for its consumer: wraps the caller’s RowConsumer with whether it has been engaged (columns were announced), so the boundary can tell a statement whose rows streamed from one whose result still sits in its QueryResult — the materialized forms (writes, EXPLAIN, catalog commands, UNION folds, breakers) replay their rows through the same sink after the run.
VectorScanCounters
The vector-similarity scans one clause ran, by the path that served each (ADR-0705): the packed matrix, or the Value sweep it declined to. A clause that searched once reports one nonzero count; a clause that searched per input row can report both.
WalkStart
How a MATCH walk chose its start element (LABS-369): the fact the opaque Expand hid. A displaced start — a cheap index seek that became a 135k-relationship backward traversal — is named here instead of showing up only as a large Db Hits total.
WriteScratch
Per-attempt write buffer. The shared Graph is not mutated until apply_redo.

Enums§

BatchFlow
What the consumer wants after a batch: the next one, or the end of the walk. Stop is RowStream::stop for the statement: the terminal stops its input stream and the statement fails with Error::Cancelled ("query cancelled"), exactly as a cancelled token ends it.
ContainsCount
Provenance of a plan-time CONTAINS candidate count (LABS-643): the TEXT index stays the one exact measurement, and without one the count comes from a bounded sample scan of the label’s nodes — exact when the label fits inside the sampler’s bound, an extrapolation beyond it. The variant, never a bare number, says which: no consumer can mistake the extrapolation for the measurement, and the sampled form carries the whole-label scan rows the unseekable filter still pays — the floor the compound start estimate (ADR-0474) maxes with the sampled output.
DeprecationForm
The replacement’s syntactic form (the notification remedy’s rendering).
FrontierDecline
Every plan-time gate’s decline, typed so a test or plan dump names the gate that kept the DFS. The decline is always safe: the per-row DFS answers identically. Every gate decides before a single walk — the rung’s run-time declines are their own type (FrontierRunDecline: the re-arrival budget and the table ceiling). The PROFILE record carries either one as a FrontierDeclineReason.
FrontierDeclineReason
Why a clause’s frontier rung did not serve it, as the PROFILE record carries it (ADR-0516, extended): either a plan-time gate kept the clause off the rung before a single walk (FrontierDecline), or the rung engaged, ran, and fell through (FrontierRunDecline, its counters recorded beside). One typed sum, so the record’s one field names the first reason whichever half decided; the wire spells the same names (plan_keys::DECLINE_REASONS).
FrontierRunDecline
The frontier rung’s run-time declines (ADR-0516): the reasons a rung that engaged and ran still falls through, typed so the PROFILE record names the one that kept the DFS. The plan-time gates’ own vocabulary (FrontierDecline) is the other half of the record’s FrontierDeclineReason — every one of those decides before a single walk. The rider wiring records it and the metric record carries it. The variants below are the vocabulary’s single source (the macro derives ALL and as_str from them); a later run-time decline adds its variant and its wire name there.
IndexKindSpec
The DDL index kind carried by IndexDetailSpec: a serde-serializable mirror of relate_parser::IndexKind.
KernelRung
Which rung served one MATCH clause (LABS-1117): the fact EXPLAIN could not show, because the rungs are runtime choices inside an operator, not plan nodes. The ladder records it per clause; the PROFILE record carries it. Walker is the per-row walker, the rung every decline’s home — the batch scan/filter chain is its own fact (BatchFacts::ran), never a rung here.
OntologyOp
Typed view of a store-level ontology document op (ADR-0120 §3), the classification RedoOp::ontology_op returns: Set borrows the verbatim document, Drop carries nothing. Consumers match this once instead of re-matching the redo variants.
PatternEngine
Which pattern engine serves a clause (ADR-0519): a diagnostic-only switch for the pattern-engine spike — never Cypher syntax, no query-level spelling, and no stability promise. It dies with the old engines it switches between.
PullKind
Node vs relationship for RedoOp::PullIdentityPut.
RedoOp
RemoteFailure
Why a host’s fetch failed — a closed vocabulary, so the engine words every failure itself and no URL, host name, OS error or transport text can reach a client (the no-leak rule of ADR-0081).
StartReason
The start-selection reason classes (ADR-0350’s bound pivot, ADR-0351’s cheapest-start estimate, the LABS-161 relationship seek, the default).
StatementEffect
What one statement’s execution did to the store: one of exactly three states, never a pair of flags whose fourth combination has to be explained away.

Constants§

BATCH_ROWS
Rows per result batch (ADR-0555’s batch bound): the terminal’s consumer deliveries and the materialized path’s replay chunking share the one bound the inter-clause stream already batches by.
DEFAULT_BATCH_BUDGET
Default per-batch work budget (estimated touched entities).
DEFAULT_BATCH_THRESHOLD
Default work estimate at or above which an eligible statement is batched instead of running as one transaction.
GATED_CAPABILITIES
The one table of preview-gated capability rows (ADR-0741): the row producer renders exactly these rows, each only under its feature’s opt-in. Today one row — the supported ontology spec version, the pin db.ontology.set validates against, so the listing cannot drift from the gate.
MAX_ONTOLOGY_SPEC_BYTES
The ADR-0086 object envelope bounding one ontology document (ADR-0120 §3): 16 MiB, checked before the commit is written.

Statics§

BUILTIN_PROCEDURE_SIGNATURES
The canonical built-in procedure table, in name order — the order SHOW PROCEDURES lists the listed rows in (ADR-0497 §6).

Traits§

BatchCommit
Per-batch commit sink for CALL { … } IN TRANSACTIONS (ADR-0210). Called by the executor after each successful batch with the batch’s drained redo ops and the snapshot timestamp they were built against; the implementation commits them durably (WAL + apply) before the next batch starts, so live scratch state stays bounded by one batch. Returns the commit timestamp the batch was applied at — the caller rebases its scratch onto it, so only the sink (which owns the commit) ever reads the base graph’s clock.
CsvRemote
The host-supplied fetcher behind a remote LOAD CSV source (ADR-0723).
PlanMetricsSink
Per-clause PROFILE metrics sink (ADR-0344 phase 2): the dispatch loop reports each statement-level clause operator’s metrics once it finishes, keyed (stage, part, clause) — the same walk the plan tree construction uses, so the collected entries stamp onto the PROFILE result’s plan tree without a second mapping.
RowConsumer
The caller-supplied sink for a streaming statement’s result (ADR-0682). The engine calls RowConsumer::columns exactly once, before the first batch (a RETURN * learns its columns only at its first batch, so the columns may arrive together with it), then RowConsumer::batch once per bounded batch of result rows, in row order. The consumer runs on the statement’s own thread — the connection’s query worker, or the caller’s thread where the statement itself runs inline — never concurrently with the pull that produced the batch.

Functions§

analyze_bulk_write
batch_pass_admission
Whether an IN TRANSACTIONS body takes the batch pass (ADR-0669): one clause-engine pass per batch instead of one nested invocation per row. Plan-time over the body’s IR, so the plan node renders the execution strategy in its details. Whether an IN TRANSACTIONS body takes the batch pass (ADR-0669): a single flat part, no NEXT stage, non-projecting, with no WITH and no schema/admin DDL among its own clauses. Everything else about the body runs in the pass exactly as its clause list would in a plain statement over the batch’s seed rows — MATCH, procedure CALL, nested CALL { … }, conditionals, graph-reading expressions included: pipeline order, one clause-engine invocation and one nested-budget tick per batch, the per-row statement-engine loop never entered. The batch commits per batch either way (ADR-0210); what the pass removes is the per-row invocation, which is pure overhead — the caller already named the batch.
builtin_function_deprecation
The replacement when name resolves to a deprecated built-in function, None otherwise. One typed lookup over the same table SHOW FUNCTIONS renders, so no caller keeps a second list of deprecated names. A name’s arity rows share one deprecated_by (the lockstep test below), so the first row that carries a replacement speaks for every sibling.
builtin_procedure_deprecation
The replacement when name resolves to a deprecated built-in procedure, None otherwise; the procedure-side twin of crate::function_registry::builtin_function_deprecation and the one lookup the query-notification detector reads. The registry’s deprecated_by field is the whole deprecation fact — None means not deprecated — so the lookup is a field read, never a bridge between two flags.
builtin_procedure_signature
Looks up a built-in procedure signature by name, case-sensitively. Casing sensitivity: built-in function names are case-insensitive, but built-in procedure names are case-sensitive – CALL DB.LABELS() is an UnknownProcedure error, only the exact declared casing (CALL db.labels()) resolves. The validator must agree.
call_is_write
Whether CALL name could write — the namespace gate’s question: a store-registered procedure or a built-in flagged writes in the canonical signature registry (ADR-0116 §4). The gate must never admit a callable to a read view, so registration alone counts.
catalog_create_statements
The store’s whole-catalog DDL statements (ADR-0481 §3): one CREATE INDEX / CREATE CONSTRAINT statement per named catalog entry, in the order the checkpoint manifest persists the catalog (Graph::named_indexes then Graph::named_constraints — the name-keyed catalog’s order; the catalog keeps no creation sequence). Every statement is the SHOW INDEXES / SHOW CONSTRAINTS createStatement rendering — the dialect’s full form, since a schema mirror must recreate, not hide. An entry whose renderer returns None — exactly the rows where the SHOW column is NULL (a legacy detail-less index row, a graph-type-managed dependent constraint, a kind with no standalone CREATE form) — is absent: its schema is already carried by the graph type’s canonical text or the manifest, never a fabricated statement.
check_explicit_arity
The registry-driven explicit-arity check — one half of the runtime CALL contract ([CallSpec::check_contract]), which every dispatch path (the generic registry path, the ontology divert, the vector and fulltext scans) reads: an explicit call passes between required and total arguments. (The facade’s compile-time validate_calls already enforces the same contract.)
check_implicit_passing_mode
The passing-mode backstop — the other half of the runtime CALL contract ([CallSpec::check_contract]): an in-query implicit call — a CALL with a YIELD, in a clause pipeline — cannot pass arguments; the procedure’s arguments resolve only in a standalone unit call. required_args is the caller’s registry truth: the number of declared parameters without a default (LABS-389: a procedure whose parameters all carry defaults is callable implicitly). (The facade’s compile-time validate_calls enforces the same contract before execution; this is the executor-side backstop.)
committed_catalog_ops
The committed schema’s catalog redo group (ADR-0649 §6) — the DDL home’s own construction, so the catalog policy (the op order, the detail shape, the option resolution, the held-row retirement) has one compiler-linked home with CREATE INDEX: a new index kind, WITH-property rule, or op order added to DDL reaches the store’s open path through this function, never through a parallel assembly. Each committed index first retires every catalog row held under its name or its indexed pair (the committed file is the source and wins, ADR-0649 decision 2 — a file edit that retargets or renames an index overrides the machine’s stale row the way any later commit would, instead of failing the open on the catalog’s duplicate rules), then records the row and its typed detail in the DDL path’s own order; the group ends at the current graph type.
ddl_notifications
The schema-DDL notifications one IR clause raises at EXPLAIN time: the catalog passthrough’s parsed clause and the IR’s own compact legacy CreateIndex/DropIndex shapes all dispatch here, so the statement walker never re-assembles a clause shape across the crate boundary. A non-DDL clause raises none.
execute
Execute a write-capable plan, then validate the constraints against what it wrote (ADR-0172). Each call starts a fresh CSV memo even when graph is reused across statements.
execute_read_at
Execute a read-only plan at the caller-pinned timestamp in admission without repinning. The caller must keep its Graph::pin_now() guard alive through this call so version GC cannot discard rows visible at snapshot_ts, and must capture schema alongside that pin while serializing with graph publication.
execute_read_streaming_at
execute_read_at with the statement’s batch consumer attached (ADR-0682): a streaming statement’s terminal RETURN hands each bounded batch to the sink as it is produced (see [streamable_part]); every other read shape runs materialized as ever and its result replays through the same sink — columns once, then bounded batches — before the call returns. Either way the returned QueryResult carries the statement’s columns, stats and effect but no rows: the consumer has them. A consumer answering BatchFlow::Stop ends the walk and cancels the statement (Error::Cancelled).
is_ontology_procedure
Whether name names one of the db.ontology.* procedures (ADR-0121 as amended by ADR-0227). Derived from the one table so the facade’s compile-time gates (no-mixed-writes, transaction-mixing, target namespace) and the executor’s CALL dispatch cannot drift apart.
is_ontology_store_op
Whether name names a store-level ontology op (db.ontology.set / db.ontology.drop, ADR-0120 §3) as opposed to the in-overlay apply write or the get read. Derived from the one table the way is_ontology_write_procedure is: the procedure’s signature is flagged ProcSignature::store_level.
is_ontology_write_procedure
Whether name names a db.ontology.* write procedure (set, drop, apply — ADR-0121 as amended by ADR-0227): registered with the prefix AND flagged writes, both read from the one table.
is_void_procedure
Whether the procedure behind name declares no return columns — the one void-procedure fact, so the CALL contract validator and the redundant-OPTIONAL notification detector cannot drift.
legacy_property_encoding
Encode an IndexDef.property in the legacy {property}#{KIND}#{name} format — the encoder half of split_legacy_property_encoding, which decodes the result back to (property, Some(kind)).
plan_mutates_store
The statement’s one write-attempt fact (ADR-0402 Decision 2): the plan walk over [call_writes_store]’s effect question and the planner’s clause table — the READ access-mode gate’s (ADR-0742) key, exported from the exec module that owns it. Whether plan holds a mutation operator — the statement’s ADR-0402 Decision 2 write-attempt fact, recorded once at statement entry (before any rows flow) through the canonical plan walk (relate_planner::plan_any_clause over walk_plan_clauses): every part, every NEXT stage, and every nested body the walk descends into (CALL { … }, WHEN/ELSE, FOREACH bodies, expression subqueries). A write inside a body that never dispatches — an empty driving row set, an untaken branch — is therefore still an attempt, which is the same short-circuit the empty top-level pipeline is made of. Both statement boundaries that name an effect record it here — the write path and the read admission — so the fact has one source on every route. The READ access-mode gate (ADR-0742, relate::gate) asks the same question, so it is exported from this module, the one that owns mutates_store — the clause-level callback the walk applies.
procedure_preview_feature
The preview feature gating procedure name (ADR-0378): Some(PreviewFeature::Ontology) when name resolves to one of the built-in db.ontology.* registry signatures, None for every other name. The lookup is by name against the built-in registry only and never consults the host procedure registry, so a user-registered procedure is not gated — a host db.ontology.custom, for example, resolves to no built-in signature and stays ungated.
props_from_json
Decode a tagged-JSON object into a typed property map. Strict: a non-object payload is an error, never a silently dropped value.
resolve_committed_index_options
The committed-schema path’s per-kind index options resolution (ADR-0649 §6): the same per-kind ConfigPolicy a CREATE INDEX runs, over the flat option payload a committed ontology envelope carries. Nests the payload under indexConfig (the one key the engine’s stored readers navigate), validates the kind’s vocabulary and values — refusing what a CREATE would reject — and completes the kind’s defaults, returning the resolved options map the catalog detail records. Public for the facade’s open-tail application (relate::committed), the one external consumer: the committed file is untrusted input, and its option payloads get the DDL path’s own validation rather than a parallel one.
split_legacy_property_encoding
Decode a legacy IndexDef.property string: split the value catalog_create_index (and the constraint-backed index path) into its props head and index kind. A bare property name (no #) is its own head with no kind. The single decoder for this format — every reader of IndexDef.property goes through here.
value_matches_proc_type
Whether a value satisfies a procedure argument type string (STRING, INTEGER, LIST<FLOAT>, …). ANY, an empty type, a nullable ? suffix, and a null value match everything; the accepted type vocabulary is explicit and fails closed, so an unknown (typo’d or unmodelled) type name matches nothing. The precise element-type check of a list happens in the procedure body itself. The canonical home is here, beside the type strings this registry declares — the facade’s compile-time validate_calls and the executor’s per-row binder read the one spelling, so the two cannot drift.