Skip to main content

QueryPlan

Enum QueryPlan 

Source
pub enum QueryPlan {
    Scan {
        measurement: String,
        tag_filters: Vec<TagFilter>,
        projection: Vec<String>,
        time_range: TimeRange,
        field_predicates: Vec<FieldPredicate>,
        namespace_id: Option<String>,
    },
    Aggregate {
        source: Box<QueryPlan>,
        functions: Vec<AggFn>,
        group_by: Vec<String>,
        estimated_cardinality: Option<usize>,
    },
    Downsample {
        source: Box<QueryPlan>,
        interval: Duration,
        function: AggFn,
    },
    Limit {
        source: Box<QueryPlan>,
        limit: usize,
        offset: usize,
    },
    Window {
        source: Box<QueryPlan>,
        functions: Vec<WindowFn>,
        partition_by: Vec<String>,
        value_column: String,
    },
}
Expand description

A logical query plan.

Describes what data to read and how to process it, without specifying the physical execution strategy.

Variants§

§

Scan

Scan a measurement with optional filters and projection.

Fields

§measurement: String

Measurement name to query.

§tag_filters: Vec<TagFilter>

Tag equality filters.

§projection: Vec<String>

Columns to return (empty = all fields).

§time_range: TimeRange

Time range filter.

§field_predicates: Vec<FieldPredicate>

Zone-map field predicates for late-materialisation row-group pruning. Each predicate compares a numeric column against a threshold; row groups whose per-block min/max stats rule out any match are skipped entirely.

§namespace_id: Option<String>

Structural namespace scope.

When set, the query engine can validate that every scanned segment belongs to this namespace — providing defense-in-depth even if the tag filter injection is bypassed.

§

Aggregate

Aggregate results from a scan.

Fields

§source: Box<QueryPlan>

The underlying scan plan.

§functions: Vec<AggFn>

Aggregation functions to apply.

§group_by: Vec<String>

Columns to group by.

§estimated_cardinality: Option<usize>

Estimated group-key cardinality from segment column statistics. When available, the engine chooses hash aggregation for high cardinality and sort-based grouping for low cardinality. None means unknown (hash is the default).

§

Downsample

Downsample results into time buckets.

Fixed-width buckets only. A Duration is a span of nanoseconds, so this cannot express a calendar bucket — a day in a time zone is 23 or 25 hours across a transition, and a month is not a span at all. The type says so rather than pretending: the two surfaces that do offer calendar buckets are time_bucket() in SQL and a rollup tier, and both go through chronix::timebucket::TimeBucket. Threading that through here would put the tz database inside the query engine for a surface nobody has asked it of.

Fields

§source: Box<QueryPlan>

The underlying scan plan.

§interval: Duration

Bucket interval — a fixed span, aligned to the Unix epoch in UTC.

§function: AggFn

Aggregation function per bucket.

§

Limit

Limit the number of returned rows, optionally skipping some.

Fields

§source: Box<QueryPlan>

The underlying plan.

§limit: usize

Maximum number of rows to return.

§offset: usize

Number of rows to skip before returning.

§

Window

Apply window functions that produce one output row per input row.

Fields

§source: Box<QueryPlan>

The underlying plan.

§functions: Vec<WindowFn>

Window functions to compute.

§partition_by: Vec<String>

Columns to partition by (each partition is independent).

§value_column: String

The value column to apply window functions to.

Trait Implementations§

Source§

impl Clone for QueryPlan

Source§

fn clone(&self) -> QueryPlan

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryPlan

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> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<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