Expand description
Query Engine for RedDB
Provides query execution, filtering, sorting, and similarity search capabilities for the RedDB storage engine.
§Components
- filter: Filter predicates (Eq, Lt, Gt, Between, Like, etc.)
- sort: Sorting and ordering operations
- executor: Query plan execution
- similarity: Vector similarity search integration
- modes: Multi-mode query parsing (SQL, Gremlin, Cypher, SPARQL, Natural Language)
§Multi-Mode Parsing
The query engine supports multiple query languages with automatic mode detection:
ⓘ
use reddb_rql::modes::{parse_multi, detect_mode, QueryMode};
// Gremlin
let gremlin = parse_multi("g.V().hasLabel('host').out('connects')").unwrap();
// SPARQL
let sparql = parse_multi("SELECT ?host WHERE { ?host :hasIP ?ip }").unwrap();
// Natural language
let natural = parse_multi("find all hosts with ssh open").unwrap();§Example
ⓘ
use reddb::storage::query::{Query, Filter, OrderBy, Direction};
let query = Query::select("users")
.filter(Filter::eq("status", "active"))
.filter(Filter::gt("age", 18))
.order_by("created_at", Direction::Desc)
.limit(10);
let results = executor.execute(&query)?;Re-exports§
pub use engine::QueryEngine;pub use engine::QueryEngineFactory;pub use engine::QueryEngineRegistry;pub use executors::CteContext;pub use executors::CteExecutor;pub use executors::CteStats;pub use executors::ExecuteResult;pub use executors::GremlinExecutor;pub use executors::MultiModeExecutor;pub use executors::NaturalExecutor;pub use executors::SparqlExecutor;pub use planner::CacheStats;pub use planner::CachedPlan;pub use planner::CostEstimator;pub use planner::PlanCache;pub use planner::PlanCost;pub use planner::QueryPlan as PlannerQueryPlan;pub use planner::QueryPlanner;pub use rag::ChunkSource;pub use rag::ContextChunk;pub use rag::EntityType;pub use rag::MultiSourceRetriever;pub use rag::QueryAnalysis;pub use rag::QueryIntent;pub use rag::RagConfig;pub use rag::RagEngine;pub use rag::RetrievalContext;pub use rag::RetrievalStrategy;pub use rag::SimilarEntity;pub use similarity::SimilarityQuery;pub use similarity::SimilarityResult;pub use step::AggregateStep;pub use step::BarrierStep;pub use step::BasicTraversal;pub use step::BranchStep;pub use step::ChooseStep;pub use step::CollectingBarrierStep;pub use step::DedupStep;pub use step::Direction as TraversalDirection;pub use step::EdgeSourceStep;pub use step::EdgeStep;pub use step::ExecutionMode;pub use step::FilterStep;pub use step::FlatMapStep;pub use step::FoldStep;pub use step::GroupStep;pub use step::HasStep;pub use step::IdStep;pub use step::LimitStep;pub use step::LoopState;pub use step::MapStep;pub use step::OptionalStep;pub use step::OrderStep;pub use step::Path;pub use step::PathStep;pub use step::Predicate as StepPredicate;pub use step::ProjectStep;pub use step::PropertyStep;pub use step::RangeStep;pub use step::ReducingBarrierStep;pub use step::RepeatStep;pub use step::SelectStep;pub use step::SideEffectStep;pub use step::SourceStep;pub use step::Step;pub use step::StepPosition;pub use step::StepResult;pub use step::StoreStep;pub use step::Traversal;pub use step::TraversalParent;pub use step::Traverser;pub use step::TraverserGenerator;pub use step::TraverserRequirement;pub use step::TraverserValue;pub use step::UnionStep;pub use step::ValueMapStep;pub use step::VertexSourceStep;pub use step::VertexStep;pub use step::WhereStep;pub use unified::UnifiedExecutor;
Modules§
- analyze_
cmd - ANALYZE TABLE execution — Fase 5 P7 prereq.
- batch
- Vectorised columnar execution — a ClickHouse-inspired batch path that runs in parallel to the existing Volcano iterators.
- binary
- GraphBinary Serialization
- engine
- Query Execution Engine
- evaluator
- Scalar expression evaluator — single owner of value-level
evaluation for SQL scalar
Exprtrees. - executor
- Query Executor for RedDB
- executors
- Multi-Mode Query Executors
- filter
- Filter Predicates for Query Engine
- filter_
compiled - Compiled filter interpreter — flat opcode evaluation.
- planner
- Query Planning Layer
- rag
- RAG (Retrieval-Augmented Generation) Engine
- similarity
- Similarity Search Integration for Query Engine
- sort
- Sorting Operations for Query Engine
- step
- Step Architecture
- unified
- Unified Query Executor
- user_
params - Canonical positional parameter binding shared with the portable engine.
Structs§
- Binding
- Immutable binding from variables to values
- Binding
Builder - Builder for creating bindings
- Cardinality
Estimate - Cardinality estimate for a query result
- Execution
Error - Execution error
- Graph
Path - A path through the graph
- Matched
Edge - A matched edge from graph query
- Matched
Node - A matched node from graph query
- OpBGP
- Basic Graph Pattern - set of triple patterns
- OpDisjunction
- Disjunction operator (OR patterns)
- OpDistinct
- Distinct operator
- OpExtend
- Extend operator (bind expression to variable)
- OpFilter
- Filter operator
- OpGroup
- Group operator
- OpJoin
- Join two operators
- OpLeft
Join - Left outer join (OPTIONAL)
- OpMinus
- Minus operator (set difference)
- OpNull
- Null operator (empty pattern)
- OpOrder
- Order operator
- OpProject
- Project operator
- OpReduced
- Reduced operator (adjacent duplicate removal)
- OpSequence
- Sequence operator
- OpSlice
- Slice operator (offset/limit)
- OpTable
- Table operator (inline data VALUES)
- OpTriple
- Single triple pattern
- OpUnion
- Union operator
- OrderBy
- Order by specification for queries
- Predicate
- A single predicate condition
- Query
Iter - Wrapper for boxed iterator to implement Iterator trait
- Query
Iter Base - Base query iterator wrapping a binding source
- Query
Iter Filter - Filter iterator - applies predicate to upstream
- Query
Iter Join - Join iterator - nested loop join
- Query
Iter Project - Project iterator - selects subset of variables
- Query
Iter Slice - Slice iterator - limit and offset
- Query
Iter Sort - Sort iterator - orders results
- Query
Iter Union - Union iterator - concatenates multiple iterators
- Query
Limits - Query limits (LIMIT and OFFSET)
- Query
Plan - Query plan representing a query to execute
- Query
Result - Query result set
- Query
Stats - Query execution statistics
- SortKey
- A single sort key (column + direction)
- SqlType
Name - Structured SQL type name used by the parser/analyzer boundary.
- Transform
Copy - Default copy transform (identity transformation)
- Transform
Push Filter - Filter pushdown transform
- Triple
- Triple pattern for graph matching
- Unified
Record - A single result record containing mixed data.
- Unified
Result - Result of a unified query
- Var
- A variable in a query
Enums§
- Direction
- Sort direction
- Filter
- Composite filter with logical operations
- Filter
Op - Filter operation type
- Nulls
Order - Null handling in sort
- Op
- Core algebraic operator type
- Pattern
- Pattern element (variable or concrete value)
- Type
Modifier - Type modifiers used by SQL types like
DECIMAL(10)orARRAY(TEXT).
Traits§
- Binding
Iterator - Core trait for binding iterators
- OpTransform
- Transformer trait for transforming Op trees
- OpVisitor
- Visitor trait for walking Op trees (read-only)
- Query
Executor - Query executor trait
Functions§
- is_
universal_ entity_ source - Returns true when the table source should be interpreted as the universal entity space (table, document, graph, vector mixed mode).