| Crates.io | kotoba-execution |
| lib.rs | kotoba-execution |
| version | 0.1.22 |
| created_at | 2025-09-14 07:45:45.187623+00 |
| updated_at | 2025-09-19 19:09:57.471846+00 |
| description | Complete query execution and planning engine for Kotoba graph database |
| homepage | https://github.com/com-junkawasaki/kotoba |
| repository | https://github.com/com-junkawasaki/kotoba |
| max_upload_size | |
| id | 1838441 |
| size | 155,931 |
Complete query execution and planning engine for the Kotoba graph database. Provides comprehensive GQL (Graph Query Language) parsing, optimization, and execution capabilities.
Kotoba Execution serves as the core query processing layer, transforming GQL queries into optimized execution plans and delivering high-performance graph traversals. It provides:
GQL Query โ Parser โ Logical Plan โ Optimizer โ Physical Plan โ Executor โ Results
โ โ โ โ โ โ โ
Tokenize Parse Rewrite Optimize Execute Evaluate Stream
gql_parser.rs)// Complete GQL syntax support
let mut parser = GqlParser::new();
let plan = parser.parse("MATCH (n:Person)-[:FOLLOWS]->(m:Person) WHERE n.age > 25 RETURN n.name, count(m)")?;
executor.rs)// Rich expression evaluation with 50+ functions
let expr = Expr::Fn {
fn_: "length".to_string(),
args: vec![Expr::Const(Value::String("hello".to_string()))],
};
// Evaluates to: Value::Int(5)
planner/)| Metric | Status |
|---|---|
| Compilation | โ Clean (with warnings to fix) |
| Tests | โ Comprehensive test suite |
| Documentation | โ Complete API docs |
| Performance | โ Cost-based optimization |
| GQL Compliance | โ Full syntax support |
use kotoba_execution::prelude::*;
use kotoba_core::{types::*, ir::*};
use kotoba_graph::graph::GraphRef;
// Create execution components
let executor = QueryExecutor::new();
let mut parser = GqlParser::new();
// Parse and execute GQL query
let query = "MATCH (n:Person) WHERE n.age > 25 RETURN n.name, n.age";
let plan = parser.parse(query)?;
let graph = GraphRef::new(Graph::empty());
let catalog = Catalog::empty();
let results = executor.execute_plan(&plan, &graph, &catalog)?;
use kotoba_execution::execution::executor::QueryExecutor;
// Create executor and test data
let executor = QueryExecutor::new();
let row = Row { values: HashMap::from([
("name".to_string(), Value::String("Alice".to_string())),
("age".to_string(), Value::Int(30)),
("scores".to_string(), Value::List(vec![
Value::Int(85), Value::Int(92), Value::Int(78)
]))
]) };
// Evaluate complex expressions
let expr = Expr::Fn {
fn_: "size".to_string(),
args: vec![Expr::Var("scores".to_string())],
};
let result = executor.evaluate_expr(&row, &expr);
// Result: Value::Int(3)
Kotoba Execution is the query processing foundation:
| Crate | Purpose | Integration |
|---|---|---|
kotoba-core |
Required | Base types and IR definitions |
kotoba-graph |
Required | Graph data structures for execution |
kotoba-storage |
Required | Index and storage access |
kotoba-server |
Required | HTTP query endpoints |
kotoba-rewrite |
Optional | Additional rewrite rules |
cargo test -p kotoba-execution
Test Coverage:
degree(), labels(), properties()abs(), sqrt(), sin(), cos()length(), toUpper(), toLower(), trim()toString(), toInteger()QueryExecutor] - Main execution engineGqlParser] - GQL tokenizer and parserExpr] - Expression AST for evaluationLogicalPlan] - Logical query representationPhysicalPlan] - Optimized execution plandegree(), labels(), keys(), hasLabel(), properties()abs(), sqrt(), sin(), cos(), tan(), log(), exp()length(), substring(), startsWith(), endsWith(), contains()size(), isEmpty(), reverse()toString(), toInteger(), toFloat(), toBoolean()LogicalPlanner] - GQL to logical algebraQueryOptimizer] - Rule-based optimizationPhysicalPlanner] - Cost-based physical planningSee the main Kotoba repository for contribution guidelines.
Licensed under MIT OR Apache-2.0. See LICENSE for details.