marsdb-query 0.1.0

openCypher query subset parser, planner, and executor used internally by MarsDB.
Documentation
//! Language-agnostic logical plan for the read path (MATCH traversal).
//!
//! Deliberately close to Neo4j's Cypher runtime operator shape, and maps
//! ~1:1 onto TinkerPop Gremlin traversal steps (`g.V().hasLabel(X)` ->
//! NodeByLabelScan+Filter, `.out('REL')` -> Expand, `.limit(n)` -> Limit) so
//! a future Gremlin frontend can compile into this same IR without
//! redesigning the executor.
//!
//! CREATE has no traversal/filtering semantics (it only ever produces new
//! rows), so it's executed directly from the AST rather than through this
//! IR — see `executor::execute_create`.

use marsdb_graph::Direction;

use crate::ast::Expr;

#[derive(Debug, Clone)]
pub enum LogicalPlan {
    AllNodesScan {
        var: String,
    },
    NodeByLabelScan {
        var: String,
        label: String,
    },
    Expand {
        input: Box<LogicalPlan>,
        from_var: String,
        to_var: String,
        rel_var: Option<String>,
        rel_label: Option<String>,
        direction: Direction,
    },
    Filter {
        input: Box<LogicalPlan>,
        predicate: Expr,
    },
    Limit {
        input: Box<LogicalPlan>,
        count: i64,
    },
}