Skip to content

docs: add the Count-Min serialization format, version 2 - #21

Open
leerho wants to merge 2 commits into
mainfrom
docs/count-min-format-v2
Open

leerho wants to merge 2 commits into
mainfrom
docs/count-min-format-v2

Conversation

@leerho

@leerho leerho commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

This adds docs/count-min-format.md, the cross-language Count-Min serialization format, version 2, and links it from the README.

The design was agreed by lazy consensus in #18, which closed on 2026-10-25. The full spec was posted there on 2026-11-02, and no objections were raised by the 2026-11-09 deadline.

Contents

  • The byte layout is unchanged from version 1, except for serial version byte 2.
  • Row seeds: rowSeed[i] = XXH64(LE64(i), seed = baseSeed).
  • Item encoding, defined byte for byte, for integers, UTF-8 strings and byte arrays.
  • Item hashing and bucket mapping: bucket = (XXH64(itemBytes, rowSeed[i]) >>> 1) mod numBuckets.
  • Operations, and how readers handle version 1 images.
  • Test vectors: XXH64, row seeds, item hashes and buckets, and complete images.
  • Cross-language test files (section 8): the count_min_v2_<case>_<language>.sk names, the contents of each case, and the checks a reader performs. Version 2 is deterministic, so a case's file must be byte-identical in every language.

Changes from the version posted in #18

  • Adds a status line and the ASF license header.

  • Splits section 4 (item encoding) into subsections.

  • Adds placeholders for the input rules shared by every family, which are under discussion in Cross-language hashing: inconsistent empty-byte and signed-zero handling #20:

    • 4.4: null and empty items;
    • 4.5: floating-point items, covering signed zero and NaN canonicalization;
    • 4.6: other types.

    Each placeholder states what version 2 requires today.

  • Notes that Java's historical UTF-16 APIs don't apply to Count-Min.

  • Adds section 8, on cross-language test files, which wasn't in the posted version.

Sections 1 to 3 and 5 to 7, including every test vector, match the posted text.

Implementations

🤖 Generated with Claude Code

leerho and others added 2 commits November 10, 2026 16:17
Version 2 was agreed by lazy consensus in Discussion #18. The spec was
posted there on 2026-11-02, and no objections were raised by the
2026-11-09 deadline.

The document covers the byte layout, row seed derivation, item encoding,
item hashing and bucket mapping, operations and version handling, and
test vectors. Item encoding includes placeholders for the shared input
rules under discussion in #20: null and empty items, floating-point
items, and other types. The README links the new document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Section 8 defines the version 2 CL files every implementation generates
and checks: names (count_min_v2_<case>_<language>.sk), contents for each
case, the checks a reader performs (including byte-identical images
across languages), and how to treat the existing C++ version 1 files.

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