Expand description
DataFusion SQL + Arrow frontend for MongrelDB.
MongrelProvider implements DataFusion’s TableProvider: each scan()
takes an MVCC snapshot of the table, materializes the visible columns, and
hands DataFusion a streaming MongrelScanExec (see scan.rs) that emits one
RecordBatch per 65 536-row chunk. DataFusion then runs the SQL —
projection, filter, aggregation, limit — with its own vectorized kernels,
pipelined across those small batches so a LIMIT short-circuits and peak
memory stays bounded. MongrelDB owns storage/writes/indexes; DataFusion owns
the vectorized execution.
Example (skipped from doctests; see tests/sql.rs for runnable ones):
ⓘ
let db = Table::create("travel.mongreldb", /* schema */ unimplemented!(), 1)?;
let session = MongrelSession::new(db);
session.register("travel_trips").await?;
let batches = session.run("select * from travel_trips where cost < 300").await?;Re-exports§
pub use ai_retrieval::adaptive_local_k;pub use ai_retrieval::merge_candidates;pub use ai_retrieval::AiConsistencyAudit;pub use ai_retrieval::AiRetrievalError;pub use ai_retrieval::AiWorkBudget;pub use ai_retrieval::FusionMethod;pub use ai_retrieval::LocalCandidate;pub use ai_retrieval::MergedCandidate;
Modules§
- ai_
retrieval - Distributed AI retrieval (spec section 13.4, Stage 4D).
- arrow_
conv - MongrelDB ↔ Arrow conversions: schema mapping and
Vec<Row>→RecordBatch. - distributed
- Distributed SQL plan groundwork (Stage 3J, spec section 12.10).
- extended_
sql_ functions - Extended SQL Functions: application-oriented scalar functions layered on DataFusion for date/time, JSON, string, and math compatibility.
Structs§
- Build
Info - Compact
Finished Query - Durable
Outcome - External
Execution Context - External
Module Descriptor - External
Module Index - External
Module Registry - External
Plan - External
Plan Request - External
Scan - External
Txn - External
Write Result - Managed
Query Batches - Buffered SQL output whose registry entry and session permit remain live until response serialization explicitly succeeds or fails.
- Mongrel
Provider - A MongrelDB table exposed to DataFusion. Holds the live
Tablebehind a mutex; each scan takes a fresh MVCC snapshot. - Mongrel
Session - Convenience wrapper: a DataFusion
SessionContextbound to a live MongrelDB, with a result cache keyed by(sql, snapshot_epoch)that auto-invalidates when a commit advances the epoch. - QueryId
- Query
Registry Stats - Query
Status - Query
Terminal Error - Registered
Query Guard - Registered
SqlQuery - SqlCollection
Limits - Bounds for SQL paths that must materialize batches before conversion.
- SqlQuery
Options - SqlQuery
Registry - SqlStream
Completion
Enums§
- Cancel
Outcome - Commit
Fence Outcome - External
Base Write - External
Write Op - Mongrel
Query Error - Query
Terminal Error Category - Query
Terminal State - Serialization
Outcome - SqlIdempotency
Class - Conservative protocol classification for optional write idempotency. Daemon protocols reject keyed reads. Only statement kinds whose MongrelDB implementation reaches one durable commit are eligible. Transient, session-control, administrative, and unrecognized commands are rejected.
- SqlQuery
Phase
Traits§
Functions§
- build_
info - classify_
sql_ idempotency - contains_
boolean_ ai_ predicate - True when SQL calls a ranked Boolean AI UDF. Remote servers use this to require the bounded scored table functions while embedded sessions retain the trusted Boolean intersection primitives.
- is_
single_ read_ only_ query - True only for one parsed query statement. Protocols that retain paged results use this conservative gate so no write or session-control command can execute through a cursor-producing endpoint.
- normalized_
sql_ fingerprint - SHA-256 of SQL normalized with the same literal- and comment-aware rules used by the query-plan cache. Safe for protocol request binding without retaining raw SQL.