Skip to content

refactor(hll)!: ASAPv1 only — drop proto, portable and native formats - #166

Draft
GordonYuanyc wants to merge 3 commits into
mainfrom
asapv1-only/hll
Draft

GordonYuanyc wants to merge 3 commits into
mainfrom
asapv1-only/hll

Conversation

@GordonYuanyc

@GordonYuanyc GordonYuanyc commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Part of the ASAPv1-only series: one PR per sketch group, each off main. This one removes HyperLogLog's protobuf, portable msgpack and native-shim formats; ASAPv1 (0x01 0x01 Classic, 0x01 0x02 ErtlMLE, 0x01 0x03 HIP) is the only HLL format left.

Draft because of the open questions below.

Removed

  • Proto: HLLDelta; SketchEnvelope.hll (12) is now reserved 12; reserved "hll";. HyperLogLogState, HLLSparseRegisters and HLLVariant stay because hydra.proto embeds HyperLogLogState; they go with the Hydra PR or the final cleanup.
  • message_pack_format::portable::hll: HllSketch, HllSketchDelta, HllVariant (and their crate-root re-exports), registers_from_state, decode_sparse_registers, encode_sparse_registers, and the proto/msgpack delta codecs.
  • message_pack_format::native::hll (the MessagePackCodec impls for the native HLL types).
  • src/sketches/testdata/hll_envelope_golden.hex and the tests that only exercised the removed formats.

Added

  • HyperLogLogImpl::from_storage(registers) and HyperLogLogHIPImpl::from_storage(registers, kxq0, kxq1, est), so a native HLL can be built from known raw state (mirrors CountMin::from_storage). The three existing HLL goldens are now checked through the native types in both directions.
  • ASAPv1 round-trip property laws for Classic and HIP (mutation-checked).
  • Goldens at P14 for all three estimators (hll_classic_p14, hll_ertl_mle_p14, hll_hip_p14; registers include the P14 maximum rank 51), pushed to sketchlib-golden-bytes; submodule bumped. sketchlib-go's HLL is fixed at P14, so these are the fixtures it checks against.

Open questions

  1. Deltas. Production (ASAPCollector Go → ASAPQuery-backend) sends HLL as proto SketchEnvelope{HyperLogLogState} plus bare HLLDelta. After this PR Rust decodes neither; ASAPv1 has no HLL delta.
  2. Sparse / size. ASAPv1 HLL is dense only: every emit is the full register array (≈16 KiB at p14). The proto sparse form has no ASAPv1 equivalent.
  3. Silent decode. proto3 skips unknown fields, so an old Go envelope with field 12 still decodes in Rust, with sketch_state == None and no error.

Downstream

ASAPQuery-backend (via ASAPPlanner's codec crates) decodes the proto full state (dense and sparse) and deltas; ASAPPlanner/ASAPQuery name HllSketch / HllVariant.

Verification (rustc 1.99)

cargo fmt --check; clippy -D warnings for all four CI feature sets; RUSTDOCFLAGS="-D warnings" cargo doc; gen-proto drift clean; filtered tests for the touched areas (--lib -- hll, --test pbt -- hll::, asapv1_golden, conformance_kit, msgpack_compat, sketches_go_parity_probe, xtest_consumer, e2e -- cardinality::, hll_custom_precision). Implemented and reviewed by separate agents; review findings are addressed in the second commit; the third adds the P14 goldens.

🤖 Generated with Claude Code

GordonYuanyc and others added 3 commits October 2, 2026 00:44
HyperLogLog serializes only as ASAPv1. Remove the portable HllSketch,
HllSketchDelta and HllVariant with the sparse-register helpers, the native
MessagePackCodec shims, the HLLDelta proto message and the SketchEnvelope
hll field (12, now reserved). HyperLogLogState stays for HydraCell.

Add HyperLogLogImpl::from_storage and HyperLogLogHIPImpl::from_storage, and
check the three HLL ASAPv1 goldens through the native types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Make the HLL wire DTOs, kind_id constants and metadata builder private to
wire.rs, state only what the remaining HLL proto messages are, shorten the
HIP registers_of doc, and drop a stray proptest regression file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump asapv1_golden to the commit adding hll_classic_p14, hll_ertl_mle_p14
and hll_hip_p14, built from fixed registers holding the maximum P14 rank,
and check each in both directions.

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