From 54f8906e73c6f1d1225a9ee8e390a072f82f10c0 Mon Sep 17 00:00:00 2001 From: zz_y Date: Thu, 2 Jul 2026 10:49:53 -0600 Subject: [PATCH] refactor(ir): rename asap-control-core -> asap-ir (#57, phase 3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3 of the crate reorg (#57): rename the now IR-only crate to its pipeline role. `crates/core` -> `crates/ir`, package `asap-control-core` -> `asap-ir`, and every `asap_control_core::…` import -> `asap_ir::…` across the workspace (27 Rust files + 4 dependent Cargo.tomls). Pure mechanical rename, no behavior change. Full workspace suite green; clippy --all-targets clean. (Doc references in README/docs/*.md are refreshed in phase 5.) Co-Authored-By: Claude Opus 4.8 (1M context) --- Cargo.lock | 26 +++++++++---------- Cargo.toml | 2 +- crates/e2e/Cargo.toml | 2 +- crates/e2e/src/lib.rs | 2 +- crates/e2e/tests/aggregate.rs | 4 +-- crates/e2e/tests/binary_op.rs | 4 +-- crates/e2e/tests/nested.rs | 4 +-- crates/e2e/tests/scan.rs | 4 +-- crates/e2e/tests/schema.rs | 4 +-- crates/e2e/tests/time_range.rs | 4 +-- crates/{core => ir}/Cargo.toml | 2 +- .../src/intent_algebra/agg_intent.rs | 0 .../{core => ir}/src/intent_algebra/binder.rs | 0 .../src/intent_algebra/column_resolution.rs | 0 .../src/intent_algebra/expr_ir.rs | 0 .../{core => ir}/src/intent_algebra/lower.rs | 0 crates/{core => ir}/src/intent_algebra/mod.rs | 0 .../{core => ir}/src/intent_algebra/names.rs | 0 .../src/intent_algebra/query_expr.rs | 0 .../src/intent_algebra/relational.rs | 0 .../{core => ir}/src/intent_algebra/schema.rs | 0 crates/{core => ir}/src/lib.rs | 0 crates/{core => ir}/src/types.rs | 0 crates/{core => ir}/src/workload.rs | 0 crates/lower/Cargo.toml | 2 +- crates/lower/examples/topk_ir.rs | 4 +-- crates/lower/src/error.rs | 6 ++--- crates/lower/src/lib.rs | 10 +++---- crates/lower/src/promql.rs | 8 +++--- crates/lower/src/sql/expr.rs | 2 +- crates/lower/src/sql/mod.rs | 12 ++++----- crates/lower/src/sql/types.rs | 4 +-- .../lower/tests/awesome_prometheus_alerts.rs | 4 +-- crates/lower/tests/promql_conformance.rs | 4 +-- crates/lower/tests/promql_corpus.rs | 2 +- crates/lower/tests/promql_equivalence.rs | 4 +-- crates/lower/tests/promql_lowering.rs | 10 +++---- crates/lower/tests/sql_lowering.rs | 6 ++--- crates/lower/tests/synthetic_packet_trace.rs | 6 ++--- crates/plan/Cargo.toml | 2 +- crates/plan/src/cse.rs | 16 ++++++------ crates/plan/src/lib.rs | 4 +-- crates/sketch/Cargo.toml | 2 +- crates/sketch/src/expr.rs | 2 +- crates/sketch/src/lib.rs | 2 +- crates/sketch/src/schema.rs | 2 +- crates/sketch/src/sketch.rs | 2 +- 47 files changed, 87 insertions(+), 87 deletions(-) rename crates/{core => ir}/Cargo.toml (85%) rename crates/{core => ir}/src/intent_algebra/agg_intent.rs (100%) rename crates/{core => ir}/src/intent_algebra/binder.rs (100%) rename crates/{core => ir}/src/intent_algebra/column_resolution.rs (100%) rename crates/{core => ir}/src/intent_algebra/expr_ir.rs (100%) rename crates/{core => ir}/src/intent_algebra/lower.rs (100%) rename crates/{core => ir}/src/intent_algebra/mod.rs (100%) rename crates/{core => ir}/src/intent_algebra/names.rs (100%) rename crates/{core => ir}/src/intent_algebra/query_expr.rs (100%) rename crates/{core => ir}/src/intent_algebra/relational.rs (100%) rename crates/{core => ir}/src/intent_algebra/schema.rs (100%) rename crates/{core => ir}/src/lib.rs (100%) rename crates/{core => ir}/src/types.rs (100%) rename crates/{core => ir}/src/workload.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index a8e2cc6e..51c06a9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -302,20 +302,11 @@ dependencies = [ "regex-syntax", ] -[[package]] -name = "asap-control-core" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "asap-control-lower" version = "0.1.0" dependencies = [ - "asap-control-core", + "asap-ir", "datafusion", "promql-parser", "tokio", @@ -325,22 +316,31 @@ dependencies = [ name = "asap-e2e" version = "0.1.0" dependencies = [ - "asap-control-core", "asap-control-lower", + "asap-ir", +] + +[[package]] +name = "asap-ir" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "thiserror", ] [[package]] name = "asap-plan" version = "0.1.0" dependencies = [ - "asap-control-core", + "asap-ir", ] [[package]] name = "asap-sketch" version = "0.1.0" dependencies = [ - "asap-control-core", + "asap-ir", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e6139df9..2044061e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = [ - "crates/core", + "crates/ir", "crates/sketch", "crates/plan", "crates/lower", diff --git a/crates/e2e/Cargo.toml b/crates/e2e/Cargo.toml index 37d45e9f..e5122940 100644 --- a/crates/e2e/Cargo.toml +++ b/crates/e2e/Cargo.toml @@ -4,5 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] -asap-control-core = { path = "../core" } +asap-ir = { path = "../ir" } asap-control-lower = { path = "../lower" } diff --git a/crates/e2e/src/lib.rs b/crates/e2e/src/lib.rs index 9a05e817..a66d45fe 100644 --- a/crates/e2e/src/lib.rs +++ b/crates/e2e/src/lib.rs @@ -9,7 +9,7 @@ //! here derives or computes expected outputs. pub mod fixtures { - use asap_control_core::intent_algebra::schema::{Column, DataType, Schema}; + use asap_ir::intent_algebra::schema::{Column, DataType, Schema}; pub fn ts_col() -> Column { Column::new("ts", DataType::Timestamp, false) diff --git a/crates/e2e/tests/aggregate.rs b/crates/e2e/tests/aggregate.rs index b2a67e52..d9bf4512 100644 --- a/crates/e2e/tests/aggregate.rs +++ b/crates/e2e/tests/aggregate.rs @@ -8,8 +8,8 @@ //! Single-stat PromQL aggregates always get `output_names: [""]` (no alias) //! and `having: None`. -use asap_control_core::intent_algebra::{AggIntent, QueryExpr, Source}; -use asap_control_core::types::AccuracyTarget; +use asap_ir::intent_algebra::{AggIntent, QueryExpr, Source}; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; use asap_e2e::fixtures::metric_schema; diff --git a/crates/e2e/tests/binary_op.rs b/crates/e2e/tests/binary_op.rs index a264155e..812d711a 100644 --- a/crates/e2e/tests/binary_op.rs +++ b/crates/e2e/tests/binary_op.rs @@ -7,11 +7,11 @@ use std::time::Duration; -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::{ AggIntent, ArithOp, BinaryOpKind, CompareOp, GroupSide, QueryExpr, Source, VectorGrouping, VectorMatch, VectorMatchKind, }; -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; use asap_e2e::fixtures::metric_schema; diff --git a/crates/e2e/tests/nested.rs b/crates/e2e/tests/nested.rs index 6ae02c30..2dece873 100644 --- a/crates/e2e/tests/nested.rs +++ b/crates/e2e/tests/nested.rs @@ -10,10 +10,10 @@ use std::time::Duration; -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::{ AggIntent, ArithOp, BinaryOpKind, CompareOp, L3Expr, L3Scalar, Predicate, QueryExpr, Source, }; -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; use asap_e2e::fixtures::metric_schema; diff --git a/crates/e2e/tests/scan.rs b/crates/e2e/tests/scan.rs index 94a8f79d..d272516f 100644 --- a/crates/e2e/tests/scan.rs +++ b/crates/e2e/tests/scan.rs @@ -6,10 +6,10 @@ //! predicate expression references them positionally. //! Predicates are canonicalized alphabetically by label name at lowering time. -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::{ CompareOp, L3Expr, L3Scalar, Predicate, QueryExpr, Source, }; -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; use asap_e2e::fixtures::metric_schema; diff --git a/crates/e2e/tests/schema.rs b/crates/e2e/tests/schema.rs index f088a569..22dbf0b9 100644 --- a/crates/e2e/tests/schema.rs +++ b/crates/e2e/tests/schema.rs @@ -9,10 +9,10 @@ //! `Aggregate` or a `Project`. Per-series reductions (`rate`, `*_over_time`) //! are label-preserving and keep the schema open. -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; -fn lower(q: &str) -> asap_control_core::intent_algebra::QueryExpr { +fn lower(q: &str) -> asap_ir::intent_algebra::QueryExpr { lower_promql(q, AccuracyTarget::Exact).unwrap_or_else(|e| panic!("lower failed for {q:?}: {e}")) } diff --git a/crates/e2e/tests/time_range.rs b/crates/e2e/tests/time_range.rs index e277a427..77050b59 100644 --- a/crates/e2e/tests/time_range.rs +++ b/crates/e2e/tests/time_range.rs @@ -9,8 +9,8 @@ use std::time::Duration; -use asap_control_core::intent_algebra::{AggIntent, QueryExpr, Source}; -use asap_control_core::types::AccuracyTarget; +use asap_ir::intent_algebra::{AggIntent, QueryExpr, Source}; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; use asap_e2e::fixtures::metric_schema; diff --git a/crates/core/Cargo.toml b/crates/ir/Cargo.toml similarity index 85% rename from crates/core/Cargo.toml rename to crates/ir/Cargo.toml index beadf2e0..d67aa76c 100644 --- a/crates/core/Cargo.toml +++ b/crates/ir/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "asap-control-core" +name = "asap-ir" version = "0.1.0" edition = "2021" diff --git a/crates/core/src/intent_algebra/agg_intent.rs b/crates/ir/src/intent_algebra/agg_intent.rs similarity index 100% rename from crates/core/src/intent_algebra/agg_intent.rs rename to crates/ir/src/intent_algebra/agg_intent.rs diff --git a/crates/core/src/intent_algebra/binder.rs b/crates/ir/src/intent_algebra/binder.rs similarity index 100% rename from crates/core/src/intent_algebra/binder.rs rename to crates/ir/src/intent_algebra/binder.rs diff --git a/crates/core/src/intent_algebra/column_resolution.rs b/crates/ir/src/intent_algebra/column_resolution.rs similarity index 100% rename from crates/core/src/intent_algebra/column_resolution.rs rename to crates/ir/src/intent_algebra/column_resolution.rs diff --git a/crates/core/src/intent_algebra/expr_ir.rs b/crates/ir/src/intent_algebra/expr_ir.rs similarity index 100% rename from crates/core/src/intent_algebra/expr_ir.rs rename to crates/ir/src/intent_algebra/expr_ir.rs diff --git a/crates/core/src/intent_algebra/lower.rs b/crates/ir/src/intent_algebra/lower.rs similarity index 100% rename from crates/core/src/intent_algebra/lower.rs rename to crates/ir/src/intent_algebra/lower.rs diff --git a/crates/core/src/intent_algebra/mod.rs b/crates/ir/src/intent_algebra/mod.rs similarity index 100% rename from crates/core/src/intent_algebra/mod.rs rename to crates/ir/src/intent_algebra/mod.rs diff --git a/crates/core/src/intent_algebra/names.rs b/crates/ir/src/intent_algebra/names.rs similarity index 100% rename from crates/core/src/intent_algebra/names.rs rename to crates/ir/src/intent_algebra/names.rs diff --git a/crates/core/src/intent_algebra/query_expr.rs b/crates/ir/src/intent_algebra/query_expr.rs similarity index 100% rename from crates/core/src/intent_algebra/query_expr.rs rename to crates/ir/src/intent_algebra/query_expr.rs diff --git a/crates/core/src/intent_algebra/relational.rs b/crates/ir/src/intent_algebra/relational.rs similarity index 100% rename from crates/core/src/intent_algebra/relational.rs rename to crates/ir/src/intent_algebra/relational.rs diff --git a/crates/core/src/intent_algebra/schema.rs b/crates/ir/src/intent_algebra/schema.rs similarity index 100% rename from crates/core/src/intent_algebra/schema.rs rename to crates/ir/src/intent_algebra/schema.rs diff --git a/crates/core/src/lib.rs b/crates/ir/src/lib.rs similarity index 100% rename from crates/core/src/lib.rs rename to crates/ir/src/lib.rs diff --git a/crates/core/src/types.rs b/crates/ir/src/types.rs similarity index 100% rename from crates/core/src/types.rs rename to crates/ir/src/types.rs diff --git a/crates/core/src/workload.rs b/crates/ir/src/workload.rs similarity index 100% rename from crates/core/src/workload.rs rename to crates/ir/src/workload.rs diff --git a/crates/lower/Cargo.toml b/crates/lower/Cargo.toml index 710d8bb6..3fc83dbb 100644 --- a/crates/lower/Cargo.toml +++ b/crates/lower/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -asap-control-core = { path = "../core" } +asap-ir = { path = "../ir" } # Private mirror of GreptimeTeam/promql-parser (Apache-2.0). `main` tracks # upstream untouched; the `asap` branch carries our local grammar/function # additions (see THIRD_PARTY.md). diff --git a/crates/lower/examples/topk_ir.rs b/crates/lower/examples/topk_ir.rs index e9bcccf4..70b5e91a 100644 --- a/crates/lower/examples/topk_ir.rs +++ b/crates/lower/examples/topk_ir.rs @@ -3,8 +3,8 @@ // Lowers every topk-shaped query from the design discussion and prints the // resulting L3 IR. Used for interactive exploration; not a test. -use asap_control_core::intent_algebra::schema::{Column, DataType, Schema}; -use asap_control_core::types::AccuracyTarget; +use asap_ir::intent_algebra::schema::{Column, DataType, Schema}; +use asap_ir::types::AccuracyTarget; use asap_control_lower::{lower_promql, lower_sql, SqlCatalog}; fn col(name: &str, dtype: DataType) -> Column { diff --git a/crates/lower/src/error.rs b/crates/lower/src/error.rs index e22002f5..bce5095a 100644 --- a/crates/lower/src/error.rs +++ b/crates/lower/src/error.rs @@ -18,7 +18,7 @@ pub enum LoweringError { /// The workload's query language is not handled by this lowerer. WrongLanguage(String), /// The L2→L3 converter failed (name resolution against the bound schema). - Convert(asap_control_core::intent_algebra::ConvertError), + Convert(asap_ir::intent_algebra::ConvertError), // ── SQL front end (DataFusion) ─────────────────────────────────────────── /// DataFusion failed to parse / plan the SQL query. @@ -58,8 +58,8 @@ impl fmt::Display for LoweringError { impl std::error::Error for LoweringError {} -impl From for LoweringError { - fn from(e: asap_control_core::intent_algebra::ConvertError) -> Self { +impl From for LoweringError { + fn from(e: asap_ir::intent_algebra::ConvertError) -> Self { Self::Convert(e) } } diff --git a/crates/lower/src/lib.rs b/crates/lower/src/lib.rs index c38dcb65..5b5dedfa 100644 --- a/crates/lower/src/lib.rs +++ b/crates/lower/src/lib.rs @@ -3,8 +3,8 @@ //! Both front ends end at the canonical intent algebra via the same L2→L3 //! [`convert_root`]: PromQL parses with `promql-parser`, SQL parses + plans with //! DataFusion. Each emits the per-language -//! [`relational::QueryExpr`](asap_control_core::intent_algebra::relational); the -//! shared converter runs the [`Binder`](asap_control_core::intent_algebra::Binder) +//! [`relational::QueryExpr`](asap_ir::intent_algebra::relational); the +//! shared converter runs the [`Binder`](asap_ir::intent_algebra::Binder) //! for positional name resolution and folds single-statistic sketchable //! aggregates into canonical shapes. @@ -12,9 +12,9 @@ pub mod error; pub mod promql; pub mod sql; -use asap_control_core::intent_algebra::{convert_root, QueryExpr}; -use asap_control_core::types::AccuracyTarget; -use asap_control_core::workload::{QueryLanguage, QueryWorkload, SqlDialect}; +use asap_ir::intent_algebra::{convert_root, QueryExpr}; +use asap_ir::types::AccuracyTarget; +use asap_ir::workload::{QueryLanguage, QueryWorkload, SqlDialect}; pub use error::LoweringError; pub use promql::PromqlLowerer; diff --git a/crates/lower/src/promql.rs b/crates/lower/src/promql.rs index 38088be3..bcf32cb1 100644 --- a/crates/lower/src/promql.rs +++ b/crates/lower/src/promql.rs @@ -4,7 +4,7 @@ //! - **L2 (per-language tree)** is built here: the walk interprets PromQL //! semantics (range vectors, aggregate operators, label matchers) and emits //! the language-flavored [`relational::QueryExpr`] the controller's L2→L3 -//! converter ([`convert_root`](asap_control_core::intent_algebra::convert_root)) +//! converter ([`convert_root`](asap_ir::intent_algebra::convert_root)) //! consumes. Canonicalisation (window-over-aggregate fold, GROUP-BY → //! positional `Aggregate.by`, positional name binding) happens in that //! converter, not here. @@ -41,13 +41,13 @@ use promql_parser::parser::{ VectorSelector, }; -use asap_control_core::intent_algebra::query_expr::{ +use asap_ir::intent_algebra::query_expr::{ BinaryOpKind, GroupSide, VectorGrouping, VectorMatch, VectorMatchKind, }; -use asap_control_core::intent_algebra::relational::{ +use asap_ir::intent_algebra::relational::{ AggFunc, AggItem, L2SortKey, QueryExpr as L2, SourceSpec, }; -use asap_control_core::intent_algebra::{ArithOp, ColumnRef, CompareOp, L2Expr, L3Scalar}; +use asap_ir::intent_algebra::{ArithOp, ColumnRef, CompareOp, L2Expr, L3Scalar}; use crate::error::LoweringError; diff --git a/crates/lower/src/sql/expr.rs b/crates/lower/src/sql/expr.rs index abe5f732..74639509 100644 --- a/crates/lower/src/sql/expr.rs +++ b/crates/lower/src/sql/expr.rs @@ -1,6 +1,6 @@ use datafusion::logical_expr::{BinaryExpr, Expr, Operator}; -use asap_control_core::intent_algebra::{ArithOp, ColumnRef, CompareOp, L2Expr, L3Scalar}; +use asap_ir::intent_algebra::{ArithOp, ColumnRef, CompareOp, L2Expr, L3Scalar}; use crate::error::LoweringError; diff --git a/crates/lower/src/sql/mod.rs b/crates/lower/src/sql/mod.rs index aa996099..e963b748 100644 --- a/crates/lower/src/sql/mod.rs +++ b/crates/lower/src/sql/mod.rs @@ -2,8 +2,8 @@ //! //! Parses SQL via DataFusion (over the catalog's registered tables), then walks //! the unoptimized `LogicalPlan` and emits the language-independent -//! [`relational::QueryExpr`](asap_control_core::intent_algebra::relational) that -//! [`convert_root`](asap_control_core::intent_algebra::convert_root) lowers to +//! [`relational::QueryExpr`](asap_ir::intent_algebra::relational) that +//! [`convert_root`](asap_ir::intent_algebra::convert_root) lowers to //! canonical L3. Positional column identity, accuracy threading, and the //! window-over-aggregate fold all happen in that converter — this front end //! only interprets SQL semantics into the shared L2 algebra. @@ -17,11 +17,11 @@ use datafusion::logical_expr::{ }; use datafusion::prelude::SessionContext; -use asap_control_core::intent_algebra::relational::{ +use asap_ir::intent_algebra::relational::{ AggFunc, AggItem, L2ProjectItem, L2SortKey, QueryExpr as L2, SourceSpec, }; -use asap_control_core::intent_algebra::schema::Schema; -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::schema::Schema; +use asap_ir::intent_algebra::{ ColumnRef, CompareOp, JoinKind, L2Expr, L3Scalar, SetOpKind, WindowFuncKind, }; @@ -36,7 +36,7 @@ use self::expr::df_expr_to_l2; use self::types::schema_to_arrow; /// Lowers SQL strings to the Layer-2 [`relational::QueryExpr`] over a table -/// [`SqlCatalog`]. Call [`convert_root`](asap_control_core::intent_algebra::convert_root) +/// [`SqlCatalog`]. Call [`convert_root`](asap_ir::intent_algebra::convert_root) /// on the result for canonical L3. pub struct SqlLowerer<'a> { catalog: &'a SqlCatalog, diff --git a/crates/lower/src/sql/types.rs b/crates/lower/src/sql/types.rs index 21ba90d5..ac512668 100644 --- a/crates/lower/src/sql/types.rs +++ b/crates/lower/src/sql/types.rs @@ -9,8 +9,8 @@ use datafusion::arrow::datatypes::{ }; use datafusion::common::ScalarValue; -use asap_control_core::intent_algebra::schema::{Column, DataType, Schema}; -use asap_control_core::intent_algebra::L3Scalar; +use asap_ir::intent_algebra::schema::{Column, DataType, Schema}; +use asap_ir::intent_algebra::L3Scalar; use crate::error::LoweringError; diff --git a/crates/lower/tests/awesome_prometheus_alerts.rs b/crates/lower/tests/awesome_prometheus_alerts.rs index 04405384..1f17c600 100644 --- a/crates/lower/tests/awesome_prometheus_alerts.rs +++ b/crates/lower/tests/awesome_prometheus_alerts.rs @@ -26,8 +26,8 @@ // `__GAP`-suffixed names intentionally SHOUT the documented divergences. #![allow(non_snake_case)] -use asap_control_core::intent_algebra::{AggIntent, BinaryOpKind, CompareOp, QueryExpr}; -use asap_control_core::types::AccuracyTarget; +use asap_ir::intent_algebra::{AggIntent, BinaryOpKind, CompareOp, QueryExpr}; +use asap_ir::types::AccuracyTarget; use asap_control_lower::{lower_promql, LoweringError}; const CORPUS: &str = include_str!("data/awesome_prometheus_alerts.txt"); diff --git a/crates/lower/tests/promql_conformance.rs b/crates/lower/tests/promql_conformance.rs index 5d0f84ba..361eb327 100644 --- a/crates/lower/tests/promql_conformance.rs +++ b/crates/lower/tests/promql_conformance.rs @@ -33,10 +33,10 @@ use std::time::Duration; -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::{ AggIntent, ArithOp, BinaryOpKind, CompareOp, QueryExpr, Source, }; -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::{lower_promql, LoweringError}; // ── harness helpers ───────────────────────────────────────────────────────────── diff --git a/crates/lower/tests/promql_corpus.rs b/crates/lower/tests/promql_corpus.rs index 458aa84d..40672a66 100644 --- a/crates/lower/tests/promql_corpus.rs +++ b/crates/lower/tests/promql_corpus.rs @@ -13,7 +13,7 @@ //! that is the guarantee. A coverage floor guards against a change silently //! tanking how much of the corpus we can lower. -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::{lower_promql, LoweringError}; const DOCS: &str = include_str!("data/promql_corpus_docs.txt"); diff --git a/crates/lower/tests/promql_equivalence.rs b/crates/lower/tests/promql_equivalence.rs index 2a96e37d..aedb42b5 100644 --- a/crates/lower/tests/promql_equivalence.rs +++ b/crates/lower/tests/promql_equivalence.rs @@ -17,8 +17,8 @@ #![allow(non_snake_case)] -use asap_control_core::intent_algebra::QueryExpr; -use asap_control_core::types::AccuracyTarget; +use asap_ir::intent_algebra::QueryExpr; +use asap_ir::types::AccuracyTarget; use asap_control_lower::lower_promql; fn lo(q: &str) -> QueryExpr { diff --git a/crates/lower/tests/promql_lowering.rs b/crates/lower/tests/promql_lowering.rs index 4814954d..81aace5d 100644 --- a/crates/lower/tests/promql_lowering.rs +++ b/crates/lower/tests/promql_lowering.rs @@ -2,11 +2,11 @@ use std::time::Duration; -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::{ AggIntent, ArithOp, BinaryOpKind, CompareOp, L3Expr, L3Scalar, QueryExpr, Source, }; -use asap_control_core::types::AccuracyTarget; -use asap_control_core::workload::{ +use asap_ir::types::AccuracyTarget; +use asap_ir::workload::{ BatchEntry, Query, QueryLanguage, QueryRequirements, QueryWorkload, }; @@ -448,7 +448,7 @@ fn binary_op_with_on_grouping() { panic!("expected BinaryOp, got {qe:?}"); }; let vm = vector_match.as_ref().expect("vector_match present"); - use asap_control_core::intent_algebra::VectorMatchKind; + use asap_ir::intent_algebra::VectorMatchKind; assert_eq!(vm.kind, VectorMatchKind::On); assert_eq!(vm.labels, vec!["host".to_string()]); } @@ -666,7 +666,7 @@ fn batch_lowers_each_entry_and_reads_per_query_accuracy() { #[test] fn batch_rejects_non_promql_language() { - use asap_control_core::workload::SqlDialect; + use asap_ir::workload::SqlDialect; let workload = QueryWorkload { language: QueryLanguage::SQL(SqlDialect::DataFusionSQL), query_batch: Some(vec![BatchEntry { diff --git a/crates/lower/tests/sql_lowering.rs b/crates/lower/tests/sql_lowering.rs index d2416af4..fcff829a 100644 --- a/crates/lower/tests/sql_lowering.rs +++ b/crates/lower/tests/sql_lowering.rs @@ -4,11 +4,11 @@ //! the relational L2 algebra, and the shared `convert_root` produces positional //! canonical L3 (the same converter the PromQL path uses). -use asap_control_core::intent_algebra::schema::{Column, DataType, Schema}; -use asap_control_core::intent_algebra::{ +use asap_ir::intent_algebra::schema::{Column, DataType, Schema}; +use asap_ir::intent_algebra::{ AggIntent, CompareOp, GroupKeys, JoinKind, L3Expr, QueryExpr, Source, WindowFuncKind, }; -use asap_control_core::types::AccuracyTarget; +use asap_ir::types::AccuracyTarget; use asap_control_lower::{lower_sql, SqlCatalog}; fn col(name: &str, dtype: DataType) -> Column { diff --git a/crates/lower/tests/synthetic_packet_trace.rs b/crates/lower/tests/synthetic_packet_trace.rs index 516de852..a3fee43c 100644 --- a/crates/lower/tests/synthetic_packet_trace.rs +++ b/crates/lower/tests/synthetic_packet_trace.rs @@ -20,9 +20,9 @@ //! Schema: `packets(srcip, dstip, srcport, dstport, proto, time, pkt_len)`; //! flow / 5-tuple = `(srcip, dstip, srcport, dstport, proto)`. -use asap_control_core::intent_algebra::schema::{Column, DataType, Schema}; -use asap_control_core::intent_algebra::{AggIntent, GroupKeys, QueryExpr}; -use asap_control_core::types::AccuracyTarget; +use asap_ir::intent_algebra::schema::{Column, DataType, Schema}; +use asap_ir::intent_algebra::{AggIntent, GroupKeys, QueryExpr}; +use asap_ir::types::AccuracyTarget; use asap_control_lower::{lower_sql, LoweringError, SqlCatalog}; const CORPUS: &str = include_str!("data/synthetic_packet_trace_queries.sql"); diff --git a/crates/plan/Cargo.toml b/crates/plan/Cargo.toml index 7e875671..a1fd5f0f 100644 --- a/crates/plan/Cargo.toml +++ b/crates/plan/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # The cost-aware optimizer layer (L4 decisions) over the L3 intent algebra. # Depends only on the IR crate — never on a front end. [dependencies] -asap-control-core = { path = "../core" } +asap-ir = { path = "../ir" } diff --git a/crates/plan/src/cse.rs b/crates/plan/src/cse.rs index b0dd581c..f3e3d8ba 100644 --- a/crates/plan/src/cse.rs +++ b/crates/plan/src/cse.rs @@ -2,7 +2,7 @@ //! //! Multi-root planning hoists shared sub-DAGs into `LetBinding`s so the cost //! model can credit the producer once. Legality is gated by -//! [`cse_reuse_is_legal`](asap_control_core::intent_algebra::schema::cse_reuse_is_legal): a candidate +//! [`cse_reuse_is_legal`](asap_ir::intent_algebra::schema::cse_reuse_is_legal): a candidate //! sub-DAG only becomes a binding when its output schema has at least one //! `unique_keys` set — the load-bearing field for this pass. //! @@ -10,9 +10,9 @@ //! case. The fully-general algorithm (alpha-equivalence, schema-merge, //! nested CSE) is a downstream optimisation, not part of the IR contract. -use asap_control_core::intent_algebra::names::{BindingName, QueryId}; -use asap_control_core::intent_algebra::query_expr::QueryExpr; -use asap_control_core::intent_algebra::schema::cse_reuse_is_legal; +use asap_ir::intent_algebra::names::{BindingName, QueryId}; +use asap_ir::intent_algebra::query_expr::QueryExpr; +use asap_ir::intent_algebra::schema::cse_reuse_is_legal; /// Multi-root container produced by the CSE pass. #[derive(Debug, Clone, PartialEq)] @@ -115,10 +115,10 @@ pub fn dedupe_subtrees(roots: Vec<(QueryId, QueryExpr)>) -> CseWorkloadPlan { #[cfg(test)] mod tests { use super::*; - use asap_control_core::intent_algebra::agg_intent::AggIntent; - use asap_control_core::intent_algebra::query_expr::{Source, WindowKind}; - use asap_control_core::intent_algebra::schema::{Column, DataType, Schema}; - use asap_control_core::types::AccuracyTarget; + use asap_ir::intent_algebra::agg_intent::AggIntent; + use asap_ir::intent_algebra::query_expr::{Source, WindowKind}; + use asap_ir::intent_algebra::schema::{Column, DataType, Schema}; + use asap_ir::types::AccuracyTarget; use std::time::Duration; fn col(name: &str, dtype: DataType) -> Column { diff --git a/crates/plan/src/lib.rs b/crates/plan/src/lib.rs index 28656668..5d3ddd99 100644 --- a/crates/plan/src/lib.rs +++ b/crates/plan/src/lib.rs @@ -1,7 +1,7 @@ //! `asap-plan` — the cost-aware optimizer layer over the L3 intent algebra. //! -//! This crate sits between the language-agnostic IR ([`asap_control_core`]) and -//! any runtime: it consumes L3 [`QueryExpr`](asap_control_core::intent_algebra::QueryExpr) +//! This crate sits between the language-agnostic IR ([`asap_ir`]) and +//! any runtime: it consumes L3 [`QueryExpr`](asap_ir::intent_algebra::QueryExpr) //! trees and makes the cost-aware decisions that L3 deliberately leaves open — //! which shared sub-expressions to hoist, which sketch (if any) realises each //! approximate intent, and the canonical form both front ends should agree on. diff --git a/crates/sketch/Cargo.toml b/crates/sketch/Cargo.toml index 65257920..aefdf2f8 100644 --- a/crates/sketch/Cargo.toml +++ b/crates/sketch/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # The L4 sketch algebra (sketch-bound IR) over the L3 intent algebra. # Depends only on the IR crate. [dependencies] -asap-control-core = { path = "../core" } +asap-ir = { path = "../ir" } diff --git a/crates/sketch/src/expr.rs b/crates/sketch/src/expr.rs index 3ddf1195..082e984c 100644 --- a/crates/sketch/src/expr.rs +++ b/crates/sketch/src/expr.rs @@ -2,7 +2,7 @@ use std::rc::Rc; use super::schema::L4Schema; use super::sketch::{SketchQuery, SummaryKind, SummaryParams}; -use asap_control_core::intent_algebra::{ColumnId, ColumnRef, QueryExpr}; +use asap_ir::intent_algebra::{ColumnId, ColumnRef, QueryExpr}; // ── L4 DAG node ─────────────────────────────────────────────────────────────── diff --git a/crates/sketch/src/lib.rs b/crates/sketch/src/lib.rs index a782af55..c90f9557 100644 --- a/crates/sketch/src/lib.rs +++ b/crates/sketch/src/lib.rs @@ -1,7 +1,7 @@ //! `asap-sketch` — the L4 **sketch algebra** (sketch-bound IR) over the L3 //! intent algebra. //! -//! Where L3 ([`asap_control_core::intent_algebra`]) carries *intent* only +//! Where L3 ([`asap_ir::intent_algebra`]) carries *intent* only //! ("compute a quantile to ε accuracy"), this layer is the sketch-bound IR: //! the sketch kind + parameters are committed ([`SummaryKind`] / //! [`SummaryParams`]), and [`L4Node`] / [`SummaryExpr`] describe the summary diff --git a/crates/sketch/src/schema.rs b/crates/sketch/src/schema.rs index 703cebc8..b502b29c 100644 --- a/crates/sketch/src/schema.rs +++ b/crates/sketch/src/schema.rs @@ -1,5 +1,5 @@ use super::sketch::{SummaryKind, SummaryParams}; -use asap_control_core::intent_algebra::DataType; +use asap_ir::intent_algebra::DataType; // ── L4 data types ───────────────────────────────────────────────────────────── diff --git a/crates/sketch/src/sketch.rs b/crates/sketch/src/sketch.rs index 2d4cf20c..e4b86a76 100644 --- a/crates/sketch/src/sketch.rs +++ b/crates/sketch/src/sketch.rs @@ -1,4 +1,4 @@ -use asap_control_core::intent_algebra::ColumnRef; +use asap_ir::intent_algebra::ColumnRef; // ── Summary kind identifiers ───────────────────────────────────────────────────