Skip to content

Commit 8a633ee

Browse files
committed
feat: lower SQL through unified operators and scalars
1 parent c30977a commit 8a633ee

21 files changed

Lines changed: 8881 additions & 2 deletions

File tree

‎Cargo.lock‎

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
members = [
33
"crates/asap-physical-operators",
44
"crates/types",
5+
"crates/frontend-common",
56
"crates/sql-function-catalog",
67
"crates/asap-aware-mapping",
78
"crates/frontend-promql",

‎crates/frontend-common/Cargo.toml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "asap-frontend-common"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# Shared front-end layer: the name-based `UnresolvedOp` tree every front end
7+
# emits, and the resolver that binds it into the unified `OperatorNode` IR.
8+
[dependencies]
9+
asap-types = { path = "../types" }
10+
serde = { version = "1", features = ["derive", "rc"] }
11+
thiserror = "2"

‎crates/frontend-common/src/lib.rs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! `asap-frontend-common` — the front-end-facing, name-based operator tree
2+
//! and its resolver into the unified IR.
3+
//!
4+
//! A front end builds an [`UnresolvedOp`] tree (column references are
5+
//! name-based [`ColumnRef`](asap_types::pre_asap::ColumnRef)s) during its
6+
//! own `interpret` step and calls [`resolve_root`], which binds every
7+
//! reference to a positional `ColumnId` and returns the
8+
//! [`OperatorNode`](asap_types::ir::OperatorNode) DAG.
9+
//!
10+
//! - [`unresolved`] — [`UnresolvedOp`] / [`UnresolvedScalar`]: the tree.
11+
//! - [`schema_resolver`] — [`SchemaResolver`]: builds the binding schema of a
12+
//! schemaless (PromQL) leaf from the names the query references.
13+
//! - [`resolve`] — [`resolve_root`]: the bottom-up binding walk.
14+
15+
pub mod resolve;
16+
pub mod schema_resolver;
17+
pub mod unresolved;
18+
19+
pub use resolve::{resolve_expr, resolve_root, resolve_scalar_root, ResolveDAGError};
20+
pub use schema_resolver::{SchemaCatalog, SchemaResolver, UsageDerivedCatalog};
21+
pub use unresolved::{
22+
UnresolvedOp, UnresolvedPredicate, UnresolvedProjectItem, UnresolvedScalar, UnresolvedSortKey,
23+
};

0 commit comments

Comments
 (0)