Learn advanced Rust techniques by building an expression evaluation framework for a database system.
Learn advanced Rust techniques by building an expression evaluation framework for a database system.
A hand-written loop for one integer function is easy. A database expression engine also has to borrow strings without copying, preserve nulls, read several column representations, coerce types, and select functions at runtime.
This course builds the type families and checked boundaries that move those decisions out of each row loop. The result is a small auto-vectorized expression engine: authors write one scalar operation, while generic unary, binary, and ternary adapters reuse the checked batch path.
The complete published course contains five modules and ten cumulative, independently testable checkpoints. Work through them in order; each extends the same starter and keeps the earlier supplied tests green. Plan roughly half a day for each checkpoint. An experienced Rust learner can finish in about five working days, while newer learners should expect to take longer.
The five modules follow the engine from physical values to its outer async boundary:
The course deliberately stops short of Decimal arithmetic, casts and rounding, lossy coercions, nested or list-producing functions, exhaustive fast paths, an aggregate engine, and per-row futures.
You should know ordinary Cargo use, enums, traits, references, and Option. Follow the
environment setup, then work only in
type-exercise-starter:
git fetch origin
git switch --create course-work --track origin/main
cargo check -p type-exercise-starter-expr --lib --locked
Choose another branch name if course-work already exists. The starter baseline should compile.
Do not inspect type-exercise/ or archived/ while solving an exercise.
Copy the cumulative supplied contract when you are ready to start a chapter:
cargo x copy-test --chapter 1
cargo test -p type-exercise-starter-supplied-tests chapter_1 --locked
The first focused run should fail because the new behavior is missing. Read the copied destination
under type-exercise-starter/supplied-tests/src/, implement the named API in other starter files, and rerun
the same command until it passes. Never edit copied tests or supplied-tests/src/lib.rs; keep all earlier copied
chapters green.
Checkpoint 10 is the terminal unit. After completing it, cargo x copy-test --chapter 10 copies
the complete cumulative supplied contract.
Join skyzh's Discord server for discussion. For a concrete bug or improvement, open an issue or pull request.
The source code is licensed under Apache 2.0. See LICENSE. The mdBook text is © 2022-2026 Alex Chi Z and licensed under CC BY-NC-SA 4.0.
No open issues yet, or sync has not completed.