Context
L1–L3 are built and tested end-to-end (lower_promql/lower_sql → canonical L3 QueryExpr, demo: cargo run -p asap-lower --example topk_ir). Above L3, asap-sketch defines the L4 vocabulary (SummaryExpr/L4Node/SummaryKind/SummaryParams/L4Schema) but nothing constructs it — there is no L3→L4 lowering pass, so the entire sketch layer is defined-but-unwired.
Work
- L3→L4 binding pass — walk the L3 tree and emit
SummaryExpr:
- the
AggIntent → SummaryKind map: Quantile→KLL/DDSketch, Cardinality→HLL/Theta/KMV, TopK→CMS-with-heap, Count(approx)→CMS, exact accumulators for Sum/Count/Min/Max/Rate/Increase;
- a pass-through/exact policy for the ~30 intents with no sketch realization (per-series transforms
Math/TimeFn, presence, counter-derivatives, histogram accessors, Group/CountValues, the *OverTime reducers) and the non-aggregate nodes (Relabel, Sample, InfoJoin, VectorFromScalar/ScalarFromVector, EvalTime, …).
- Sketch-vs-exact boundary decision (
asap-plan/src/boundary.rs) — the per-node choice between an exact operator and a sketch, driven by:
- Tests: an
AggIntent→SummaryKind coverage matrix (every intent maps or is explicitly exact/pass-through — no silent fall-through), boundary decisions per accuracy target, and a first end-to-end query-string→L4 pin.
Notes
Context
L1–L3 are built and tested end-to-end (
lower_promql/lower_sql→ canonical L3QueryExpr, demo:cargo run -p asap-lower --example topk_ir). Above L3,asap-sketchdefines the L4 vocabulary (SummaryExpr/L4Node/SummaryKind/SummaryParams/L4Schema) but nothing constructs it — there is no L3→L4 lowering pass, so the entire sketch layer is defined-but-unwired.Work
SummaryExpr:AggIntent → SummaryKindmap:Quantile→KLL/DDSketch,Cardinality→HLL/Theta/KMV,TopK→CMS-with-heap,Count(approx)→CMS, exact accumulators forSum/Count/Min/Max/Rate/Increase;Math/TimeFn, presence, counter-derivatives, histogram accessors,Group/CountValues, the*OverTimereducers) and the non-aggregate nodes (Relabel,Sample,InfoJoin,VectorFromScalar/ScalarFromVector,EvalTime, …).asap-plan/src/boundary.rs) — the per-node choice between an exact operator and a sketch, driven by:AccuracyTargetthreaded onto approximate intents;agg_is_exact/agg_is_mergeable(asap-ir/src/intent_algebra/agg_intent.rs);HistogramKindsketchability (PromQL: histogram_quantile classic-bucket vs sketch-able quantile is a structural heuristic — drive it from sample type/metadata #79):AggIntent::HistogramQuantile(classic buckets) is not re-sketchable; the genericQuantilepath is.AggIntent→SummaryKindcoverage matrix (every intent maps or is explicitly exact/pass-through — no silent fall-through), boundary decisions per accuracy target, and a first end-to-end query-string→L4 pin.Notes
TODO(#34)references inasap-plan(that issue covered L3 canonicalization and is closed — the pass landed inasap-l2::canonicalize).