Expand description
The tier-3 pushdown planner: reduces the row set a query scans by
translating its pushable top-level where conjuncts into ONE SQL
statement against the store, then handing the produced rows (plus the
untranslatable residual) back to the in-memory engine to finish. Port of
packages/core/src/oqx-js/planner.ts over the oqx seam
(QueryPlanner, Plan, oqx::partition_pushable,
oqx::residual_query, oqx::ROWS_ROOT).
Correctness is guaranteed by the residual fallback — anything
crate::translate declines stays in-memory — and verified by the
differential gate (planned == in-memory over every corpus-backed query
case and the conformance list). Deliberately conservative: only simple
top-level target scans (no follow, no from E re-projection) whose
source is a bare docs|blocks|nodes|edges or $repo.<target>, with at
least one pushable scalar conjunct, are planned; everything else declines
to a full in-memory run.
One shape difference from the reference, forced by ownership: the
reference attaches a store context to its plan (makeStoreContext(…, rowsRoot)), but a crate::StoreContext borrows the store’s connection
and Plan::context must be 'static, so the plan carries no context and
the runner (crate::query) builds the rows-root context itself
(crate::StoreContext::with_rows_root) — the same six lines
oqx::PlannedEngine::run would execute.
Structs§
- Compiled
- A compiled plan before execution: the statement, its params and the residual query. Pure — what the planner would run, for inspection.
- Sqlite
Planner - The SQLite planner over one repo of the store.
Functions§
- compile
- Compile
queryagainstrepo_id, orNonewhen the shape declines: afollow, afrom Ere-projection, a source that is not a root scan, or no pushable conjunct at all (the engine then does everything).