Skip to main content

ExecutorPlugin

Trait ExecutorPlugin 

Source
pub trait ExecutorPlugin: Send + Sync {
    // Required method
    fn execute<'a>(
        &'a self,
        op: &'a CustomOp,
        env: PluginEnv<'a>,
    ) -> ExecuteFuture<'a>;
}
Expand description

Executor hook for PlanNode::CustomNode.

§Memoization contract (query-local CustomOp memo)

Compute memoizes the result of every childless CustomOp executed WITHOUT pushed values for the lifetime of ONE query, keyed by (plugin id, op id, payload content bytes, output variables, snapshot id, geo index epoch). Therefore a childless CustomOp must be a pure function of (payload, snapshot) when executed without pushed values: memoization pins every repeated execution within the query — EXISTS NestedProbe page re-opens, expr-substitution groups, parked-outer pages, duplicate identical conjuncts — to the first execution’s result. The memo lives in the query’s [crate::filter_residual::QueryCaches], so it dies with the query and never crosses queries. An op WITH children depends on its children’s outputs and is never memoized; an execution WITH pushed keys (or a pinned op, whose pinned terms are not part of the memo key) depends on runtime inputs outside the key and is never memoized either — its result must be recomputed per execution.

Below the result memo sits the geo drain memo (QueryCaches::geo_drains): a GeoCandidateScan window’s candidate list is a pure function of (intervals, envelope, limit, snapshot, geo epoch) — invariant under the pushed-value list — so the engine’s PluginEnv::geo_candidates service memoizes it per window and a keyed execution’s later pages are served without an RPC. A plugin therefore gets repeat-drain reuse for its candidate sweeps even where the result memo refuses (keyed, pinned, children); what it must NOT expect is a result-level hit for those executions.

Required Methods§

Source

fn execute<'a>( &'a self, op: &'a CustomOp, env: PluginEnv<'a>, ) -> ExecuteFuture<'a>

Execute the op, returning materialized rows — one inner Vec per row, one EncodedTerm per op output variable (op.variables). Both evaluation paths materialize; the OpenNode cursor pages this table locally afterwards.

Implementors§