Skip to main content

Crate mongreldb_query

Crate mongreldb_query 

Source
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?;

Modules§

arrow_conv
MongrelDB ↔ Arrow conversions: schema mapping and Vec<Row>RecordBatch.
extended_sql_functions
Extended SQL Functions: application-oriented scalar functions layered on DataFusion for date/time, JSON, string, and math compatibility.

Structs§

ExternalModuleDescriptor
ExternalModuleIndex
ExternalModuleRegistry
ExternalPlan
ExternalPlanRequest
ExternalScan
ExternalTxn
ExternalWriteResult
ManagedQueryBatches
Buffered SQL output whose registry entry and session permit remain live until response serialization explicitly succeeds or fails.
ModuleConnectCtx
MongrelProvider
A MongrelDB table exposed to DataFusion. Holds the live Table behind a mutex; each scan takes a fresh MVCC snapshot.
MongrelSession
Convenience wrapper: a DataFusion SessionContext bound to a live MongrelDB, with a result cache keyed by (sql, snapshot_epoch) that auto-invalidates when a commit advances the epoch.
QueryId
QueryStatus
RegisteredQueryGuard
RegisteredSqlQuery
SqlQueryOptions
SqlQueryRegistry
SqlStreamCompletion

Enums§

CancelOutcome
CommitFenceOutcome
ExternalBaseWrite
ExternalWriteOp
MongrelQueryError
SqlQueryPhase

Traits§

ExternalTable
ExternalTableModule

Functions§

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.

Type Aliases§

MongrelRecordBatchStream
Result