Embeddable analytical query engine for MoonBit: run SQL over CSV/Parquet files, native and WebAssembly from one codebase.
Dependencies
Status: v1 SQL surface complete, under acceptance hardening. Projection pruning and the vectorized evaluator are the remaining v1 items; APIs may still change.
| direct | rewritten |
|---|---|
| Q1 Q3 Q5 Q6 Q7 Q8 Q10 Q11 Q12 Q13 Q14 Q16 Q19 | Q15 (CTE inlined as a derived table) |
uv run --with duckdb python harness/gen_tpch.py # TPC-H SF0.01 data + goldens
bash harness/check_all.sh # 15 goldens: all PASS| query | moonlake native | duckdb |
|---|---|---|
| Q6 | 539 ms | 0.7 ms |
| Q1 | 622 ms | 3.0 ms |
| Q3 | 713 ms | 4.8 ms |
| Q7 | 995 ms | 4.3 ms |
git clone https://github.com/superbigcup325/moonlake && cd moonlake
moon run cmd/main -- exec --csv harness/data/sf001/lineitem.csv \
"SELECT l_returnflag, sum(l_extendedprice) FROM lineitem WHERE l_shipdate <= date '1998-09-02' GROUP BY l_returnflag ORDER BY l_returnflag"
# l_returnflag|sum_2
# A|532348211.6499983
# ...moon add superbigcup325/moonlake// register tables, run SQL, consume the columnar result
let result = @moonlake.execute(
"SELECT region, count(*) FROM events GROUP BY region",
cat, // a @catalog.Catalog with registered table entries
)| project | what it is | boundary with moonlake |
|---|---|---|
| moonbit-community/sqlparser | SQL lexer/parser (AST) | parsing only, no execution; moonlake ships an in-house subset front-end today (sqlparser's select-statement AST is not destructurable cross-package yet) and stays pinned as the future swap-in once its visibility improves |
| moonbit-community/NyaCSV | CSV dialect parser | text parsing only; moonlake's CSV source builds typed columnar batches on top of it |
| mizchi/parquet | Parquet reader/writer | format decoding only; moonlake adapts its columnar read into the same vectors the executor consumes |
| shunge/arrow (MoonArrow) | Arrow IPC format read/write | memory-format interchange; a future to_arrow bridge is cooperation, not competition |
| uiwcvb/moonsql | embedded OLTP database (row storage, CRUD, persistence) | different species — SQLite to moonlake's DuckDB: transactional storage vs external-file analytics |
| f4ah6o/duckdb, mizchi/duckdb | DuckDB C++ bindings | FFI route: the wasm-gc target is a stub upstream and the binding build is unstable; moonlake is pure MoonBit and runs natively in the browser |
moon check # type-check
moon test # run tests
moon fmt # format
moon run cmd/main # run the CLI
git config core.hooksPath hooks # once per clone: pre-commit gatelet VERSION : StringInstall
Download zipEmbeddable analytical query engine for MoonBit: run SQL over CSV/Parquet files, native and WebAssembly from one codebase.
Dependencies