Skip to content

feat: impl CpcWrapper#101

Merged
tisonkun merged 2 commits intomainfrom
cpcwrapper
Feb 20, 2026
Merged

feat: impl CpcWrapper#101
tisonkun merged 2 commits intomainfrom
cpcwrapper

Conversation

@tisonkun
Copy link
Member

This closes #99.

Signed-off-by: tison <wander4096@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements CpcWrapper, a lightweight read-only view for extracting cardinality estimates from serialized CpcSketch data without performing full deserialization. This addresses issue #99 and aligns with similar implementations in the Go and Java DataSketches libraries.

Changes:

  • Adds CpcWrapper struct that parses only the preamble from serialized CPC sketches to extract estimation parameters
  • Refactors estimation logic from CpcSketch into shared functions in the estimator module for code reuse
  • Extracts serialization constants and utilities into a dedicated serialization module

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
datasketches/src/cpc/wrapper.rs Implements CpcWrapper with preamble-only parsing and estimation methods
datasketches/src/cpc/serialization.rs Extracts shared serialization constants (flags, version) and preamble calculation function
datasketches/src/cpc/estimator.rs Adds estimate/lower_bound/upper_bound wrapper functions and makes internal functions private
datasketches/src/cpc/sketch.rs Refactors to use shared estimator and serialization utilities
datasketches/src/cpc/mod.rs Adds serialization and wrapper modules, exports CpcWrapper
datasketches/tests/cpc_wrapper_test.rs Tests wrapper functionality with HIP and ICON modes, error handling
CHANGELOG.md Documents new CpcWrapper feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun enabled auto-merge (squash) February 20, 2026 11:07
@tisonkun tisonkun merged commit d6cc4bb into main Feb 20, 2026
9 checks passed
@tisonkun tisonkun deleted the cpcwrapper branch February 20, 2026 11:12
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.

Implement CpcWrapper

2 participants