diff --git a/asap-precompute-rs/Cargo.lock b/asap-precompute-rs/Cargo.lock index 3df805c56..09f8a7905 100644 --- a/asap-precompute-rs/Cargo.lock +++ b/asap-precompute-rs/Cargo.lock @@ -16,15 +16,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -109,12 +100,10 @@ dependencies = [ [[package]] name = "asap_sketchlib" -version = "0.1.0" +version = "0.2.2" dependencies = [ "bytes", "prost", - "prost-build", - "protoc-bin-vendored", "rand", "rmp-serde", "serde", @@ -257,12 +246,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - [[package]] name = "fnv" version = "1.0.7" @@ -557,12 +540,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "multimap" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" - [[package]] name = "num" version = "0.4.3" @@ -666,16 +643,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "petgraph" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" -dependencies = [ - "fixedbitset", - "indexmap", -] - [[package]] name = "pin-project-lite" version = "0.2.17" @@ -739,26 +706,6 @@ dependencies = [ "prost-derive", ] -[[package]] -name = "prost-build" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" -dependencies = [ - "heck", - "itertools", - "log", - "multimap", - "once_cell", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn", - "tempfile", -] - [[package]] name = "prost-derive" version = "0.13.5" @@ -772,79 +719,6 @@ dependencies = [ "syn", ] -[[package]] -name = "prost-types" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" -dependencies = [ - "prost", -] - -[[package]] -name = "protoc-bin-vendored" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa" -dependencies = [ - "protoc-bin-vendored-linux-aarch_64", - "protoc-bin-vendored-linux-ppcle_64", - "protoc-bin-vendored-linux-s390_64", - "protoc-bin-vendored-linux-x86_32", - "protoc-bin-vendored-linux-x86_64", - "protoc-bin-vendored-macos-aarch_64", - "protoc-bin-vendored-macos-x86_64", - "protoc-bin-vendored-win32", -] - -[[package]] -name = "protoc-bin-vendored-linux-aarch_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c" - -[[package]] -name = "protoc-bin-vendored-linux-ppcle_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c" - -[[package]] -name = "protoc-bin-vendored-linux-s390_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0" - -[[package]] -name = "protoc-bin-vendored-linux-x86_32" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5" - -[[package]] -name = "protoc-bin-vendored-linux-x86_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78" - -[[package]] -name = "protoc-bin-vendored-macos-aarch_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092" - -[[package]] -name = "protoc-bin-vendored-macos-x86_64" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756" - -[[package]] -name = "protoc-bin-vendored-win32" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3" - [[package]] name = "quick-error" version = "1.2.3" @@ -919,29 +793,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "regex" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - [[package]] name = "regex-syntax" version = "0.8.10" diff --git a/asap-precompute-rs/src/otap/config.rs b/asap-precompute-rs/src/otap/config.rs index 9dff938d3..b2d53ddf8 100644 --- a/asap-precompute-rs/src/otap/config.rs +++ b/asap-precompute-rs/src/otap/config.rs @@ -223,7 +223,7 @@ fn build_dispatch(config: &PluginConfig) -> Result sketch_type: SketchType::HLLSketch, factory: Box::new(move || { Box::new(HLLWrapper::new( - asap_sketchlib::sketches::HllVariant::Regular, + asap_sketchlib::HllVariant::Regular, precision as u32, )) }), diff --git a/asap-precompute-rs/src/sketches/cms.rs b/asap-precompute-rs/src/sketches/cms.rs index db3127463..6230e7c35 100644 --- a/asap-precompute-rs/src/sketches/cms.rs +++ b/asap-precompute-rs/src/sketches/cms.rs @@ -1,4 +1,4 @@ -//! CountMinSketch wrapper over [`asap_sketchlib::sketches::CountMinSketch`]. +//! CountMinSketch wrapper over [`asap_sketchlib::CountMinSketch`]. //! //! Mirrors `asap-precompute-go/sketches/cms.go`. Implements //! [`Sketch`] + [`FrequencySketch`]. @@ -6,7 +6,7 @@ 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; diff --git a/asap-precompute-rs/src/sketches/countsketch.rs b/asap-precompute-rs/src/sketches/countsketch.rs index 08102dddf..cc8a5b9dd 100644 --- a/asap-precompute-rs/src/sketches/countsketch.rs +++ b/asap-precompute-rs/src/sketches/countsketch.rs @@ -1,4 +1,4 @@ -//! CountSketch wrapper over [`asap_sketchlib::sketches::CountSketch`]. +//! CountSketch wrapper over [`asap_sketchlib::CountSketch`]. //! //! Mirrors `asap-precompute-go/sketches/countsketch.go`. Implements //! [`Sketch`] + [`FrequencySketch`]. @@ -6,7 +6,7 @@ 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; diff --git a/asap-precompute-rs/src/sketches/ddsketch.rs b/asap-precompute-rs/src/sketches/ddsketch.rs index 212e84ed3..911e48a35 100644 --- a/asap-precompute-rs/src/sketches/ddsketch.rs +++ b/asap-precompute-rs/src/sketches/ddsketch.rs @@ -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 @@ -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; diff --git a/asap-precompute-rs/src/sketches/hll.rs b/asap-precompute-rs/src/sketches/hll.rs index 38e3bd212..0cb894225 100644 --- a/asap-precompute-rs/src/sketches/hll.rs +++ b/asap-precompute-rs/src/sketches/hll.rs @@ -1,4 +1,4 @@ -//! 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. @@ -6,7 +6,7 @@ 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; @@ -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, } } diff --git a/asap-precompute-rs/src/sketches/kll.rs b/asap-precompute-rs/src/sketches/kll.rs index 698424064..223c32ec6 100644 --- a/asap-precompute-rs/src/sketches/kll.rs +++ b/asap-precompute-rs/src/sketches/kll.rs @@ -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(), } } diff --git a/asap-precompute-rs/tests/cross_language_parity.rs b/asap-precompute-rs/tests/cross_language_parity.rs index 07243a395..bf618203a 100644 --- a/asap-precompute-rs/tests/cross_language_parity.rs +++ b/asap-precompute-rs/tests/cross_language_parity.rs @@ -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 @@ -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); diff --git a/asap-precompute-rs/tests/runtime.rs b/asap-precompute-rs/tests/runtime.rs index 059ee0e31..8f295d6e7 100644 --- a/asap-precompute-rs/tests/runtime.rs +++ b/asap-precompute-rs/tests/runtime.rs @@ -830,7 +830,7 @@ mod real_sketch { fn hll_factory() -> Box Box + Send + Sync> { Box::new(|| { Box::new(HLLWrapper::new( - asap_sketchlib::sketches::HllVariant::Regular, + asap_sketchlib::HllVariant::Regular, 12, )) as Box })