Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 1 addition & 150 deletions asap-precompute-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion asap-precompute-rs/src/otap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ fn build_dispatch(config: &PluginConfig) -> Result<SketchDispatch, ConfigError>
sketch_type: SketchType::HLLSketch,
factory: Box::new(move || {
Box::new(HLLWrapper::new(
asap_sketchlib::sketches::HllVariant::Regular,
asap_sketchlib::HllVariant::Regular,
precision as u32,
))
}),
Expand Down
4 changes: 2 additions & 2 deletions asap-precompute-rs/src/sketches/cms.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! CountMinSketch wrapper over [`asap_sketchlib::sketches::CountMinSketch`].
//! CountMinSketch wrapper over [`asap_sketchlib::CountMinSketch`].
//!
//! Mirrors `asap-precompute-go/sketches/cms.go`. Implements
//! [`Sketch`] + [`FrequencySketch`].

use asap_sketchlib::proto::sketchlib::{
sketch_envelope, CountMinState, CounterType, SketchEnvelope as ProtoEnvelope,
};
use asap_sketchlib::sketches::CountMinSketch;
use asap_sketchlib::CountMinSketch;
use prost::Message;

use crate::observation::ObservationValue;
Expand Down
4 changes: 2 additions & 2 deletions asap-precompute-rs/src/sketches/countsketch.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! CountSketch wrapper over [`asap_sketchlib::sketches::CountSketch`].
//! CountSketch wrapper over [`asap_sketchlib::CountSketch`].
//!
//! Mirrors `asap-precompute-go/sketches/countsketch.go`. Implements
//! [`Sketch`] + [`FrequencySketch`].

use asap_sketchlib::proto::sketchlib::{
sketch_envelope, CountSketchState, CounterType, SketchEnvelope as ProtoEnvelope,
};
use asap_sketchlib::sketches::CountSketch;
use asap_sketchlib::CountSketch;
use prost::Message;

use crate::observation::ObservationValue;
Expand Down
4 changes: 2 additions & 2 deletions asap-precompute-rs/src/sketches/ddsketch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! DDSketch wrapper over [`asap_sketchlib::sketches::DdSketch`].
//! DDSketch wrapper over [`asap_sketchlib::DdSketch`].
//!
//! Mirrors `asap-precompute-go/sketches/ddsketch.go`. Adapts the
//! wire-format-aligned `DdSketch` struct to the host-neutral
Expand All @@ -7,7 +7,7 @@
use asap_sketchlib::proto::sketchlib::{
sketch_envelope, DdSketchState, SketchEnvelope as ProtoEnvelope,
};
use asap_sketchlib::sketches::DdSketch;
use asap_sketchlib::DdSketch;
use prost::Message;

use crate::observation::ObservationValue;
Expand Down
8 changes: 6 additions & 2 deletions asap-precompute-rs/src/sketches/hll.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! HLL wrapper over [`asap_sketchlib::sketches::HllSketch`].
//! HLL wrapper over [`asap_sketchlib::HllSketch`].
//!
//! Mirrors `asap-precompute-go/sketches/hll.go`. HLL is the canonical
//! [`CardinalitySketch`] implementation in this crate.

use asap_sketchlib::proto::sketchlib::{
sketch_envelope, HllVariant, HyperLogLogState, SketchEnvelope as ProtoEnvelope,
};
use asap_sketchlib::sketches::{HllSketch, HllVariant as RsHllVariant};
use asap_sketchlib::{HllSketch, HllVariant as RsHllVariant};
use prost::Message;

use crate::observation::ObservationValue;
Expand Down Expand Up @@ -54,6 +54,10 @@ impl HLLWrapper {
hip_kxq0: self.sk.hip_kxq0,
hip_kxq1: self.sk.hip_kxq1,
hip_est: self.sk.hip_est,
// Emit the dense register encoding (tag 3); the sparse
// encoding (tag 7) is left unset, matching the existing
// wire form.
registers_sparse: None,
}
}

Expand Down
7 changes: 7 additions & 0 deletions asap-precompute-rs/src/sketches/kll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ impl KLLWrapper {
bit_cache,
remaining_bits,
}),
// Emit the raw-f64 item representation (field 5); the
// value-offset fixed-point encoding (offset/value_scale/
// residuals, fields 7-9) is left at its off defaults so the
// wire form is unchanged.
offset: 0.0,
value_scale: 0,
residuals: Vec::new(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions asap-precompute-rs/tests/cross_language_parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn hll_byte_parity_with_go() {
// Both producers reach `insert_with_hash` with the same `u64` because
// `sketchlib-go::common.FromBytes` and `asap_sketchlib::HllSketch::update`
// both route through `xxh3_64(seed=seedList[CanonicalHashSeed=5], key)`.
let mut w = HLLWrapper::new(asap_sketchlib::sketches::HllVariant::Datafusion, 14);
let mut w = HLLWrapper::new(asap_sketchlib::HllVariant::Datafusion, 14);
for v in deterministic_floats() {
// Go's HLLObserver routes float observations through
// HyperLogLog.UpdateValue(double). Mirror by hashing the
Expand Down Expand Up @@ -164,7 +164,7 @@ fn golden_fixtures_when_present_are_nonempty() {
fn rust_wrappers_produce_nonempty_envelopes_for_same_input() {
let mut dd = DDSketchWrapper::new(0.01);
let mut kll = KLLWrapper::new(200, Some(42));
let mut hll = HLLWrapper::new(asap_sketchlib::sketches::HllVariant::Regular, 14);
let mut hll = HLLWrapper::new(asap_sketchlib::HllVariant::Regular, 14);
let mut cs = CountSketchWrapper::new(3, 512);
let mut cms = CMSWrapper::new(4, 2048);

Expand Down
2 changes: 1 addition & 1 deletion asap-precompute-rs/tests/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ mod real_sketch {
fn hll_factory() -> Box<dyn Fn() -> Box<dyn Sketch> + Send + Sync> {
Box::new(|| {
Box::new(HLLWrapper::new(
asap_sketchlib::sketches::HllVariant::Regular,
asap_sketchlib::HllVariant::Regular,
12,
)) as Box<dyn Sketch>
})
Expand Down