Skip to content

docs: design for ASAP primitive schema and summary semantics - #573

Draft
zzylol wants to merge 3 commits into
mainfrom
docs/asap-primitive-schema
Draft

zzylol wants to merge 3 commits into
mainfrom
docs/asap-primitive-schema

Conversation

@zzylol

@zzylol zzylol commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Why

ASAP primitives (summary states such as KLL, Count-Min or exact accumulators) flow along DAG edges next to raw values. A Schema describes what an edge is (fields and state types), but not which data a summary summarizes. So two states with identical schemas can still be wrong to merge or reuse, for example overlapping time windows or the same population counted twice. The design for this was split across several docs; this PR collects it into one design document.

What

  • New: docs/design_docs/proposals/asap-primitive-schema.md. It covers:
    1. Goal, problem and requirements, with equal-schema examples.
    2. The schema as the DAG edge.
    3. Fields with ASAP primitive types (FieldDataType) and the state vs value boundary.
    4. Summary semantics: what lives in the field type, on the producing operator, and in OperatorNode.coverage.
    5. Examples for every summary operator (SummaryAgg, SummaryEstimate, FinalizeExactAccumulator, MaintainPopulation, EvaluatePopulation, SummaryMerge, and the reserved ones).
    6. Key code interfaces.
  • Moved here, leaving a summary and a link behind: operator-sharing.md §2.1, pre-asap-ir.md (fields and column references), asap-aware-mapping-contracts.md (sketch family identity), and physical-planning-and-deployment.md (input vs summary semantics).
  • Link only: decoupling_op_and_expr.md, concepts/post-asap-ir.md, univmon-frequency-summary.md and the proposals index.

Before / after

  • Before: schema and state-type design is spread over four docs, and none of them says what a summary state covers.
  • After: one design doc defines it end to end, and the other docs point to it.

Related code: SummaryCoverage is implemented in #567, and SummaryMerge in #560. This PR is documentation only and based on main.

🤖 Generated with Claude Code

One design document for the edge schema of ASAP primitives: fields that carry
summary state, the summary semantics a schema must preserve, coverage, and
per-operator examples. Related docs keep a summary and link to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol added a commit that referenced this pull request Oct 3, 2026
The design document and the docs it consolidates are reviewed separately on
main. This PR keeps code, tests and the ScanSelection rename in docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the author's sections 1–4 as written; the operator examples (§5) and
key code interfaces (§6) stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows #579: the top-k sketch readout derives one row per selected item
instead of a packed Utf8 column, matching the exact Sort → Limit shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant