Skip to content

Commit dde58fb

Browse files
committed
docs: update README, CLAUDE.md for CLI tool and current state
Add Quick Start: CLI section to README with usage examples. Update test count to 1,008 across both files. Add CLI tool and engine benchmark documentation to CLAUDE.md. Update file layout to include tools/.
1 parent f2d471c commit dde58fb

2 files changed

Lines changed: 58 additions & 5 deletions

File tree

CLAUDE.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Everything is in `namespace sql_engine`. Templates are parameterized on `Dialect
141141
142142
## Tests
143143
144-
Google Test. 871 tests across 30 test files. Validated against 86K+ external queries (PostgreSQL regression, MySQL MTR, CockroachDB, Vitess, TiDB, sqlparser-rs, SQLGlot).
144+
Google Test. 1,008 tests across 34 test files. Validated against 86K+ external queries (PostgreSQL regression, MySQL MTR, CockroachDB, Vitess, TiDB, sqlparser-rs, SQLGlot).
145145
146146
Run a single test: `./run_tests --gtest_filter="*SetTest*"`
147147
@@ -155,9 +155,33 @@ Run a single test: `./run_tests --gtest_filter="*SetTest*"`
155155
156156
## Benchmarks
157157
158-
Google Benchmark. 18 single-thread + 16 multi-thread + 4 percentile benchmarks.
158+
Google Benchmark. 18 single-thread parser + 7 engine + 16 multi-thread + 4 percentile benchmarks.
159+
Engine benchmarks in `bench/bench_engine.cpp` cover expression evaluation, plan building, pipeline execution, and operators (filter, join, sort, aggregate).
159160
Comparison benchmarks against libpg_query and sqlparser-rs in `bench/bench_comparison.cpp`.
160161
162+
## CLI Tool (sqlengine)
163+
164+
Interactive SQL engine for testing the full pipeline. Build with `make build-sqlengine`.
165+
166+
```bash
167+
# In-memory mode (expression evaluation, no backends)
168+
echo "SELECT 1 + 2, UPPER('hello'), COALESCE(NULL, 42)" | ./sqlengine
169+
170+
# Interactive mode
171+
./sqlengine
172+
173+
# With MySQL backend
174+
./sqlengine --backend "mysql://root:test@127.0.0.1:13306/testdb?name=shard1"
175+
176+
# Multiple backends with sharding
177+
./sqlengine \
178+
--backend "mysql://root:test@127.0.0.1:13306/testdb?name=shard1" \
179+
--backend "mysql://root:test@127.0.0.1:13307/testdb?name=shard2" \
180+
--shard "users:id:shard1,shard2"
181+
```
182+
183+
Source: `tools/sqlengine.cpp`
184+
161185
## Corpus testing
162186

163187
`corpus_test` binary reads SQL from stdin (one per line), parses each, reports OK/PARTIAL/ERROR counts.

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,32 @@ for (size_t i = 0; i < rs.row_count(); ++i) {
115115
parser.reset();
116116
```
117117

118+
### Quick Start: CLI tool
119+
120+
```bash
121+
# Build the CLI tool
122+
make build-sqlengine
123+
124+
# In-memory mode — evaluate expressions without any backend
125+
echo "SELECT 1 + 2, UPPER('hello'), COALESCE(NULL, 42)" | ./sqlengine
126+
# +---+-------+----+
127+
# | 3 | HELLO | 42 |
128+
# +---+-------+----+
129+
# 1 row in set (0.000 sec)
130+
131+
# Interactive mode
132+
./sqlengine
133+
134+
# With a MySQL backend
135+
./sqlengine --backend "mysql://root:pass@127.0.0.1:3306/mydb?name=primary"
136+
137+
# Multiple backends with sharding
138+
./sqlengine \
139+
--backend "mysql://root:pass@host1:3306/db?name=shard1" \
140+
--backend "mysql://root:pass@host2:3306/db?name=shard2" \
141+
--shard "users:id:shard1,shard2"
142+
```
143+
118144
## Features
119145

120146
### Parser
@@ -186,7 +212,7 @@ Input SQL bytes
186212

187213
## Testing
188214

189-
871 unit tests + validated against 86K+ queries from 9 external corpora:
215+
1,008 unit tests + validated against 86K+ queries from 9 external corpora:
190216

191217
| Corpus | Queries | OK Rate |
192218
|---|---|---|
@@ -269,8 +295,11 @@ src/sql_engine/
269295
function_registry.cpp Built-in function registration
270296
in_memory_catalog.cpp InMemoryCatalog implementation
271297
272-
tests/ 871 unit tests (Google Test)
273-
bench/ 18 benchmarks + comparison suite
298+
tools/
299+
sqlengine.cpp Interactive SQL engine CLI tool
300+
301+
tests/ 1,008 unit tests (Google Test)
302+
bench/ 25 benchmarks (parser + engine + comparison)
274303
```
275304

276305
## Building

0 commit comments

Comments
 (0)