Skip to main content

SqlPlan

Enum SqlPlan 

Source
pub enum SqlPlan {
Show 26 variants ConstantResult { columns: Vec<String>, values: Vec<SqlValue>, }, Scan { collection: String, alias: Option<String>, engine: EngineType, filters: Vec<Filter>, projection: Vec<Projection>, sort_keys: Vec<SortKey>, limit: Option<usize>, offset: usize, distinct: bool, window_functions: Vec<WindowSpec>, }, PointGet { collection: String, alias: Option<String>, engine: EngineType, key_column: String, key_value: SqlValue, }, DocumentIndexLookup {
Show 13 fields collection: String, alias: Option<String>, engine: EngineType, field: String, value: SqlValue, filters: Vec<Filter>, projection: Vec<Projection>, sort_keys: Vec<SortKey>, limit: Option<usize>, offset: usize, distinct: bool, window_functions: Vec<WindowSpec>, case_insensitive: bool,
}, RangeScan { collection: String, field: String, lower: Option<SqlValue>, upper: Option<SqlValue>, limit: usize, }, Insert { collection: String, engine: EngineType, rows: Vec<Vec<(String, SqlValue)>>, column_defaults: Vec<(String, String)>, }, KvInsert { collection: String, entries: Vec<(SqlValue, Vec<(String, SqlValue)>)>, ttl_secs: u64, }, Upsert { collection: String, engine: EngineType, rows: Vec<Vec<(String, SqlValue)>>, column_defaults: Vec<(String, String)>, on_conflict_updates: Vec<(String, SqlExpr)>, }, InsertSelect { target: String, source: Box<SqlPlan>, limit: usize, }, Update { collection: String, engine: EngineType, assignments: Vec<(String, SqlExpr)>, filters: Vec<Filter>, target_keys: Vec<SqlValue>, returning: bool, }, Delete { collection: String, engine: EngineType, filters: Vec<Filter>, target_keys: Vec<SqlValue>, }, Truncate { collection: String, restart_identity: bool, }, Join { left: Box<SqlPlan>, right: Box<SqlPlan>, on: Vec<(String, String)>, join_type: JoinType, condition: Option<SqlExpr>, limit: usize, projection: Vec<Projection>, filters: Vec<Filter>, }, Aggregate { input: Box<SqlPlan>, group_by: Vec<SqlExpr>, aggregates: Vec<AggregateExpr>, having: Vec<Filter>, limit: usize, }, TimeseriesScan { collection: String, time_range: (i64, i64), bucket_interval_ms: i64, group_by: Vec<String>, aggregates: Vec<AggregateExpr>, filters: Vec<Filter>, projection: Vec<Projection>, gap_fill: String, limit: usize, tiered: bool, }, TimeseriesIngest { collection: String, rows: Vec<Vec<(String, SqlValue)>>, }, VectorSearch { collection: String, field: String, query_vector: Vec<f32>, top_k: usize, ef_search: usize, filters: Vec<Filter>, }, MultiVectorSearch { collection: String, query_vector: Vec<f32>, top_k: usize, ef_search: usize, }, TextSearch { collection: String, query: String, top_k: usize, fuzzy: bool, filters: Vec<Filter>, }, HybridSearch { collection: String, query_vector: Vec<f32>, query_text: String, top_k: usize, ef_search: usize, vector_weight: f32, fuzzy: bool, }, SpatialScan { collection: String, field: String, predicate: SpatialPredicate, query_geometry: Vec<u8>, distance_meters: f64, attribute_filters: Vec<Filter>, limit: usize, projection: Vec<Projection>, }, Union { inputs: Vec<SqlPlan>, distinct: bool, }, Intersect { left: Box<SqlPlan>, right: Box<SqlPlan>, all: bool, }, Except { left: Box<SqlPlan>, right: Box<SqlPlan>, all: bool, }, RecursiveScan { collection: String, base_filters: Vec<Filter>, recursive_filters: Vec<Filter>, join_link: Option<(String, String)>, max_iterations: usize, distinct: bool, limit: usize, }, Cte { definitions: Vec<(String, SqlPlan)>, outer: Box<SqlPlan>, },
}
Expand description

The top-level plan produced by the SQL planner.

Variants§

§

ConstantResult

Query with no FROM clause: SELECT 1, SELECT ‘hello’ AS name, etc. Produces a single row with evaluated constant expressions.

Fields

§columns: Vec<String>
§values: Vec<SqlValue>
§

Scan

Fields

§collection: String
§engine: EngineType
§filters: Vec<Filter>
§projection: Vec<Projection>
§sort_keys: Vec<SortKey>
§limit: Option<usize>
§offset: usize
§distinct: bool
§window_functions: Vec<WindowSpec>
§

PointGet

Fields

§collection: String
§engine: EngineType
§key_column: String
§key_value: SqlValue
§

DocumentIndexLookup

Document fetch via a secondary index: equality predicate on an indexed field. The executor performs an index lookup to resolve matching document IDs, reads each document, and applies any remaining filters, projection, sort, and limit.

Emitted by document_schemaless::plan_scan / document_strict::plan_scan when the WHERE clause contains a single equality predicate on a Ready indexed field. Any additional predicates fall through as post-filters.

Fields

§collection: String
§engine: EngineType
§field: String

Indexed field path used for the lookup.

§value: SqlValue

Equality value from the WHERE clause.

§filters: Vec<Filter>

Remaining filters after extracting the equality used for lookup.

§projection: Vec<Projection>
§sort_keys: Vec<SortKey>
§limit: Option<usize>
§offset: usize
§distinct: bool
§window_functions: Vec<WindowSpec>
§case_insensitive: bool

Whether the chosen index is COLLATE NOCASE — the executor lowercases the lookup value before probing.

§

RangeScan

Fields

§collection: String
§field: String
§limit: usize
§

Insert

Fields

§collection: String
§engine: EngineType
§column_defaults: Vec<(String, String)>

Column defaults from schema: (column_name, default_expr). Used to auto-generate values for missing columns (e.g. id with UUID_V7).

§

KvInsert

KV INSERT: key and value are fundamentally separate. Each entry is (key, value_columns).

Fields

§collection: String
§entries: Vec<(SqlValue, Vec<(String, SqlValue)>)>
§ttl_secs: u64

TTL in seconds (0 = no expiry). Extracted from ttl column if present.

§

Upsert

UPSERT: insert or merge if document exists.

Fields

§collection: String
§engine: EngineType
§column_defaults: Vec<(String, String)>
§on_conflict_updates: Vec<(String, SqlExpr)>

ON CONFLICT (...) DO UPDATE SET field = expr assignments. When empty, upsert is a plain merge: new columns overwrite existing. When non-empty, the engine applies these per-row against the existing document instead of merging the inserted values.

§

InsertSelect

Fields

§target: String
§source: Box<SqlPlan>
§limit: usize
§

Update

Fields

§collection: String
§engine: EngineType
§assignments: Vec<(String, SqlExpr)>
§filters: Vec<Filter>
§target_keys: Vec<SqlValue>
§returning: bool
§

Delete

Fields

§collection: String
§engine: EngineType
§filters: Vec<Filter>
§target_keys: Vec<SqlValue>
§

Truncate

Fields

§collection: String
§restart_identity: bool
§

Join

Fields

§left: Box<SqlPlan>
§right: Box<SqlPlan>
§join_type: JoinType
§condition: Option<SqlExpr>
§limit: usize
§projection: Vec<Projection>

Post-join projection: column names to keep (empty = all columns).

§filters: Vec<Filter>

Post-join filters (from WHERE clause).

§

Aggregate

Fields

§input: Box<SqlPlan>
§group_by: Vec<SqlExpr>
§aggregates: Vec<AggregateExpr>
§having: Vec<Filter>
§limit: usize
§

TimeseriesScan

Fields

§collection: String
§time_range: (i64, i64)
§bucket_interval_ms: i64
§group_by: Vec<String>
§aggregates: Vec<AggregateExpr>
§filters: Vec<Filter>
§projection: Vec<Projection>
§gap_fill: String
§limit: usize
§tiered: bool
§

TimeseriesIngest

Fields

§collection: String
§

VectorSearch

Fields

§collection: String
§field: String
§query_vector: Vec<f32>
§top_k: usize
§ef_search: usize
§filters: Vec<Filter>
§

MultiVectorSearch

Fields

§collection: String
§query_vector: Vec<f32>
§top_k: usize
§ef_search: usize
§

TextSearch

Fields

§collection: String
§query: String
§top_k: usize
§fuzzy: bool
§filters: Vec<Filter>
§

HybridSearch

Fields

§collection: String
§query_vector: Vec<f32>
§query_text: String
§top_k: usize
§ef_search: usize
§vector_weight: f32
§fuzzy: bool
§

SpatialScan

Fields

§collection: String
§field: String
§query_geometry: Vec<u8>
§distance_meters: f64
§attribute_filters: Vec<Filter>
§limit: usize
§projection: Vec<Projection>
§

Union

Fields

§inputs: Vec<SqlPlan>
§distinct: bool
§

Intersect

Fields

§left: Box<SqlPlan>
§right: Box<SqlPlan>
§all: bool
§

Except

Fields

§left: Box<SqlPlan>
§right: Box<SqlPlan>
§all: bool
§

RecursiveScan

Fields

§collection: String
§base_filters: Vec<Filter>
§recursive_filters: Vec<Filter>
§join_link: Option<(String, String)>

Equi-join link for tree-traversal recursion: (collection_field, working_table_field). e.g. ("parent_id", "id") means each iteration finds rows where collection.parent_id matches a working_table.id.

§max_iterations: usize
§distinct: bool
§limit: usize
§

Cte

Non-recursive CTE: execute each definition, then the outer query.

Fields

§definitions: Vec<(String, SqlPlan)>

CTE definitions: (name, subquery_plan).

§outer: Box<SqlPlan>

The outer query that references CTE names.

Trait Implementations§

Source§

impl Clone for SqlPlan

Source§

fn clone(&self) -> SqlPlan

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SqlPlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more