Query planner, operator tree, and expression evaluator for the CSharpDB embedded database.
$ dotnet add package CSharpDB.ExecutionQuery planner, operator tree, and expression evaluator for the CSharpDB embedded database engine.
CSharpDB.Execution transforms parsed SQL (AST from CSharpDB.Sql) into executable query plans. It implements the classic iterator model with physical operators for scans, joins, aggregation, sorting, filtering, and projection. Expression evaluation is handled by both an interpreter (for one-off use) and a compiler (for hot-path evaluation with column binding at compile time).
system_tables, system_columns, system_indexes, system_views, system_triggersSELECT ... WHERE pk = valueIOperator interface: OpenAsync, MoveNextAsync, Current, OutputSchemaTableScanOperator with pre-decode filtering, projection pushdown, and row count estimationIPreDecodeFilterSupport, IProjectionPushdownTarget, IMaterializedRowsProviderExpressionEvaluator - Static interpreter for simple/infrequent evaluationsExpressionCompiler - Compiles expression ASTs into Func<DbValue[], DbValue> delegates with column indices bound at compile time, eliminating per-row schema lookupsFromSyncLookupToListAsync for materializing full result setsusing CSharpDB.Execution;
using CSharpDB.Sql;
// Parse SQL
var statements = Parser.Parse("SELECT name, age FROM users WHERE age > 21");
// Plan and execute (typically called through CSharpDB.Engine)
var planner = new QueryPlanner(storageContext);
var result = await planner.ExecuteAsync(statements[0]);
// Iterate results
while (await result.MoveNextAsync())
{
DbValue[] row = result.Current;
Console.WriteLine($"{row[0].AsText}, {row[1].AsInteger}");
}
dotnet add package CSharpDB.Execution
CSharpDB.Core - shared type systemCSharpDB.Sql - SQL parser and ASTCSharpDB.Storage - B+tree storage engine| Package | Description |
|---|---|
| CSharpDB.Engine | Embedded database engine that wraps this execution layer |
| CSharpDB.Sql | SQL parser producing the AST this package consumes |
| CSharpDB.Storage | Storage layer for physical I/O |
MIT - see LICENSE for details.