aiondb-executor

Runs a PhysicalPlan against the catalog, storage, and sequence backends. The crate ties together every other SQL-pipeline crate: it consumes plans from aiondb-plan, dispatches expressions through aiondb-eval, drives mutations through aiondb-catalog and the storage traits, and runs PL/pgSQL programs through aiondb-plpgsql.

cargo

[dependencies]
aiondb-executor = { path = "../aiondb-executor" }

modules

modulepurpose
contextExecutionContext, SessionSettings, SequenceSessionState.
executorThe Executor struct and every per-operator implementation (joins, aggregates, DML, DDL, COPY, triggers, FK / unique / check enforcement, window functions, vacuum, analyze, distributed fragments, Cypher, PL/pgSQL bridge).
resultExecutionResult and ResultChunk - what execute returns to the engine.
row_streamRow iterator used between operators.
distributed_runtimeDistributedQueryRuntime, the engine-level coordinator that owns fragment dispatchers.
spillOn-disk spill files for hash joins / aggregates that exceed the work-memory budget.

key types

entry points

itemrole
Executor::execute(plan, ctx)Run a single PhysicalPlan and return an ExecutionResult.
Executor::execute_distributed_fragments(plans, ctx)Run a slice of fragments locally.
Executor::execute_distributed_fragments_targeted(fragments, ctx)Run pre-targeted distributed fragments through the configured dispatcher.
assign_distributed_fragment_targets, distributed_fragment_target_for_index, format_fragment_targetHelpers used to build / inspect fragment targets.
hash_partition_for_rowHash-partitioning helper used by exchange operators.
parse_copy_text_valueRe-exported from the COPY plan path so the engine can parse a single text value the same way COPY FROM does.
node_registryModule exposing the per-operator entry points used by the engine and tests.

example

use std::sync::Arc;

use aiondb_catalog::{CatalogReader, CatalogTxnParticipant, CatalogWriter, SequenceManager};
use aiondb_executor::{ExecutionContext, Executor};
use aiondb_plan::PhysicalPlan;

fn run(
    catalog_reader: Arc<dyn CatalogReader>,
    catalog_writer: Arc<dyn CatalogWriter>,
    catalog_txn: Arc<dyn CatalogTxnParticipant>,
    sequence_manager: Arc<dyn SequenceManager>,
    storage_ddl: Arc<dyn aiondb_executor::executor::StorageDDL>,
    storage_dml: Arc<dyn aiondb_executor::executor::StorageDML>,
    storage_txn: Arc<dyn aiondb_executor::executor::StorageTxnParticipant>,
    logical_plan_compiler: Arc<aiondb_executor::executor::LogicalPlanCompiler>,
    plan: &PhysicalPlan,
    ctx: &ExecutionContext,
) {
    let executor = Executor::new(
        catalog_reader,
        catalog_writer,
        catalog_txn,
        sequence_manager,
        storage_ddl,
        storage_dml,
        storage_txn,
        logical_plan_compiler,
    );
    let result = executor.execute(plan, ctx).expect("execute");
    let _ = result;
}

The exact set of storage / compiler traits is defined in the executor module and consumed by the engine; the snippet above is illustrative of the construction shape.