Expand description
Physical operators for query execution using the Volcano iterator model.
§Volcano Iterator Model (ADR-007)
The Volcano model (Goetz Graefe, 1990s) is the dominant query execution paradigm in
relational and graph databases. Each operator implements a next() method that returns
one record at a time, pulling from child operators on demand. This creates a pipeline
where data flows from leaf operators (scans) up through filters, joins, and projections
to the root operator that produces final results.
§Physical Operators
| Operator | Description |
|---|---|
NodeScanOperator | Scans all nodes matching a label (like a table scan in SQL) |
IndexScanOperator | Uses a B-tree index to find nodes matching a predicate |
FilterOperator | Evaluates a WHERE predicate, discarding non-matching records |
ExpandOperator | Traverses edges from bound nodes to discover neighbors (graph-native; no SQL equivalent without expensive JOINs) |
ExpandIntoOperator | Checks if an edge exists between two already-bound nodes (a semi-join) |
ProjectOperator | Evaluates RETURN expressions, materializing NodeRef → Node for output |
LimitOperator / SkipOperator | LIMIT and SKIP clauses |
SortOperator | ORDER BY with multi-key comparison |
AggregateOperator | GROUP BY + aggregation functions (count, sum, avg, min, max, collect) |
JoinOperator | Hash join for multi-pattern MATCH queries |
LeftOuterJoinOperator | For OPTIONAL MATCH (preserves unmatched left rows with NULLs) |
CartesianProductOperator | Cross product for disconnected patterns |
UnwindOperator | Expands arrays into individual rows |
MergeOperator | MERGE (upsert): CREATE if not exists, otherwise match |
ShortestPathOperator | BFS/Dijkstra for shortestPath() function |
VectorSearchOperator | HNSW approximate nearest neighbor search |
AlgorithmOperator | Runs graph algorithms (PageRank, WCC, SCC, etc.) |
| DDL operators | CreateIndex, DropIndex, CreateConstraint, ShowIndexes, etc. |
§Expression Evaluation
The eval_expression() function recursively evaluates AST expressions against a record.
It handles property access (n.name), arithmetic (a + b), comparisons (a > b),
boolean logic (AND/OR/NOT), function calls (toUpper(), count()), CASE
expressions, list operations, and more.
§Type Coercion and NULL Propagation
Integer/Float automatic promotion (widening), String concatenation via +, and NULL
propagation following three-valued logic: any operation involving NULL returns NULL,
except IS NULL / IS NOT NULL.
§Late Materialization
Operators work with Value::NodeRef(id) instead of full Value::Node(id, clone).
Property access goes through resolve_property(), which looks up the property from
the GraphStore on demand. Full materialization only happens at ProjectOperator
when the query returns a node variable. See ADR-012.
§Metaheuristic Optimization Solvers
AlgorithmOperator integrates 16 solvers from graphmind-optimization (Jaya, Rao,
TLBO, Firefly, Cuckoo, GWO, GA, SA, Bat, ABC, GSA, NSGA2, MOTLBO, HS, FPA) for
solving continuous optimization problems within graph queries.
§Rust Patterns
Box<dyn PhysicalOperator>— dynamic dispatch via trait objects for operator trees&GraphStore— lifetime-bounded borrow of the graph during executionHashMap— build phase of hash joins inJoinOperatorBTreeSet— sorted unique results where ordering matters
Structs§
- Aggregate
Function - Aggregation function definition
- Aggregate
Operator - Aggregate operator: GROUP BY + Aggregations
- Algorithm
Operator - Algorithm operator: CALL algo.pageRank(…)
- Cartesian
Product Operator - Cartesian product operator: MATCH (a:X), (b:Y) Produces all combinations of records from left and right inputs
- Composite
Create Index Operator - Composite create index operator: CREATE INDEX ON :Label(prop1, prop2, …)
- Create
Constraint Operator - Create unique constraint operator
- Create
Edge Operator - Create edge operator:
CREATE (a)-[:KNOWS]->(b) - Create
Index Operator - Create property index operator: CREATE INDEX ON :Person(id)
- Create
Node Operator - Create node operator: CREATE (n:Person {name: “Alice”})
- Create
Nodes AndEdges Operator - Combined operator for CREATE patterns with both nodes and edges
Example:
CREATE (a:Person)-[:KNOWS]->(b:Person)This operator first creates all nodes, then creates edges between them - Create
Vector Index Operator - Create vector index operator: CREATE VECTOR INDEX …
- Delete
Operator - Delete operator: DELETE n or DETACH DELETE n
- Drop
Index Operator - Drop index operator: DROP INDEX ON :Label(property)
- Expand
Into Operator - ExpandInto operator: checks whether an edge exists between two already-bound endpoints.
- Expand
Operator - Expand operator:
-[:KNOWS]-> - Filter
Operator - Filter operator: WHERE n.age > 30
- Foreach
Operator - FOREACH operator: FOREACH (x IN list | SET x.prop = val)
- Index
Scan Operator - Index scan operator: MATCH (n:Person) WHERE n.id = 1
- Join
Operator - Join operator: Joins two inputs on a shared variable
- Left
Outer Join Operator - Left outer join operator for OPTIONAL MATCH Iterates left records and probes right records by join variable. When no right match exists, emits the left record with NULL for right-only variables.
- Limit
Operator - Limit operator: LIMIT 10
- Match
Create Edge Operator - Operator for MATCH…CREATE queries
Example:
MATCH (a:Trial {id: 'NCT001'}), (b:Condition {mesh_id: 'D001'}) CREATE (a)-[:STUDIES]->(b)This operator takes matched nodes and creates edges between them - Merge
Operator - MERGE operator - upsert: match or create pattern
- Mock
Procedure Operator - Mock procedure operator for TCK test procedures
- Node
ById Operator - NodeById operator: start from a specific set of node IDs.
- Node
Scan Operator - Node scan operator: MATCH (n:Person)
- Operator
Description - Description of an operator for EXPLAIN output
- PerRow
Create Operator - Per-row CREATE operator: for each input record, creates nodes with properties resolved from the input record’s variable bindings. Used by UNWIND+CREATE.
- PerRow
Merge Operator - Per-row MERGE operator for the Apply pattern in multi-part queries. For each input row, performs a MERGE (find-or-create) on a node pattern, binding the result to the record for downstream operators.
- Project
Operator - Project operator: RETURN n.name, n.age
- Remove
Property Operator - Remove property operator: REMOVE n.name
- Schema
Visualization Operator - Schema visualization operator: CALL db.schema.visualization()
- SetProperty
Operator - Set property operator: SET n.name = “Alice”
- Shortest
Path Operator - ShortestPathOperator - finds shortest path(s) between two nodes using BFS
- Show
Constraints Operator - Show constraints operator: SHOW CONSTRAINTS
- Show
Indexes Operator - Show indexes operator: SHOW INDEXES
- Show
Labels Operator - Show labels operator: CALL db.labels()
- Show
Property Keys Operator - Show property keys operator: CALL db.propertyKeys()
- Show
Relationship Types Operator - Show relationship types operator: CALL db.relationshipTypes()
- Show
Vector Indexes Operator - Show vector indexes operator: SHOW VECTOR INDEX[ES]
- Single
RowOperator - Single-row operator: emits exactly one empty record. Used as the input for standalone RETURN/UNWIND queries (no MATCH/CREATE). Analogous to Oracle’s DUAL table or PostgreSQL’s implicit single row.
- Skip
Operator - Skip operator: SKIP n
- Sort
Operator - Sort operator: ORDER BY n.age ASC
- Unwind
Operator - UNWIND operator - expands a list expression into individual rows
- VarLength
Expand Operator - Variable-length path expand operator: MATCH (a)-[*1..5]->(b) Uses BFS to find all paths within the specified hop range.
- Vector
Search Operator - Vector search operator: supports both CALL db.index.vector.queryNodes(…) and SEARCH clause within MATCH. Returns nodes ordered by similarity (highest first) with optional SCORE AS alias.
- With
Barrier Operator - WITH projection barrier operator.
Enums§
- Aggregate
Type - Aggregation type
Traits§
- Physical
Operator - Physical operator trait - all operators implement this
Functions§
- set_
query_ deadline - Set the query deadline for the current thread (called by QueryExecutor)
Type Aliases§
- Operator
Box - Type alias for boxed operators