diff --git a/crates/frontend-promql/tests/univmon_candidates.rs b/crates/frontend-promql/tests/univmon_candidates.rs index 6b16667c4..7da782090 100644 --- a/crates/frontend-promql/tests/univmon_candidates.rs +++ b/crates/frontend-promql/tests/univmon_candidates.rs @@ -1,6 +1,6 @@ use std::rc::Rc; -use asap_logical_optimizer::accuracy::{AccuracyModel, DefaultAccuracyModel}; +use asap_plan_selection::{AccuracyModel, DefaultAccuracyModel}; mod support; use asap_types::ir::cse::share_common_sub_dags; use asap_types::ir::properties::ErrorMetric; diff --git a/crates/logical-optimizer/src/accuracy/estimators/cms.rs b/crates/logical-optimizer/src/accuracy/estimators/cms.rs index 6208b0fa5..a38700add 100644 --- a/crates/logical-optimizer/src/accuracy/estimators/cms.rs +++ b/crates/logical-optimizer/src/accuracy/estimators/cms.rs @@ -45,17 +45,16 @@ mod tests { use asap_types::ir::schema::{GroupingStrategy, SketchKind}; let c = asap_types::ir::operator::agg_intent::default_cardinality(); let params = default_size_params(SketchAlgorithm::Cms, &c, 0.01, 0.001); - let g = DefaultAccuracyModel - .local_guarantee( - &FieldDataType::Sketch( - SketchKind::new(SketchAlgorithm::Cms, params), - GroupingStrategy::default(), - ), - &SketchStatistic::Cardinality, - ) - .unwrap(); + let g = local_guarantee( + &FieldDataType::Sketch( + SketchKind::new(SketchAlgorithm::Cms, params), + GroupingStrategy::default(), + ), + &SketchStatistic::Cardinality, + ) + .unwrap(); assert_eq!(g.metric, ErrorMetric::Frequency); - assert!(DefaultAccuracyModel.satisfies( + assert!(satisfies( &g, &AccuracyTarget::EpsilonDelta { epsilon: 0.01, @@ -96,16 +95,15 @@ mod tests { }, false => GroupingStrategy::default(), }; - DefaultAccuracyModel - .local_guarantee( - &FieldDataType::Sketch(SketchKind::new(SketchAlgorithm::Cms, params), grouping), - &group_count, - ) - .unwrap() + local_guarantee( + &FieldDataType::Sketch(SketchKind::new(SketchAlgorithm::Cms, params), grouping), + &group_count, + ) + .unwrap() }; - assert!(DefaultAccuracyModel.satisfies(&guarantee(0.01, 0.01, false), &target)); - assert!(!DefaultAccuracyModel.satisfies(&guarantee(0.01, 0.01, true), &target)); - assert!(DefaultAccuracyModel.satisfies(&guarantee(0.005, 0.005, true), &target)); + assert!(satisfies(&guarantee(0.01, 0.01, false), &target)); + assert!(!satisfies(&guarantee(0.01, 0.01, true), &target)); + assert!(satisfies(&guarantee(0.005, 0.005, true), &target)); } #[test] @@ -116,15 +114,14 @@ mod tests { depth: 5, heap_size: 10, }; - let topk_frequency = DefaultAccuracyModel - .local_guarantee( - &FieldDataType::Sketch( - SketchKind::new(SketchAlgorithm::CmsWithHeap, cms_heap), - GroupingStrategy::default(), - ), - &SketchStatistic::TopK { k: 10 }, - ) - .expect("heap sketch still provides per-key frequency intervals"); + let topk_frequency = local_guarantee( + &FieldDataType::Sketch( + SketchKind::new(SketchAlgorithm::CmsWithHeap, cms_heap), + GroupingStrategy::default(), + ), + &SketchStatistic::TopK { k: 10 }, + ) + .expect("heap sketch still provides per-key frequency intervals"); assert_eq!(topk_frequency.metric, ErrorMetric::Frequency); } } diff --git a/crates/logical-optimizer/src/accuracy/estimators/count_sketch.rs b/crates/logical-optimizer/src/accuracy/estimators/count_sketch.rs index 919f920a2..64724b7da 100644 --- a/crates/logical-optimizer/src/accuracy/estimators/count_sketch.rs +++ b/crates/logical-optimizer/src/accuracy/estimators/count_sketch.rs @@ -60,20 +60,19 @@ mod tests { use asap_types::ir::schema::{GroupingStrategy, SketchKind}; let intent = default_cardinality(); let count_sketch = default_size_params(SketchAlgorithm::CountSketch, &intent, 0.01, 0.01); - let guarantee = DefaultAccuracyModel - .local_guarantee( - &FieldDataType::Sketch( - SketchKind::new(SketchAlgorithm::CountSketch, count_sketch), - GroupingStrategy::default(), - ), - &SketchStatistic::PointCount { - key: asap_types::ir::scalar::ColumnRef::SampleValue, - value: None, - }, - ) - .expect("CountSketch has a parameter-derived L2 guarantee"); + let guarantee = local_guarantee( + &FieldDataType::Sketch( + SketchKind::new(SketchAlgorithm::CountSketch, count_sketch), + GroupingStrategy::default(), + ), + &SketchStatistic::PointCount { + key: asap_types::ir::scalar::ColumnRef::SampleValue, + value: None, + }, + ) + .expect("CountSketch has a parameter-derived L2 guarantee"); assert_eq!(guarantee.metric, ErrorMetric::L2Frequency); - assert!(DefaultAccuracyModel.satisfies( + assert!(satisfies( &guarantee, &AccuracyTarget::EpsilonDelta { epsilon: 0.01, diff --git a/crates/logical-optimizer/src/accuracy/estimators/hll.rs b/crates/logical-optimizer/src/accuracy/estimators/hll.rs index 836f2c574..db57063a5 100644 --- a/crates/logical-optimizer/src/accuracy/estimators/hll.rs +++ b/crates/logical-optimizer/src/accuracy/estimators/hll.rs @@ -235,19 +235,18 @@ mod tests { use asap_types::ir::schema::{GroupingStrategy, SketchKind}; let c = default_cardinality(); let params = default_size_params(SketchAlgorithm::Hll, &c, 0.01, 0.01); - let g = DefaultAccuracyModel - .local_guarantee( - &FieldDataType::Sketch( - SketchKind::new(SketchAlgorithm::Hll, params), - GroupingStrategy::default(), - ), - &SketchStatistic::Cardinality, - ) - .unwrap(); + let g = local_guarantee( + &FieldDataType::Sketch( + SketchKind::new(SketchAlgorithm::Hll, params), + GroupingStrategy::default(), + ), + &SketchStatistic::Cardinality, + ) + .unwrap(); assert_eq!(g.metric, ErrorMetric::Cardinality); assert_eq!(g.failure_probability.evaluate(), None); - assert!(DefaultAccuracyModel.satisfies(&g, &AccuracyTarget::Epsilon(0.01))); - assert!(!DefaultAccuracyModel.satisfies( + assert!(satisfies(&g, &AccuracyTarget::Epsilon(0.01))); + assert!(!satisfies( &g, &AccuracyTarget::EpsilonDelta { epsilon: 0.01, diff --git a/crates/logical-optimizer/src/accuracy/estimators/kll.rs b/crates/logical-optimizer/src/accuracy/estimators/kll.rs index 2993af5ed..03eb31883 100644 --- a/crates/logical-optimizer/src/accuracy/estimators/kll.rs +++ b/crates/logical-optimizer/src/accuracy/estimators/kll.rs @@ -47,19 +47,18 @@ mod tests { use asap_types::ir::schema::{GroupingStrategy, SketchKind}; let q = default_quantile(0.99); let params = default_size_params(SketchAlgorithm::Kll, &q, 0.01, 0.01); - let g = DefaultAccuracyModel - .local_guarantee( - &FieldDataType::Sketch( - SketchKind::new(SketchAlgorithm::Kll, params), - GroupingStrategy::default(), - ), - &SketchStatistic::Quantile { q: 0.99 }, - ) - .unwrap(); + let g = local_guarantee( + &FieldDataType::Sketch( + SketchKind::new(SketchAlgorithm::Kll, params), + GroupingStrategy::default(), + ), + &SketchStatistic::Quantile { q: 0.99 }, + ) + .unwrap(); assert_eq!(g.metric, ErrorMetric::Rank); - assert!(DefaultAccuracyModel.satisfies(&g, &AccuracyTarget::Epsilon(0.01))); + assert!(satisfies(&g, &AccuracyTarget::Epsilon(0.01))); assert_eq!(g.failure_probability.evaluate(), Some(0.01)); - assert!(DefaultAccuracyModel.satisfies( + assert!(satisfies( &g, &AccuracyTarget::EpsilonDelta { epsilon: 0.01, diff --git a/crates/logical-optimizer/src/accuracy/estimators/mod.rs b/crates/logical-optimizer/src/accuracy/estimators/mod.rs index 1f81938b3..1afe89f4c 100644 --- a/crates/logical-optimizer/src/accuracy/estimators/mod.rs +++ b/crates/logical-optimizer/src/accuracy/estimators/mod.rs @@ -11,7 +11,10 @@ pub mod hll; pub mod kll; pub mod univmon; -pub(super) fn sketch_guarantee( +/// The guarantee of reading `query` out of a sketch with these committed +/// parameters, built over an exact input; `None` when no error model covers +/// the pair. +pub fn sketch_guarantee( algorithm: &SketchAlgorithm, params: &SketchParams, query: &SketchStatistic, @@ -55,10 +58,12 @@ fn bounded_guarantee( } } -pub(super) fn local_guarantee( - family: &FieldDataType, - query: &SketchStatistic, -) -> Option { +/// The guarantee of reading `query` out of a summary of family `family` built +/// over an **exact** input — derived from the family's committed parameters by +/// inverting the same sizing formulas +/// [`crate::pass1::realization::default_size_params`] uses. `None` when no +/// error model covers the family (none does for `Sample`/`Wavelet`/`StatModel`). +pub fn local_guarantee(family: &FieldDataType, query: &SketchStatistic) -> Option { match family { FieldDataType::Plain(_) => Some(ResultGuarantee::exact("Plain value")), FieldDataType::ExactAggregate(kind, _) => { diff --git a/crates/logical-optimizer/src/accuracy/estimators/univmon.rs b/crates/logical-optimizer/src/accuracy/estimators/univmon.rs index 1adaa9b37..8d31104c6 100644 --- a/crates/logical-optimizer/src/accuracy/estimators/univmon.rs +++ b/crates/logical-optimizer/src/accuracy/estimators/univmon.rs @@ -158,7 +158,7 @@ mod tests { } fn l2(params: SketchParams) -> Option { - DefaultAccuracyModel.local_guarantee(&family(params), &SketchStatistic::FrequencyL2) + local_guarantee(&family(params), &SketchStatistic::FrequencyL2) } fn shape(params: &SketchParams) -> (u32, u32) { @@ -191,12 +191,10 @@ mod tests { key: ColumnRef::SampleValue, value: None, }; - assert!(DefaultAccuracyModel - .local_guarantee(&family(params.clone()), &total) - .is_some_and(|g| g.is_exact())); + assert!(local_guarantee(&family(params.clone()), &total).is_some_and(|g| g.is_exact())); let guarantee = l2(params.clone()).expect("L2 is certified"); assert_eq!(guarantee.metric, ErrorMetric::RelativeValue); - assert!(DefaultAccuracyModel.satisfies( + assert!(crate::accuracy::satisfies( &guarantee, &AccuracyTarget::EpsilonDelta { epsilon: 0.01, @@ -208,9 +206,7 @@ mod tests { SketchStatistic::FrequencyEntropy, ] { assert!( - DefaultAccuracyModel - .local_guarantee(&family(params.clone()), &query) - .is_none(), + local_guarantee(&family(params.clone()), &query).is_none(), "{query:?}" ); } diff --git a/crates/logical-optimizer/src/accuracy/mod.rs b/crates/logical-optimizer/src/accuracy/mod.rs index e5b635aa8..150623d26 100644 --- a/crates/logical-optimizer/src/accuracy/mod.rs +++ b/crates/logical-optimizer/src/accuracy/mod.rs @@ -1,9 +1,11 @@ -//! Planner accuracy interfaces and model dispatch. +//! The analytical accuracy of each summary family. //! -//! Estimator models derive local guarantees, and evidence supplies scoped -//! contracts. Unknown evidence may retain a candidate but does not authorize -//! selection. See `docs/design_docs/concepts/accuracy-models.md` for the -//! design. +//! Estimator models derive local guarantees ([`local_guarantee`]) and the +//! conservative target check ([`satisfies`]); Stage 3's accuracy model +//! (`asap_plan_selection::DefaultAccuracyModel`) delegates to them. Evidence +//! supplies scoped contracts. Unknown evidence may retain a candidate but does +//! not authorize selection. See `docs/design_docs/concepts/accuracy-models.md` +//! for the design. pub mod estimators; pub mod evidence; @@ -20,94 +22,53 @@ use asap_types::ir::schema::{FieldDataType, SketchAlgorithm, SketchParams, Sketc use asap_types::ir::OperatorNode; use asap_types::types::AccuracyTarget; -/// The deployment-extensible accuracy model. `asap-logical-optimizer` ships -/// [`DefaultAccuracyModel`]; a deployment with its own error model for a -/// family implements this trait and passes it to Stage 3. -pub trait AccuracyModel { - /// The guarantee of reading `query` out of a summary of family `family` - /// built over an **exact** input — derived from the family's committed - /// parameters by inverting the same sizing formulas - /// [`crate::pass1::realization::default_size_params`] uses. `None` when this - /// model has no error model for the family (the default has none for - /// `Sample`/`Wavelet`/`StatModel`). - fn local_guarantee( - &self, - family: &FieldDataType, - query: &SketchStatistic, - ) -> Option; +pub use estimators::{local_guarantee, sketch_guarantee}; - /// Compare the dimensions requested by `target`. Unknown required - /// dimensions fail; selection separately excludes missing accuracy evidence. - fn satisfies(&self, guarantee: &ResultGuarantee, target: &AccuracyTarget) -> bool; - - /// Whether `guarantee` bounds the error a target on `statistic` is - /// stated in, so that [`Self::satisfies`] compares like with like. An - /// exact guarantee answers every statistic; otherwise the metric must be - /// one the statistic's ε is measured in. A deployment with a registered - /// cross-metric conversion overrides this. - fn answers(&self, statistic: &SketchStatistic, guarantee: &ResultGuarantee) -> bool { - use ErrorMetric::*; - guarantee.is_exact() - || match statistic { - SketchStatistic::Quantile { .. } => { - matches!(guarantee.metric, Rank | RelativeValue) - } - SketchStatistic::Cardinality => { - matches!(guarantee.metric, Cardinality | RelativeValue) - } - SketchStatistic::FrequencyL2 | SketchStatistic::FrequencyEntropy => { - guarantee.metric == RelativeValue - } - SketchStatistic::PointCount { .. } => { - matches!(guarantee.metric, Frequency | L2Frequency) - } - // A top-k target bounds the item scores, as Pass 1 checks. - SketchStatistic::TopK { .. } => { - matches!(guarantee.metric, Frequency | L2Frequency | TopKMembership) - } +/// Whether `guarantee` bounds the error a target on `statistic` is stated +/// in, so that [`satisfies`] compares like with like. An exact guarantee +/// answers every statistic; otherwise the metric must be one the statistic's +/// ε is measured in. +pub fn answers(statistic: &SketchStatistic, guarantee: &ResultGuarantee) -> bool { + use ErrorMetric::*; + guarantee.is_exact() + || match statistic { + SketchStatistic::Quantile { .. } => { + matches!(guarantee.metric, Rank | RelativeValue) } - } + SketchStatistic::Cardinality => { + matches!(guarantee.metric, Cardinality | RelativeValue) + } + SketchStatistic::FrequencyL2 | SketchStatistic::FrequencyEntropy => { + guarantee.metric == RelativeValue + } + SketchStatistic::PointCount { .. } => { + matches!(guarantee.metric, Frequency | L2Frequency) + } + // A top-k target bounds the item scores, as Pass 1 checks. + SketchStatistic::TopK { .. } => { + matches!(guarantee.metric, Frequency | L2Frequency | TopKMembership) + } + } } -/// The built-in estimator models, with conservative target checks. -#[derive(Debug, Default, Clone, Copy)] -pub struct DefaultAccuracyModel; - /// Small relative tolerance for comparing an evaluated bound against a /// target, so a parameter sized by `⌈·⌉` to *exactly* meet ε is not rejected /// by floating-point noise. const SATISFACTION_TOLERANCE: f64 = 1e-9; -impl DefaultAccuracyModel { - /// Derive the guarantee for the committed estimator parameters and evaluation. - pub fn sketch_guarantee( - algorithm: &SketchAlgorithm, - params: &SketchParams, - query: &SketchStatistic, - ) -> Option { - estimators::sketch_guarantee(algorithm, params, query) - } -} - -impl AccuracyModel for DefaultAccuracyModel { - fn local_guarantee( - &self, - family: &FieldDataType, - query: &SketchStatistic, - ) -> Option { - estimators::local_guarantee(family, query) - } - fn satisfies(&self, guarantee: &ResultGuarantee, target: &AccuracyTarget) -> bool { - let within = |value: Option, limit: f64| { - value.is_some_and(|v| v <= limit * (1.0 + SATISFACTION_TOLERANCE) + f64::EPSILON) - }; - match target { - AccuracyTarget::Exact => guarantee.is_exact(), - AccuracyTarget::Epsilon(eps) => within(guarantee.bound.evaluate(), *eps), - AccuracyTarget::EpsilonDelta { epsilon, delta } => { - within(guarantee.bound.evaluate(), *epsilon) - && within(guarantee.failure_probability.evaluate(), *delta) - } +/// Whether `guarantee` meets every dimension `target` requests, conservatively: +/// an unknown required dimension fails, and only an exact guarantee meets +/// `Exact`. +pub fn satisfies(guarantee: &ResultGuarantee, target: &AccuracyTarget) -> bool { + let within = |value: Option, limit: f64| { + value.is_some_and(|v| v <= limit * (1.0 + SATISFACTION_TOLERANCE) + f64::EPSILON) + }; + match target { + AccuracyTarget::Exact => guarantee.is_exact(), + AccuracyTarget::Epsilon(eps) => within(guarantee.bound.evaluate(), *eps), + AccuracyTarget::EpsilonDelta { epsilon, delta } => { + within(guarantee.bound.evaluate(), *epsilon) + && within(guarantee.failure_probability.evaluate(), *delta) } } } @@ -131,11 +92,12 @@ mod tests { }, ..abs(0.0, 0.0) }; - assert!(!DefaultAccuracyModel.satisfies(&unknown, &AccuracyTarget::Epsilon(1.0))); - assert!(!DefaultAccuracyModel.satisfies(&abs(0.0, 0.01), &AccuracyTarget::Exact)); - assert!( - DefaultAccuracyModel.satisfies(&ResultGuarantee::exact("x"), &AccuracyTarget::Exact) - ); + assert!(!satisfies(&unknown, &AccuracyTarget::Epsilon(1.0))); + assert!(!satisfies(&abs(0.0, 0.01), &AccuracyTarget::Exact)); + assert!(satisfies( + &ResultGuarantee::exact("x"), + &AccuracyTarget::Exact + )); } /// A bound in another statistic's metric does not answer a target: @@ -150,11 +112,13 @@ mod tests { key: asap_types::ir::scalar::ColumnRef::SampleValue, value: None, }; - assert!(DefaultAccuracyModel.answers(&count, &frequency)); - assert!(!DefaultAccuracyModel.answers(&SketchStatistic::Cardinality, &frequency)); - assert!(!DefaultAccuracyModel.answers(&SketchStatistic::Quantile { q: 0.5 }, &frequency)); - assert!(!DefaultAccuracyModel.answers(&SketchStatistic::FrequencyL2, &abs(0.01, 0.01))); - assert!(DefaultAccuracyModel - .answers(&SketchStatistic::Cardinality, &ResultGuarantee::exact("x"))); + assert!(answers(&count, &frequency)); + assert!(!answers(&SketchStatistic::Cardinality, &frequency)); + assert!(!answers(&SketchStatistic::Quantile { q: 0.5 }, &frequency)); + assert!(!answers(&SketchStatistic::FrequencyL2, &abs(0.01, 0.01))); + assert!(answers( + &SketchStatistic::Cardinality, + &ResultGuarantee::exact("x") + )); } } diff --git a/crates/logical-optimizer/src/lib.rs b/crates/logical-optimizer/src/lib.rs index 1cec80c42..2991f401e 100644 --- a/crates/logical-optimizer/src/lib.rs +++ b/crates/logical-optimizer/src/lib.rs @@ -10,8 +10,9 @@ //! - [`pass1`] — local alternatives per target sub-DAG //! ([`pass1::logical_candidates`], the stage pipeline's Stage 1 entry point). //! - [`pass2`] — ASAP-aware sharing across targets. -//! - [`accuracy`] — the analytical accuracy model: per-family error bounds and -//! sizing ([`accuracy::estimators`]). +//! - [`accuracy`] — the analytical accuracy of each summary family: error +//! bounds and sizing ([`accuracy::estimators`]), which Stage 3's accuracy +//! model delegates to. //! //! **Common sub-expression elimination (CSE) of identical sub-DAGs is not //! implemented here.** It runs over the pre-ASAP IR itself @@ -28,7 +29,6 @@ pub mod pass2; mod test_support; pub use accuracy::{ - AccuracyEvidenceProvider, AccuracyModel, DefaultAccuracyModel, NoAccuracyEvidence, - PropagationStats, WorkloadAccuracyEvidence, + AccuracyEvidenceProvider, NoAccuracyEvidence, PropagationStats, WorkloadAccuracyEvidence, }; pub use pass1::realization::{has_subpopulations, summary_candidates, Realization}; diff --git a/crates/plan-selection/src/accuracy.rs b/crates/plan-selection/src/accuracy.rs new file mode 100644 index 000000000..2179e6330 --- /dev/null +++ b/crates/plan-selection/src/accuracy.rs @@ -0,0 +1,58 @@ +//! Stage 3's accuracy model: whether a summary estimate meets its query's +//! accuracy target. The built-in model delegates to the analytical estimators +//! in `asap_logical_optimizer::accuracy`. + +use asap_types::ir::properties::ResultGuarantee; +use asap_types::ir::schema::{FieldDataType, SketchStatistic}; +use asap_types::types::AccuracyTarget; + +/// The deployment-extensible accuracy model. [`DefaultAccuracyModel`] is the +/// built-in one; a deployment with its own error model for a family +/// implements this trait and passes it in +/// [`PlanningModels`](crate::PlanningModels). Stage 3 rejects an estimate +/// whose family has no model. +pub trait AccuracyModel { + /// The guarantee of reading `query` out of a summary of family `family` + /// built over an **exact** input. `None` when this model has no error + /// model for the family. + fn local_guarantee( + &self, + family: &FieldDataType, + query: &SketchStatistic, + ) -> Option; + + /// Compare the dimensions requested by `target`. Unknown required + /// dimensions fail. + fn satisfies(&self, guarantee: &ResultGuarantee, target: &AccuracyTarget) -> bool; + + /// Whether `guarantee` bounds the error a target on `statistic` is + /// stated in, so that [`Self::satisfies`] compares like with like. An + /// exact guarantee answers every statistic; otherwise the metric must be + /// one the statistic's ε is measured in. A deployment with a registered + /// cross-metric conversion overrides this. + fn answers(&self, statistic: &SketchStatistic, guarantee: &ResultGuarantee) -> bool { + asap_logical_optimizer::accuracy::answers(statistic, guarantee) + } +} + +/// The built-in analytical estimator models, with conservative target checks. +#[derive(Debug, Default, Clone, Copy)] +pub struct DefaultAccuracyModel; + +impl AccuracyModel for DefaultAccuracyModel { + fn local_guarantee( + &self, + family: &FieldDataType, + query: &SketchStatistic, + ) -> Option { + asap_logical_optimizer::accuracy::local_guarantee(family, query) + } + + fn satisfies(&self, guarantee: &ResultGuarantee, target: &AccuracyTarget) -> bool { + asap_logical_optimizer::accuracy::satisfies(guarantee, target) + } + + fn answers(&self, statistic: &SketchStatistic, guarantee: &ResultGuarantee) -> bool { + asap_logical_optimizer::accuracy::answers(statistic, guarantee) + } +} diff --git a/crates/plan-selection/src/lib.rs b/crates/plan-selection/src/lib.rs index 96598bdad..083ed42d9 100644 --- a/crates/plan-selection/src/lib.rs +++ b/crates/plan-selection/src/lib.rs @@ -2,6 +2,7 @@ //! that computes cost. Cargo enforces the stage order: this crate depends on //! `asap-types`, Stage 1 and Stage 2, never on the facade or the executor. //! +//! - [`accuracy`] — the accuracy model each estimate is checked with. //! - [`cost`] — analytical pricing, evaluation rates from recurrence, and the //! physical lowering and storage I/O profiles a deployment can price. //! @@ -37,10 +38,13 @@ //! there). [`select_exhaustive`] builds and prices every combination, for //! display and for checking the program. [`plan_stages`] runs the whole //! pipeline from the frontends' roots. +pub mod accuracy; pub mod cost; #[cfg(test)] mod test_support; +pub use accuracy::{AccuracyModel, DefaultAccuracyModel}; + pub use asap_types::deployment::DeploymentCapabilities; pub use cost::recurrence::{evaluation_rate_of, EvaluationRate, RecurrenceError}; @@ -66,9 +70,7 @@ use crate::cost::analytical_cost::{ use crate::cost::physical_operator_statistics::{ EdgeStatistics, OperatorStatistics, PartitionStatistics, UnaryEdgeStatistics, }; -use asap_logical_optimizer::accuracy::{ - AccuracyEvidenceProvider, AccuracyModel, DefaultAccuracyModel, NoAccuracyEvidence, -}; +use asap_logical_optimizer::accuracy::{AccuracyEvidenceProvider, NoAccuracyEvidence}; use asap_logical_optimizer::pass1::logical_candidates::{ choice_index, combination_count, compose_logical_candidate, enumerate_choices, nested_targets, read_targets, LocalLogicalCandidates, LogicalCandidateError, diff --git a/crates/planner/tests/summary_sharing.rs b/crates/planner/tests/summary_sharing.rs index 71572c556..b33650fd5 100644 --- a/crates/planner/tests/summary_sharing.rs +++ b/crates/planner/tests/summary_sharing.rs @@ -5,9 +5,9 @@ use asap_types::ir::{ASAPOp, OperatorNode}; use std::rc::Rc; use asap_frontend_sql::SqlCatalog; -use asap_logical_optimizer::accuracy::{AccuracyModel, DefaultAccuracyModel}; use asap_logical_optimizer::pass1::realization::{default_size_params, DEFAULT_DELTA}; use asap_plan_selection::PlanningModels; +use asap_plan_selection::{AccuracyModel, DefaultAccuracyModel}; use asap_planner::pass::{PlanOutput, QueryPlan}; use asap_planner::{e2e_plan, FrontendInput, UserInput}; use asap_types::ir::operator::agg_intent::default_quantile;