Skip to content

docs(asapv1): DDSketch has one encoding, carrying the negative store and zero count - #212

Merged
GordonYuanyc merged 1 commit into
mainfrom
asapv1-p1/ddsketch-signed
Oct 9, 2026
Merged

GordonYuanyc merged 1 commit into
mainfrom
asapv1-p1/ddsketch-signed

Conversation

@GordonYuanyc

Copy link
Copy Markdown
Collaborator

Closes #186. Part of #179.

What the spec says

  • DDSketch (0x05 0x00) has one encoding: metadata_version is 1 and the payload always has eight fields, [counts, offset, sum, min, max, negative_counts, negative_offset, zero_count].
  • negative_counts / negative_offset follow the positive store's rules; an empty negative store sits at negative_offset == 0.
  • Decode rules 4–7 cover both stores: empty form, i32 index span, and the checked total sum(counts) + sum(negative_counts) + zero_count.
  • Rule 7: every non-empty state has finite scalars with min <= max; when sum(negative_counts) == 0 and zero_count == 0, also 0 < min and sum >= min.
  • Section 4 and Q-DERIVED name the new fields.

Choices beyond the issue text

  • metadata_version is 1, as for every other kind.
  • The three fields follow max, the same order as today's signed payload.
  • The empty negative store is pinned at offset 0, as the positive store is.

Not in this PR

Rust and Go encoders and golden files change in #195. No DDSketch golden exists in sketchlib-golden-bytes yet.

Only docs/asapv1_wire_format.md changes.

🤖 Generated with Claude Code

…and zero count

§3.8 gives DDSketch one payload of eight fields and metadata_version 1,
whatever the sketch holds. The negative store and zero count are always
present, empty when unused, and the decode rules cover both stores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GordonYuanyc
GordonYuanyc merged commit fb5198f into main Oct 9, 2026
1 check passed
@GordonYuanyc
GordonYuanyc deleted the asapv1-p1/ddsketch-signed branch October 9, 2026 05:17
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.

ASAPv1: DDSketch signed values

1 participant