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.
Scan
PointGet
Fields
engine: EngineTypeDocumentIndexLookup
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.
RangeScan
Fields
Insert
Fields
engine: EngineTypeKvInsert
KV INSERT: key and value are fundamentally separate.
Each entry is (key, value_columns).
Fields
Upsert
UPSERT: insert or merge if document exists.
Fields
engine: EngineTypeInsertSelect
Update
Fields
engine: EngineTypeDelete
Truncate
Join
Fields
projection: Vec<Projection>Post-join projection: column names to keep (empty = all columns).
Aggregate
Fields
aggregates: Vec<AggregateExpr>TimeseriesScan
TimeseriesIngest
VectorSearch
Fields
MultiVectorSearch
TextSearch
HybridSearch
Fields
SpatialScan
Union
Intersect
Except
RecursiveScan
Fields
Cte
Non-recursive CTE: execute each definition, then the outer query.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqlPlan
impl RefUnwindSafe for SqlPlan
impl Send for SqlPlan
impl Sync for SqlPlan
impl Unpin for SqlPlan
impl UnsafeUnpin for SqlPlan
impl UnwindSafe for SqlPlan
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.