Skip to content

L4: implement the L3→L4 binding (AggIntent→SummaryKind) and the sketch-vs-exact boundary decision #98

Description

@zzylol

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

  1. 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, …).
  2. Sketch-vs-exact boundary decision (asap-plan/src/boundary.rs) — the per-node choice between an exact operator and a sketch, driven by:
  3. Tests: an AggIntentSummaryKind 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions