LLKV Table
Work in Progress
llkv-table provides the schema-aware table abstraction that sits between SQL plans and the column store. It accepts Arrow RecordBatches, coordinates catalog metadata, and exposes streaming scan APIs used by the runtime and executor layers.
Responsibilities
- Persist table definitions and column metadata through the system catalog (table
0). - Validate Arrow schemas during
CREATE TABLEand append operations. - Inject and maintain MVCC columns (
row_id,created_by,deleted_by) alongside user data. - Translate logical field requests into
ColumnStorelookups and stream Arrow batches back to callers.
ColumnStore Integration
- Tables wrap an
Arc<ColumnStore>fromllkv-column-map;ColumnStore::appendhandles sorting byrow_id, last-writer-wins rewrites, and pager commits. - Logical fields are namespaced to segregate user data, MVCC bookkeeping, and row-id shadows.
Table::appendperforms schema validation, prepares MVCC metadata, and forwards the batch to the column store for persistence.Table::scan_streamprojects requested columns, applies predicate pushdown viaColumnStream, and yields fixed-size batches to avoid buffering entire results.
Catalog and Metadata
SysCatalog(table0) storesTableMetaandColMetaentries that describe user tables.- Metadata changes (create, alter, drop) flow through the runtime and land in the catalog via the same Arrow append path, preserving crash consistency.
MVCC Visibility
- Scan operations cooperate with
llkv-transactionto filter rows based on transaction snapshots. - Hidden MVCC columns remain present in storage; higher layers decide whether to expose them to callers.
Usage in the Stack
llkv-runtimeuses tables for all DML and DDL operations.llkv-executorrelies onTable::scan_streamduringSELECTevaluation, including joins and aggregations.- Bulk ingestion paths (e.g., INSERT buffering) ultimately append Arrow batches through this crate, ensuring durability and MVCC tagging remain centralized.
License
Licensed under the Apache-2.0 License.