Skip to main content

Module operator

Module operator 

Source
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

OperatorDescription
NodeScanOperatorScans all nodes matching a label (like a table scan in SQL)
IndexScanOperatorUses a B-tree index to find nodes matching a predicate
FilterOperatorEvaluates a WHERE predicate, discarding non-matching records
ExpandOperatorTraverses edges from bound nodes to discover neighbors (graph-native; no SQL equivalent without expensive JOINs)
ExpandIntoOperatorChecks if an edge exists between two already-bound nodes (a semi-join)
ProjectOperatorEvaluates RETURN expressions, materializing NodeRefNode for output
LimitOperator / SkipOperatorLIMIT and SKIP clauses
SortOperatorORDER BY with multi-key comparison
AggregateOperatorGROUP BY + aggregation functions (count, sum, avg, min, max, collect)
JoinOperatorHash join for multi-pattern MATCH queries
LeftOuterJoinOperatorFor OPTIONAL MATCH (preserves unmatched left rows with NULLs)
CartesianProductOperatorCross product for disconnected patterns
UnwindOperatorExpands arrays into individual rows
MergeOperatorMERGE (upsert): CREATE if not exists, otherwise match
ShortestPathOperatorBFS/Dijkstra for shortestPath() function
VectorSearchOperatorHNSW approximate nearest neighbor search
AlgorithmOperatorRuns graph algorithms (PageRank, WCC, SCC, etc.)
DDL operatorsCreateIndex, 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 execution
  • HashMap — build phase of hash joins in JoinOperator
  • BTreeSet — sorted unique results where ordering matters

Structs§

AggregateFunction
Aggregation function definition
AggregateOperator
Aggregate operator: GROUP BY + Aggregations
AlgorithmOperator
Algorithm operator: CALL algo.pageRank(…)
CartesianProductOperator
Cartesian product operator: MATCH (a:X), (b:Y) Produces all combinations of records from left and right inputs
CompositeCreateIndexOperator
Composite create index operator: CREATE INDEX ON :Label(prop1, prop2, …)
CreateConstraintOperator
Create unique constraint operator
CreateEdgeOperator
Create edge operator: CREATE (a)-[:KNOWS]->(b)
CreateIndexOperator
Create property index operator: CREATE INDEX ON :Person(id)
CreateNodeOperator
Create node operator: CREATE (n:Person {name: “Alice”})
CreateNodesAndEdgesOperator
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
CreateVectorIndexOperator
Create vector index operator: CREATE VECTOR INDEX …
DeleteOperator
Delete operator: DELETE n or DETACH DELETE n
DropIndexOperator
Drop index operator: DROP INDEX ON :Label(property)
ExpandIntoOperator
ExpandInto operator: checks whether an edge exists between two already-bound endpoints.
ExpandOperator
Expand operator: -[:KNOWS]->
FilterOperator
Filter operator: WHERE n.age > 30
ForeachOperator
FOREACH operator: FOREACH (x IN list | SET x.prop = val)
IndexScanOperator
Index scan operator: MATCH (n:Person) WHERE n.id = 1
JoinOperator
Join operator: Joins two inputs on a shared variable
LeftOuterJoinOperator
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.
LimitOperator
Limit operator: LIMIT 10
MatchCreateEdgeOperator
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
MergeOperator
MERGE operator - upsert: match or create pattern
MockProcedureOperator
Mock procedure operator for TCK test procedures
NodeByIdOperator
NodeById operator: start from a specific set of node IDs.
NodeScanOperator
Node scan operator: MATCH (n:Person)
OperatorDescription
Description of an operator for EXPLAIN output
PerRowCreateOperator
Per-row CREATE operator: for each input record, creates nodes with properties resolved from the input record’s variable bindings. Used by UNWIND+CREATE.
PerRowMergeOperator
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.
ProjectOperator
Project operator: RETURN n.name, n.age
RemovePropertyOperator
Remove property operator: REMOVE n.name
SchemaVisualizationOperator
Schema visualization operator: CALL db.schema.visualization()
SetPropertyOperator
Set property operator: SET n.name = “Alice”
ShortestPathOperator
ShortestPathOperator - finds shortest path(s) between two nodes using BFS
ShowConstraintsOperator
Show constraints operator: SHOW CONSTRAINTS
ShowIndexesOperator
Show indexes operator: SHOW INDEXES
ShowLabelsOperator
Show labels operator: CALL db.labels()
ShowPropertyKeysOperator
Show property keys operator: CALL db.propertyKeys()
ShowRelationshipTypesOperator
Show relationship types operator: CALL db.relationshipTypes()
ShowVectorIndexesOperator
Show vector indexes operator: SHOW VECTOR INDEX[ES]
SingleRowOperator
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.
SkipOperator
Skip operator: SKIP n
SortOperator
Sort operator: ORDER BY n.age ASC
UnwindOperator
UNWIND operator - expands a list expression into individual rows
VarLengthExpandOperator
Variable-length path expand operator: MATCH (a)-[*1..5]->(b) Uses BFS to find all paths within the specified hop range.
VectorSearchOperator
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.
WithBarrierOperator
WITH projection barrier operator.

Enums§

AggregateType
Aggregation type

Traits§

PhysicalOperator
Physical operator trait - all operators implement this

Functions§

set_query_deadline
Set the query deadline for the current thread (called by QueryExecutor)

Type Aliases§

OperatorBox
Type alias for boxed operators