Skip to main content

promql/native/
mod.rs

1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! The native PromQL evaluation model.
16//!
17//! A query compiles to a [`plan::NativeTree`]: nodes whose operations, fields and grids are already
18//! bound. Nodes hand each other [`batch::EvaluatedChunk`]s as ordinary Rust values, so no row batch
19//! is materialised between them. [`metrics`] names each node after its position in that tree.
20//!
21//! Three properties keep this apart from recognising a query shape in a finished physical plan:
22//!
23//! - Legality is a type and data-dependency question ([`plan::NativeNode::validate`]), so a new
24//!   combination of supported operations is an ordinary tree, not another matcher.
25//! - A window binds its input and output grids separately, so a subquery's inner grid is consumed
26//!   as it is instead of being resampled onto the outer grid.
27//! - A series closes exactly once, on the chunk that says so, so a consumer can tell "nothing more
28//!   here" from "no more input".
29
30mod aggregate;
31pub mod batch;
32pub mod canonicalize;
33pub mod display;
34pub mod execute;
35pub mod metrics;
36pub mod plan;
37pub mod segment;
38pub(crate) mod split;
39pub(crate) mod state;