Skip to content

Commit 111bfe9

Browse files
zzylolclaude
andcommitted
docs: explain what §6.3 update input and readouts are for, with examples
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7qG9aFyPij5uWsyAJCxDW
1 parent 4595032 commit 111bfe9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎docs/design_docs/proposals/asap-primitive-schema.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,23 @@ pub enum StatModelKind { Parametric } pub enum StatModelParams { Parametric {
943943

944944
### 6.3 Update input and readouts (`post_asap/sketch.rs`, `post_asap/maintained_population.rs`)
945945

946+
This part of the code answers two questions about summary state:
947+
948+
1. **Update input** (`SummaryUpdate`): when a `SummaryAgg` reads one input row, what does it add to the state? It adds a **weight**, optionally under an **item** key.
949+
2. **Readouts**: once the state is built, what can be asked of it? `SketchStatistic` is what `SummaryEstimate` asks a sketch (§5.2). `MaintainedPopulation` and `PopulationStatistic` are the exact-population counterpart, used by `MaintainPopulation` and `EvaluatePopulation` (§5.4, §5.5).
950+
951+
**Update input examples** (as the planner builds them in `asap-aware-mapping`):
952+
953+
| Query | Sketch | `item` | `weight` | `weight_domain` |
954+
|---|---|---|---|---|
955+
| p99 of `latency` | KLL | none: KLL has no keys | `Column(latency)`: the value itself | `UnknownOrSigned` |
956+
| how often each `endpoint` occurs | Count-Min | `Column(endpoint)` | `Constant(1.0)`: each row counts once | `NonNegative(UnitCount)` |
957+
| `topk(5, rate(http_requests_total[5m]))` | Count-Min with heap | `Tuple(label columns)`: one item per series | `Column(value)`: the rate | `NonNegative(ResetAwareCounterDerivative)` |
958+
959+
`weight_domain` matters because some sketches (e.g. Count-Min) are only accurate when weights are never negative. The planner records why a weight is non-negative; if it cannot prove it, the weight counts as possibly negative.
960+
961+
**Readout examples:** `Quantile { q: 0.99 }` reads p99 from a KLL; `PointCount { key: endpoint, value: Some("checkout") }` reads how often `checkout` occurred from a Count-Min; `TopK { k: 5 }` reads the 5 heaviest items.
962+
946963
```rust
947964
/// What one input row adds to the state.
948965
pub struct SummaryUpdate {

0 commit comments

Comments
 (0)