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>,
bucket: TimeBucket,
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
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.
Aggregate
Aggregate results from a scan.
Fields
Downsample
Downsample results into time buckets.
The bucket is a TimeBucket, so this surface means the same thing
as time_bucket() in SQL and as a rollup tier — all three ask the
same type where a bucket starts and where the next one does. It used
to take a Duration, which cannot be a calendar bucket at all: a day
in a zone is 23 or 25 hours across a transition and a month is not a
span, so 1d here quietly meant 86 400 seconds of UTC while 1d in
SQL meant the zone’s day.
Fields
bucket: TimeBucketThe bucket, fixed-width or calendar, and the zone it is read in.
Limit
Limit the number of returned rows, optionally skipping some.
Fields
Window
Apply window functions that produce one output row per input row.