Skip to content

refactor: migrate to asap_sketchlib module-restructure layout#335

Open
GordonYuanyc wants to merge 4 commits into
mainfrom
refactor/sketchlib-upgrade
Open

refactor: migrate to asap_sketchlib module-restructure layout#335
GordonYuanyc wants to merge 4 commits into
mainfrom
refactor/sketchlib-upgrade

Conversation

@GordonYuanyc
Copy link
Copy Markdown
Contributor

Summary

  • Bump asap_sketchlib pin to the refactor/module-restructure branch and adapt to the new module layout.
  • Accumulators now hold sketches::* types directly instead of going through the wire-format facade; serialization is centralized in a new sketchlib_runtime module.
  • Wire byte shape is preserved (CountMinSketch / KLL DTOs unchanged on the wire).

Status

Draft — pinned to a branch in asap_sketchlib, not a tagged release. Holding as draft until the upstream branch lands on its target.

Verification

  • cargo build clean
  • cargo test -p query_engine_rust sketch → 41 passed, 0 failed
  • cargo clippy -p query_engine_rust --lib clean apart from 2 pre-existing needless_range_loop style warnings in sketchlib_runtime.rs

Test plan

  • CI green
  • Re-pin asap_sketchlib to a merged commit on its target branch before marking ready
  • (Optional) clear the two clippy style warnings in sketchlib_runtime.rs

🤖 Generated with Claude Code

GordonYuanyc and others added 4 commits May 11, 2026 20:52
asap_sketchlib reorganized in the refactor/module-restructure branch:
- Wire-format-aligned types (CountMinSketch, CountSketch, KllSketch,
  HydraKllSketch, SetAggregator, DeltaResult, CmsHeapItem, etc.) moved
  out of `sketches::*` submodules and now live in `wrapper::*`,
  re-exported at the crate root.
- `sketches::delta_set_aggregator::{serialize,deserialize}_msgpack` shims
  were dropped in favor of the `MessagePackCodec` trait on `DeltaResult`.

Changes:
- Pin asap_sketchlib to the refactor/module-restructure branch.
- Switch all `use asap_sketchlib::sketches::*` imports to the
  crate-root re-exports (`use asap_sketchlib::CountMinSketch`, etc.).
- `delta_set_aggregator_accumulator` uses
  `DeltaResult::{from_msgpack,to_msgpack}` directly through the
  `MessagePackCodec` trait instead of the removed module-level shims.

No behavior change — the wire format and runtime semantics of the
underlying sketches are identical (locked in by sketchlib-go parity
goldens in asap_sketchlib's tests/sketches_go_parity_probe.rs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Picks up the asap_sketchlib `bfe8f37` cleanup that deletes
`mod wrapper` and moves all wire-format-aligned sketch types
(`CountMinSketch`, `CountSketch`, `KllSketch`, `HllSketch`,
`DdSketch`, `HydraKllSketch`, `CountMinSketchWithHeap`,
`SetAggregator`, `DeltaResult`) into
`asap_sketchlib::message_pack_format::portable::*`. The crate-root
re-exports that this crate imports are preserved unchanged, so no
source changes are needed on this side.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CountMinSketchAccumulator and DatasketchesKLLAccumulator previously
held the wire-format facade types (`asap_sketchlib::CountMinSketch`,
`asap_sketchlib::KllSketch`), each of which is a thin shim around an
underlying `sketches::*` runtime sketch. With Go byte parity proven
for the underlying types in `asap_sketchlib::tests::sketches_go_parity_probe`,
the facade layer is no longer required.

- New `precompute_operators::sketchlib_runtime` module exposes thin
  adapters (`cms_*` / `kll_*`) that translate the accumulator surface
  (string keys, `Vec<Vec<f64>>` matrices, Go-compatible MessagePack
  envelopes) onto `sketches::CountMin<Vector2D<f64>, FastPath,
  DefaultXxHasher>` and `sketches::KLL<f64>` directly.
- `CountMinSketchAccumulator.inner` becomes
  `sketches::CountMin<.., FastPath>`; `DatasketchesKLLAccumulator.inner`
  becomes `sketches::KLL<f64>`. JSON / msgpack / merge paths route
  through the new helpers.
- Wire format stays unchanged: the `CountMinSketchWire { sketch,
  row_num, col_num }` and `KllSketchData { k, sketch_bytes }`
  envelopes are still emitted, just constructed inline instead of
  through the facade's `to_msgpack`.
- A handful of `inner.k` field accesses change to `inner.k()` (KLL's
  `k` is private in `sketches::*` and exposed via accessor).
- Bump `asap_sketchlib` pin to `aea7d05` for the new
  `sketches::KLL::k()` accessor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@GordonYuanyc GordonYuanyc marked this pull request as ready for review May 12, 2026 04:48
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