This is an automated email from the ASF dual-hosted git repository.
tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
The following commit(s) were added to refs/heads/main by this push:
new ebee716 refactor(theta,tuple): move JaccardSimilarity to common and
remove thetacommon (#350)
ebee716 is described below
commit ebee7161059136e2428ab771c09b93d6d415e363
Author: tison <[email protected]>
AuthorDate: Thu Nov 12 12:29:39 2026 +0800
refactor(theta,tuple): move JaccardSimilarity to common and remove
thetacommon (#350)
---
CHANGELOG.md | 1 +
datasketches/src/common/jaccard_similarity.rs | 57 ++++++++++
datasketches/src/common/mod.rs | 2 +
datasketches/src/lib.rs | 2 -
datasketches/src/thetafamily/common/a_not_b.rs | 12 +-
datasketches/src/thetafamily/common/hash_table.rs | 12 +-
.../src/thetafamily/common/intersection.rs | 14 +--
.../src/thetafamily/common/jaccard_similarity.rs | 125 ++++++---------------
datasketches/src/thetafamily/common/mod.rs | 2 -
.../src/thetafamily/common/sketch_state.rs | 4 +-
datasketches/src/thetafamily/common/union.rs | 12 +-
datasketches/src/thetafamily/mod.rs | 2 +-
datasketches/src/thetafamily/theta/a_not_b.rs | 2 +-
datasketches/src/thetafamily/theta/hash_table.rs | 6 +-
datasketches/src/thetafamily/theta/intersection.rs | 4 +-
.../src/thetafamily/theta/jaccard_similarity.rs | 4 +-
.../src/thetafamily/theta/serialization.rs | 10 +-
datasketches/src/thetafamily/theta/sketch.rs | 28 ++---
datasketches/src/thetafamily/theta/union.rs | 6 +-
datasketches/src/thetafamily/tuple/a_not_b.rs | 2 +-
datasketches/src/thetafamily/tuple/hash_table.rs | 10 +-
datasketches/src/thetafamily/tuple/intersection.rs | 2 +-
.../src/thetafamily/tuple/jaccard_similarity.rs | 4 +-
.../src/thetafamily/tuple/serialization.rs | 8 +-
datasketches/src/thetafamily/tuple/sketch.rs | 24 ++--
datasketches/src/thetafamily/tuple/union.rs | 4 +-
.../tests/theta_test/jaccard_similarity.rs | 2 +-
.../tests/tuple_test/jaccard_similarity.rs | 2 +-
28 files changed, 181 insertions(+), 182 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5eb32a0..b44d263 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ All significant changes to this project will be documented in
this file.
* `BloomFilter::contains` and `BloomFilter::contains_and_insert` now take
`item: T` (`T: Hash`) by value instead of `&T`, matching `BloomFilter::insert`.
Pass `&item` to retain owned values such as `String` or `Vec<u8>` without
cloning, and remove explicit turbofish type arguments (or change `T` to `&T`)
on borrowed calls such as `contains::<u64>(&value)`.
* `CountMinSketch::new` and `CountMinSketch::with_seed` now create serial
version 2 sketches, require `num_hashes` in `1..=127`, and emit images that
require a version 2 reader. Version 2 enables cross-language interchange when
using `i64` counters and the documented input encodings, while existing version
1 images remain readable, updatable, and serializable as version 1.
`CountMinSketch::merge` rejects mixing version 1 and version 2 sketches;
upgrade readers before writers and rebuild [...]
* `CpcSketch::max_serialized_bytes` and `ReqSketch::serialized_size_bytes` are
removed; serialize the sketch and inspect `len()` on the returned byte buffer
when the encoded size is needed.
+* `ThetaJaccardSimilarity::compute` and `TupleJaccardSimilarity::compute` now
return `datasketches::common::JaccardSimilarity` instead of
`datasketches::thetacommon::JaccardSimilarity`, and `datasketches::thetacommon`
is no longer part of the public API.
* `FrequentItemsSketch::update_with_count` and
`FrequentItemsSketch::update_with_count_ref` are renamed to
`update_with_weight` and `update_with_weight_ref` to match weighted update
naming across the crate.
### New features
diff --git a/datasketches/src/common/jaccard_similarity.rs
b/datasketches/src/common/jaccard_similarity.rs
new file mode 100644
index 0000000..e253226
--- /dev/null
+++ b/datasketches/src/common/jaccard_similarity.rs
@@ -0,0 +1,57 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+/// Jaccard similarity estimate and confidence bounds for two sketches.
+///
+/// The bounds use a 95.4% confidence interval, equivalent to +/- 2 standard
deviations.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct JaccardSimilarity {
+ lower_bound: f64,
+ estimate: f64,
+ upper_bound: f64,
+}
+
+impl JaccardSimilarity {
+ #[cfg(any(feature = "theta", feature = "tuple"))]
+ pub(crate) const fn new(lower_bound: f64, estimate: f64, upper_bound: f64)
-> Self {
+ Self {
+ lower_bound,
+ estimate,
+ upper_bound,
+ }
+ }
+
+ #[cfg(any(feature = "theta", feature = "tuple"))]
+ pub(crate) const fn exact(value: f64) -> Self {
+ Self::new(value, value, value)
+ }
+
+ /// Returns the approximate lower bound for the Jaccard index.
+ pub fn lower_bound(&self) -> f64 {
+ self.lower_bound
+ }
+
+ /// Returns the estimate of the Jaccard index.
+ pub fn estimate(&self) -> f64 {
+ self.estimate
+ }
+
+ /// Returns the approximate upper bound for the Jaccard index.
+ pub fn upper_bound(&self) -> f64 {
+ self.upper_bound
+ }
+}
diff --git a/datasketches/src/common/mod.rs b/datasketches/src/common/mod.rs
index 232f830..dce8a56 100644
--- a/datasketches/src/common/mod.rs
+++ b/datasketches/src/common/mod.rs
@@ -17,9 +17,11 @@
//! Data structures and functions that may be used across all the sketch
families.
+mod jaccard_similarity;
mod num_std_dev;
mod resize;
mod search_criteria;
+pub use self::jaccard_similarity::JaccardSimilarity;
pub use self::num_std_dev::NumStdDev;
pub use self::resize::ResizeFactor;
pub use self::search_criteria::SearchCriteria;
diff --git a/datasketches/src/lib.rs b/datasketches/src/lib.rs
index bc77ea8..5e831f2 100644
--- a/datasketches/src/lib.rs
+++ b/datasketches/src/lib.rs
@@ -85,8 +85,6 @@ pub mod req;
pub mod tdigest;
#[cfg(any(feature = "theta", feature = "tuple"))]
mod thetafamily;
-#[cfg(any(feature = "theta", feature = "tuple"))]
-pub use self::thetafamily::common as thetacommon;
#[cfg(feature = "theta")]
pub use self::thetafamily::theta;
#[cfg(feature = "tuple")]
diff --git a/datasketches/src/thetafamily/common/a_not_b.rs
b/datasketches/src/thetafamily/common/a_not_b.rs
index cab8e58..34c9c62 100644
--- a/datasketches/src/thetafamily/common/a_not_b.rs
+++ b/datasketches/src/thetafamily/common/a_not_b.rs
@@ -23,12 +23,12 @@ use crate::common::random::random_u64;
use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::check_seed_hash;
-use crate::thetacommon::EntrySketch;
-use crate::thetacommon::KeySketch;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::sketch_state::CompactSketchState;
-use crate::thetacommon::sketch_state::ThetaFamilySketchMetadata;
+use crate::thetafamily::common::EntrySketch;
+use crate::thetafamily::common::KeySketch;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
+use crate::thetafamily::common::sketch_state::ThetaFamilySketchMetadata;
/// Computes `a and not b` for Theta-family sketch views.
///
diff --git a/datasketches/src/thetafamily/common/hash_table.rs
b/datasketches/src/thetafamily/common/hash_table.rs
index 9403d64..016ebaf 100644
--- a/datasketches/src/thetafamily/common/hash_table.rs
+++ b/datasketches/src/thetafamily/common/hash_table.rs
@@ -24,12 +24,12 @@ use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::MurmurHash3X64128;
use crate::hash::compute_seed_hash;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::constants::MAX_LG_K;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::constants::MIN_LG_K;
-use crate::thetacommon::constants::STRIDE_MASK;
-use crate::thetacommon::sketch_state::CompactSketchState;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::constants::MAX_LG_K;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::constants::MIN_LG_K;
+use crate::thetafamily::common::constants::STRIDE_MASK;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
pub struct SketchHashTableIter<'a, E> {
iter: slice::Iter<'a, Option<E>>,
diff --git a/datasketches/src/thetafamily/common/intersection.rs
b/datasketches/src/thetafamily/common/intersection.rs
index c7db3c4..b58992a 100644
--- a/datasketches/src/thetafamily/common/intersection.rs
+++ b/datasketches/src/thetafamily/common/intersection.rs
@@ -21,13 +21,13 @@ use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::check_seed_hash;
use crate::hash::compute_seed_hash;
-use crate::thetacommon::EntrySketch;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::constants::HASH_TABLE_REBUILD_THRESHOLD;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::sketch_state::CompactSketchState;
-use crate::thetacommon::sketch_state::ThetaFamilySketchMetadata;
+use crate::thetafamily::common::EntrySketch;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::constants::HASH_TABLE_REBUILD_THRESHOLD;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
+use crate::thetafamily::common::sketch_state::ThetaFamilySketchMetadata;
/// Merges an incoming entry into an existing entry with the same hash.
///
diff --git a/datasketches/src/thetafamily/common/jaccard_similarity.rs
b/datasketches/src/thetafamily/common/jaccard_similarity.rs
index 2d16331..9910503 100644
--- a/datasketches/src/thetafamily/common/jaccard_similarity.rs
+++ b/datasketches/src/thetafamily/common/jaccard_similarity.rs
@@ -15,99 +15,30 @@
// specific language governing permissions and limitations
// under the License.
+use crate::common::JaccardSimilarity;
use crate::common::ResizeFactor;
use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::check_seed_hash;
use crate::hash::compute_seed_hash;
-use crate::thetacommon::EntrySketch;
-use crate::thetacommon::KeySketch;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::binomial_bounds;
-use crate::thetacommon::constants::MAX_LG_K;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::constants::MIN_LG_K;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::intersection::IntersectionMergePolicy;
-use crate::thetacommon::intersection::IntersectionState;
-use crate::thetacommon::sketch_state::CompactSketchState;
-use crate::thetacommon::sketch_state::ThetaFamilySketchMetadata;
-use crate::thetacommon::sketch_state::sort_copy_by_hash;
-use crate::thetacommon::union::UnionMergePolicy;
-use crate::thetacommon::union::UnionState;
+use crate::thetafamily::common::EntrySketch;
+use crate::thetafamily::common::KeySketch;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::binomial_bounds;
+use crate::thetafamily::common::constants::MAX_LG_K;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::constants::MIN_LG_K;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::intersection::IntersectionMergePolicy;
+use crate::thetafamily::common::intersection::IntersectionState;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
+use crate::thetafamily::common::sketch_state::ThetaFamilySketchMetadata;
+use crate::thetafamily::common::sketch_state::sort_copy_by_hash;
+use crate::thetafamily::common::union::UnionMergePolicy;
+use crate::thetafamily::common::union::UnionState;
const NUM_STD_DEVS: f64 = 2.0;
-/// Jaccard similarity estimate and confidence bounds for two Theta-family
sketches.
-///
-/// The bounds use a 95.4% confidence interval, equivalent to +/- 2 standard
deviations.
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub struct JaccardSimilarity {
- lower_bound: f64,
- estimate: f64,
- upper_bound: f64,
-}
-
-impl JaccardSimilarity {
- /// Returns the approximate lower bound for the Jaccard index.
- pub fn lower_bound(&self) -> f64 {
- self.lower_bound
- }
-
- /// Returns the estimate of the Jaccard index.
- pub fn estimate(&self) -> f64 {
- self.estimate
- }
-
- /// Returns the approximate upper bound for the Jaccard index.
- pub fn upper_bound(&self) -> f64 {
- self.upper_bound
- }
-
- fn exact(value: f64) -> Self {
- Self {
- lower_bound: value,
- estimate: value,
- upper_bound: value,
- }
- }
-
- fn ratio_bounds(union_count: u64, intersection_count: u64, theta: u64) ->
Result<Self, Error> {
- if intersection_count > union_count {
- return Err(Error::invalid_argument(format!(
- "intersection count cannot exceed union count:
{intersection_count} > {union_count}"
- )));
- }
- if union_count == 0 {
- return Ok(Self {
- lower_bound: 0.0,
- estimate: 0.5,
- upper_bound: 1.0,
- });
- }
-
- let sampling_probability = theta as f64 / MAX_THETA as f64;
- if theta == MAX_THETA {
- return Ok(Self::exact(intersection_count as f64 / union_count as
f64));
- }
-
- let adjustment = NUM_STD_DEVS *
sampling_adjuster(sampling_probability);
- Ok(Self {
- lower_bound: binomial_bounds::approximate_lower_bound_on_p(
- union_count,
- intersection_count,
- adjustment,
- )?,
- estimate: intersection_count as f64 / union_count as f64,
- upper_bound: binomial_bounds::approximate_upper_bound_on_p(
- union_count,
- intersection_count,
- adjustment,
- )?,
- })
- }
-}
-
#[derive(Clone, Copy, Debug)]
struct KeyEntry {
hash: u64,
@@ -185,6 +116,11 @@ where
return Ok(JaccardSimilarity::exact(1.0));
}
+ let union_count = union.retained_entries().len() as u64;
+ if union_count == 0 {
+ return Ok(JaccardSimilarity::new(0.0, 0.5, 1.0));
+ }
+
let mut intersection = IntersectionState::new(seed, NoopMergePolicy)?;
intersection.update(KeyEntries(sketch_a))?;
intersection.update(KeyEntries(sketch_b))?;
@@ -196,13 +132,20 @@ where
.retained_entries()
.iter()
.filter(|entry| entry.hash < union_theta)
- .count();
+ .count() as u64;
+
+ let estimate = intersection_count as f64 / union_count as f64;
+ if union_theta == MAX_THETA {
+ return Ok(JaccardSimilarity::exact(estimate));
+ }
- JaccardSimilarity::ratio_bounds(
- union.retained_entries().len() as u64,
- intersection_count as u64,
- union_theta,
- )
+ let sampling_probability = union_theta as f64 / MAX_THETA as f64;
+ let adjustment = NUM_STD_DEVS * sampling_adjuster(sampling_probability);
+ Ok(JaccardSimilarity::new(
+ binomial_bounds::approximate_lower_bound_on_p(union_count,
intersection_count, adjustment)?,
+ estimate,
+ binomial_bounds::approximate_upper_bound_on_p(union_count,
intersection_count, adjustment)?,
+ ))
}
pub fn exactly_equal<A, B>(seed: u64, sketch_a: A, sketch_b: B) ->
Result<bool, Error>
diff --git a/datasketches/src/thetafamily/common/mod.rs
b/datasketches/src/thetafamily/common/mod.rs
index acf8ceb..0b773e8 100644
--- a/datasketches/src/thetafamily/common/mod.rs
+++ b/datasketches/src/thetafamily/common/mod.rs
@@ -26,8 +26,6 @@ pub(super) mod jaccard_similarity;
pub(super) mod sketch_state;
pub(super) mod union;
-pub use self::jaccard_similarity::JaccardSimilarity;
-
/// Minimal entry behavior required by the shared hash table, compaction, and
set operations.
pub(super) trait SketchEntry: Sized {
fn hash(&self) -> u64;
diff --git a/datasketches/src/thetafamily/common/sketch_state.rs
b/datasketches/src/thetafamily/common/sketch_state.rs
index c04c724..0619379 100644
--- a/datasketches/src/thetafamily/common/sketch_state.rs
+++ b/datasketches/src/thetafamily/common/sketch_state.rs
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::constants::MAX_THETA;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::constants::MAX_THETA;
/// Observable metadata consumed by shared Theta-family set operations.
///
diff --git a/datasketches/src/thetafamily/common/union.rs
b/datasketches/src/thetafamily/common/union.rs
index 4ff6336..5e2e478 100644
--- a/datasketches/src/thetafamily/common/union.rs
+++ b/datasketches/src/thetafamily/common/union.rs
@@ -21,12 +21,12 @@ use crate::common::ResizeFactor;
use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::check_seed_hash;
-use crate::thetacommon::EntrySketch;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::sketch_state::CompactSketchState;
-use crate::thetacommon::sketch_state::ThetaFamilySketchMetadata;
+use crate::thetafamily::common::EntrySketch;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
+use crate::thetafamily::common::sketch_state::ThetaFamilySketchMetadata;
/// Merges an incoming entry into an existing entry with the same hash.
pub trait UnionMergePolicy<E> {
diff --git a/datasketches/src/thetafamily/mod.rs
b/datasketches/src/thetafamily/mod.rs
index 6f4d8cc..755f29b 100644
--- a/datasketches/src/thetafamily/mod.rs
+++ b/datasketches/src/thetafamily/mod.rs
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-pub mod common;
+mod common;
#[cfg(feature = "theta")]
pub mod theta;
#[cfg(feature = "tuple")]
diff --git a/datasketches/src/thetafamily/theta/a_not_b.rs
b/datasketches/src/thetafamily/theta/a_not_b.rs
index 7f89b86..43fe4f9 100644
--- a/datasketches/src/thetafamily/theta/a_not_b.rs
+++ b/datasketches/src/thetafamily/theta/a_not_b.rs
@@ -27,7 +27,7 @@ use crate::hash::DEFAULT_UPDATE_SEED;
use crate::hash::compute_seed_hash;
use crate::theta::CompactThetaSketch;
use crate::theta::ThetaSketchView;
-use crate::thetacommon::a_not_b;
+use crate::thetafamily::common::a_not_b;
/// Set difference operator (`A and not B`) for Theta sketches.
///
diff --git a/datasketches/src/thetafamily/theta/hash_table.rs
b/datasketches/src/thetafamily/theta/hash_table.rs
index cc69cb1..fd039c9 100644
--- a/datasketches/src/thetafamily/theta/hash_table.rs
+++ b/datasketches/src/thetafamily/theta/hash_table.rs
@@ -18,9 +18,9 @@
use std::hash::Hash;
use std::num::NonZeroU64;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::sketch_state::sort_copy_by_hash;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::sketch_state::sort_copy_by_hash;
/// Specific hash table for theta sketch
///
diff --git a/datasketches/src/thetafamily/theta/intersection.rs
b/datasketches/src/thetafamily/theta/intersection.rs
index 3425aed..2d9510b 100644
--- a/datasketches/src/thetafamily/theta/intersection.rs
+++ b/datasketches/src/thetafamily/theta/intersection.rs
@@ -22,8 +22,8 @@ use crate::hash::DEFAULT_UPDATE_SEED;
use crate::theta::CompactThetaSketch;
use crate::theta::ThetaSketchView;
use crate::theta::hash_table::ThetaEntry;
-use crate::thetacommon::intersection::IntersectionMergePolicy;
-use crate::thetacommon::intersection::IntersectionState;
+use crate::thetafamily::common::intersection::IntersectionMergePolicy;
+use crate::thetafamily::common::intersection::IntersectionState;
/// Stateful intersection operator for Theta sketches.
///
diff --git a/datasketches/src/thetafamily/theta/jaccard_similarity.rs
b/datasketches/src/thetafamily/theta/jaccard_similarity.rs
index ea6640d..bf1ce2e 100644
--- a/datasketches/src/thetafamily/theta/jaccard_similarity.rs
+++ b/datasketches/src/thetafamily/theta/jaccard_similarity.rs
@@ -17,13 +17,13 @@
//! Jaccard similarity for Theta sketches.
+use crate::common::JaccardSimilarity;
use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::DEFAULT_UPDATE_SEED;
use crate::hash::compute_seed_hash;
use crate::theta::ThetaSketchView;
-use crate::thetacommon::jaccard_similarity;
-use crate::thetacommon::jaccard_similarity::JaccardSimilarity;
+use crate::thetafamily::common::jaccard_similarity;
/// Jaccard similarity operator for Theta sketches.
///
diff --git a/datasketches/src/thetafamily/theta/serialization.rs
b/datasketches/src/thetafamily/theta/serialization.rs
index b25edcf..a36c5bd 100644
--- a/datasketches/src/thetafamily/theta/serialization.rs
+++ b/datasketches/src/thetafamily/theta/serialization.rs
@@ -19,11 +19,11 @@
use crate::codec::SketchBytes;
use crate::codec::family::Family;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::constants::FLAGS_IS_COMPACT;
-use crate::thetacommon::constants::FLAGS_IS_ORDERED;
-use crate::thetacommon::constants::FLAGS_IS_READ_ONLY;
-use crate::thetacommon::sketch_state::CompactSketchState;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::constants::FLAGS_IS_COMPACT;
+use crate::thetafamily::common::constants::FLAGS_IS_ORDERED;
+use crate::thetafamily::common::constants::FLAGS_IS_READ_ONLY;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
pub const UNCOMPRESSED_SERIAL_VERSION: u8 = 3;
pub const COMPRESSED_SERIAL_VERSION: u8 = 4;
diff --git a/datasketches/src/thetafamily/theta/sketch.rs
b/datasketches/src/thetafamily/theta/sketch.rs
index a973a20..5cbd381 100644
--- a/datasketches/src/thetafamily/theta/sketch.rs
+++ b/datasketches/src/thetafamily/theta/sketch.rs
@@ -43,20 +43,20 @@ use crate::theta::serialization;
use crate::theta::serialization::V2_PREAMBLE_EMPTY;
use crate::theta::serialization::V2_PREAMBLE_ESTIMATE;
use crate::theta::serialization::V2_PREAMBLE_PRECISE;
-use crate::thetacommon::EntrySketch;
-use crate::thetacommon::KeySketch;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::binomial_bounds;
-use crate::thetacommon::constants::DEFAULT_LG_K;
-use crate::thetacommon::constants::FLAGS_IS_COMPACT;
-use crate::thetacommon::constants::FLAGS_IS_EMPTY;
-use crate::thetacommon::constants::FLAGS_IS_ORDERED;
-use crate::thetacommon::constants::FLAGS_IS_READ_ONLY;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::hash_table::SketchHashTableIter;
-use crate::thetacommon::sketch_state::CompactSketchState;
-use crate::thetacommon::sketch_state::ThetaFamilySketchMetadata;
+use crate::thetafamily::common::EntrySketch;
+use crate::thetafamily::common::KeySketch;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::binomial_bounds;
+use crate::thetafamily::common::constants::DEFAULT_LG_K;
+use crate::thetafamily::common::constants::FLAGS_IS_COMPACT;
+use crate::thetafamily::common::constants::FLAGS_IS_EMPTY;
+use crate::thetafamily::common::constants::FLAGS_IS_ORDERED;
+use crate::thetafamily::common::constants::FLAGS_IS_READ_ONLY;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::hash_table::SketchHashTableIter;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
+use crate::thetafamily::common::sketch_state::ThetaFamilySketchMetadata;
/// Read-only view for Theta sketches.
///
diff --git a/datasketches/src/thetafamily/theta/union.rs
b/datasketches/src/thetafamily/theta/union.rs
index 3da51ed..ecac475 100644
--- a/datasketches/src/thetafamily/theta/union.rs
+++ b/datasketches/src/thetafamily/theta/union.rs
@@ -24,9 +24,9 @@ use crate::theta::CompactThetaSketch;
use crate::theta::ThetaSketchView;
use crate::theta::hash_table::ThetaEntry;
use crate::theta::serialization;
-use crate::thetacommon::constants::DEFAULT_LG_K;
-use crate::thetacommon::union::UnionMergePolicy;
-use crate::thetacommon::union::UnionState;
+use crate::thetafamily::common::constants::DEFAULT_LG_K;
+use crate::thetafamily::common::union::UnionMergePolicy;
+use crate::thetafamily::common::union::UnionState;
/// Stateful union operator for Theta sketches.
pub struct ThetaUnion {
diff --git a/datasketches/src/thetafamily/tuple/a_not_b.rs
b/datasketches/src/thetafamily/tuple/a_not_b.rs
index 58c3568..a6bd77b 100644
--- a/datasketches/src/thetafamily/tuple/a_not_b.rs
+++ b/datasketches/src/thetafamily/tuple/a_not_b.rs
@@ -26,7 +26,7 @@ use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::DEFAULT_UPDATE_SEED;
use crate::hash::compute_seed_hash;
-use crate::thetacommon::a_not_b;
+use crate::thetafamily::common::a_not_b;
use crate::tuple::sketch::CompactTupleSketch;
use crate::tuple::sketch::TupleSketchView;
diff --git a/datasketches/src/thetafamily/tuple/hash_table.rs
b/datasketches/src/thetafamily/tuple/hash_table.rs
index 2929317..35e9fc2 100644
--- a/datasketches/src/thetafamily/tuple/hash_table.rs
+++ b/datasketches/src/thetafamily/tuple/hash_table.rs
@@ -18,11 +18,11 @@
use std::hash::Hash;
use std::num::NonZeroU64;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::intersection::IntersectionMergePolicy;
-use crate::thetacommon::sketch_state::sort_niche_by_hash;
-use crate::thetacommon::union::UnionMergePolicy;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::intersection::IntersectionMergePolicy;
+use crate::thetafamily::common::sketch_state::sort_niche_by_hash;
+use crate::thetafamily::common::union::UnionMergePolicy;
use crate::tuple::SummaryCombinePolicy;
/// A retained entry in a Tuple sketch: a hash key together with its
associated summary.
diff --git a/datasketches/src/thetafamily/tuple/intersection.rs
b/datasketches/src/thetafamily/tuple/intersection.rs
index 28e6974..27aab35 100644
--- a/datasketches/src/thetafamily/tuple/intersection.rs
+++ b/datasketches/src/thetafamily/tuple/intersection.rs
@@ -29,7 +29,7 @@ use std::fmt;
use crate::error::Error;
use crate::hash::DEFAULT_UPDATE_SEED;
-use crate::thetacommon::intersection::IntersectionState;
+use crate::thetafamily::common::intersection::IntersectionState;
use crate::tuple::hash_table::TupleEntry;
use crate::tuple::policy::SummaryCombinePolicy;
use crate::tuple::sketch::CompactTupleSketch;
diff --git a/datasketches/src/thetafamily/tuple/jaccard_similarity.rs
b/datasketches/src/thetafamily/tuple/jaccard_similarity.rs
index 99a7c42..ee76dd3 100644
--- a/datasketches/src/thetafamily/tuple/jaccard_similarity.rs
+++ b/datasketches/src/thetafamily/tuple/jaccard_similarity.rs
@@ -17,12 +17,12 @@
//! Jaccard similarity for Tuple sketches.
+use crate::common::JaccardSimilarity;
use crate::error::Error;
use crate::error::ErrorKind;
use crate::hash::DEFAULT_UPDATE_SEED;
use crate::hash::compute_seed_hash;
-use crate::thetacommon::jaccard_similarity;
-use crate::thetacommon::jaccard_similarity::JaccardSimilarity;
+use crate::thetafamily::common::jaccard_similarity;
use crate::tuple::TupleSketchView;
/// Jaccard similarity operator for Tuple sketches.
diff --git a/datasketches/src/thetafamily/tuple/serialization.rs
b/datasketches/src/thetafamily/tuple/serialization.rs
index 7671661..245e39e 100644
--- a/datasketches/src/thetafamily/tuple/serialization.rs
+++ b/datasketches/src/thetafamily/tuple/serialization.rs
@@ -32,10 +32,10 @@ use crate::codec::SketchSlice;
use crate::codec::assert::insufficient_data;
use crate::codec::family::Family;
use crate::error::Error;
-use crate::thetacommon::constants::FLAGS_IS_COMPACT;
-use crate::thetacommon::constants::FLAGS_IS_ORDERED;
-use crate::thetacommon::constants::FLAGS_IS_READ_ONLY;
-use crate::thetacommon::sketch_state::CompactSketchState;
+use crate::thetafamily::common::constants::FLAGS_IS_COMPACT;
+use crate::thetafamily::common::constants::FLAGS_IS_ORDERED;
+use crate::thetafamily::common::constants::FLAGS_IS_READ_ONLY;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
use crate::tuple::hash_table::TupleEntry;
/// Current serial version written by this implementation.
diff --git a/datasketches/src/thetafamily/tuple/sketch.rs
b/datasketches/src/thetafamily/tuple/sketch.rs
index 0abeecc..06ac774 100644
--- a/datasketches/src/thetafamily/tuple/sketch.rs
+++ b/datasketches/src/thetafamily/tuple/sketch.rs
@@ -38,18 +38,18 @@ use crate::error::ErrorKind;
use crate::hash::DEFAULT_UPDATE_SEED;
use crate::hash::check_seed_hash;
use crate::hash::compute_seed_hash;
-use crate::thetacommon::EntrySketch;
-use crate::thetacommon::KeySketch;
-use crate::thetacommon::SketchEntry;
-use crate::thetacommon::binomial_bounds;
-use crate::thetacommon::constants::DEFAULT_LG_K;
-use crate::thetacommon::constants::FLAGS_IS_EMPTY;
-use crate::thetacommon::constants::FLAGS_IS_ORDERED;
-use crate::thetacommon::constants::MAX_THETA;
-use crate::thetacommon::hash_table::SketchHashTable;
-use crate::thetacommon::hash_table::SketchHashTableIter;
-use crate::thetacommon::sketch_state::CompactSketchState;
-use crate::thetacommon::sketch_state::ThetaFamilySketchMetadata;
+use crate::thetafamily::common::EntrySketch;
+use crate::thetafamily::common::KeySketch;
+use crate::thetafamily::common::SketchEntry;
+use crate::thetafamily::common::binomial_bounds;
+use crate::thetafamily::common::constants::DEFAULT_LG_K;
+use crate::thetafamily::common::constants::FLAGS_IS_EMPTY;
+use crate::thetafamily::common::constants::FLAGS_IS_ORDERED;
+use crate::thetafamily::common::constants::MAX_THETA;
+use crate::thetafamily::common::hash_table::SketchHashTable;
+use crate::thetafamily::common::hash_table::SketchHashTableIter;
+use crate::thetafamily::common::sketch_state::CompactSketchState;
+use crate::thetafamily::common::sketch_state::ThetaFamilySketchMetadata;
use crate::tuple::hash_table::TupleEntry;
use crate::tuple::hash_table::TupleHashTable;
use crate::tuple::policy::SummaryPolicy;
diff --git a/datasketches/src/thetafamily/tuple/union.rs
b/datasketches/src/thetafamily/tuple/union.rs
index 55d477d..f785bdd 100644
--- a/datasketches/src/thetafamily/tuple/union.rs
+++ b/datasketches/src/thetafamily/tuple/union.rs
@@ -27,8 +27,8 @@ use std::fmt;
use crate::common::ResizeFactor;
use crate::error::Error;
use crate::hash::DEFAULT_UPDATE_SEED;
-use crate::thetacommon::constants::DEFAULT_LG_K;
-use crate::thetacommon::union::UnionState;
+use crate::thetafamily::common::constants::DEFAULT_LG_K;
+use crate::thetafamily::common::union::UnionState;
use crate::tuple::hash_table::TupleEntry;
use crate::tuple::policy::SummaryCombinePolicy;
use crate::tuple::serialization::TupleSummaryValue;
diff --git a/tests-integration/tests/theta_test/jaccard_similarity.rs
b/tests-integration/tests/theta_test/jaccard_similarity.rs
index be29b75..6bf45bd 100644
--- a/tests-integration/tests/theta_test/jaccard_similarity.rs
+++ b/tests-integration/tests/theta_test/jaccard_similarity.rs
@@ -15,10 +15,10 @@
// specific language governing permissions and limitations
// under the License.
+use datasketches::common::JaccardSimilarity;
use datasketches::theta::ThetaJaccardSimilarity;
use datasketches::theta::ThetaSketch;
use datasketches::theta::ThetaSketchBuilder;
-use datasketches::thetacommon::JaccardSimilarity;
use googletest::assert_that;
use googletest::prelude::anything;
use googletest::prelude::err;
diff --git a/tests-integration/tests/tuple_test/jaccard_similarity.rs
b/tests-integration/tests/tuple_test/jaccard_similarity.rs
index 3d4b6f5..cdf0c2e 100644
--- a/tests-integration/tests/tuple_test/jaccard_similarity.rs
+++ b/tests-integration/tests/tuple_test/jaccard_similarity.rs
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-use datasketches::thetacommon::JaccardSimilarity;
+use datasketches::common::JaccardSimilarity;
use datasketches::tuple::DefaultUpdatePolicy;
use datasketches::tuple::TupleJaccardSimilarity;
use datasketches::tuple::TupleSketch;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]