Chryso is a Calcite-style SQL parser + optimizer engine in Rust. It focuses on a clean, modular pipeline (AST -> logical plan -> Cascades optimizer -> physical plan -> adapter) and keeps the core engine execution-agnostic.
- Multi-dialect SQL parsing (Postgres + MySQL first)
- Cascades optimizer with logical and physical rules
- Cost and statistics hooks via ANALYZE and a lightweight catalog
- Adapter-based execution (DuckDB first, Velox next)
- Parser, planner, and core Cascades skeleton are implemented
- DuckDB adapter translates physical plans to SQL and executes simple queries/DML
- CI builds and tests with and without the DuckDB feature
- Velox CI builds the FFI in exec-only mode (no Arrow) to keep the pipeline lean
crates/
core/ AST, errors, formatting helpers
parser/ Dialect-aware parser
planner/ Logical/physical plan definitions + builder
optimizer/ Cascades skeleton (memo, rules, cost)
metadata/ Catalog, stats cache, analyze hooks
adapter/ Execution adapters (DuckDB, mock)
parser_yacc/ Yacc scaffold (validation)
src/
lib.rs Facade crate re-exports
bin/
chryso-cli.rs
Run the CLI (requires DuckDB feature):
cargo run --bin chryso-cli --features duckdbBuild with Bazel:
bazel build //:chryso
bazel build //:chryso_cliRun the DuckDB demo:
cargo run --example duckdb_demo --features duckdbAll tests:
cargo testWith DuckDB:
cargo test --features duckdbVelox exec-only build (FFI):
cmake -S ffi/velox -B ffi/velox/build \
-DCHRYSO_VELOX_USE_SUBMODULE=ON \
-DCHRYSO_VELOX_USE_ARROW=OFF \
-DCHRYSO_ARROW_STRICT_VERSION=OFF \
-DCHRYSO_VELOX_BUILD_TESTS=ON \
-DCHRYSO_VELOX_EXEC_ONLY=ON
cmake --build ffi/velox/build --parallelPlan snapshot tests:
- Inputs:
tests/testdata/plan/case1/in.json - Expected outputs:
tests/testdata/plan/case1/out.json
Record snapshots:
CHRYSO_RECORD=1 cargo test --test plan_snapshotdocs/ARCHITECTURE.mdfor the planning pipeline and module overviewdocs/RULES.mdfor rule conventions and current rule setdocs/ADAPTERS.mdfor adapter designdocs/BAZEL.mdfor Bazel targets and scopedocs/ROADMAP.mdfor milestones and TODOs
- Parser: expand dialect coverage and AST compatibility
- Logical rewrites: constant folding and predicate simplification
- Cascades: richer rule library and join order enumeration
- Costing: integrate ANALYZE stats into cost models
- Physical planning: enforcers and required properties
- Adapters: stabilize DuckDB, then add Velox
TBD.