pub enum SqlPlan {
Show 25 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,
},
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>,
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: EngineTypeRangeScan
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 = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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>
Returns the layout of the type.
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
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.