This is an automated email from the ASF dual-hosted git repository.

tisonkun pushed a commit to branch codex/naming-drift-audit
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git

commit 1278d7b7afac14beb43ba9f60a00a156a7547503
Author: tison <[email protected]>
AuthorDate: Sat Jul 25 21:41:52 2026 +0800

    refactor: standardize set operation constructors
---
 CHANGELOG.md                                  |  3 ++
 datasketches/src/theta/a_not_b.rs             | 15 ++++---
 datasketches/src/theta/intersection.rs        | 13 +++---
 datasketches/src/tuple/a_not_b.rs             | 63 ++++++++++-----------------
 datasketches/src/tuple/intersection.rs        | 40 ++++++++---------
 datasketches/tests/theta_a_not_b_test.rs      | 30 ++++++-------
 datasketches/tests/theta_intersection_test.rs | 38 ++++++++--------
 datasketches/tests/tuple_test/a_not_b.rs      | 30 ++++++-------
 datasketches/tests/tuple_test/intersection.rs | 38 ++++++++--------
 9 files changed, 128 insertions(+), 142 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index da6cb3f..a7db5aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,9 @@ All significant changes to this project will be documented in 
this file.
 ### Breaking changes
 
 * Remove `ThetaSketch::builder`, `ThetaUnion::builder`, and 
`TupleSketch::builder`. Construct `ThetaSketchBuilder`, `ThetaUnionBuilder`, 
and `TupleSketchBuilder` with `Default::default` instead.
+* Standardize Theta and Tuple set-operation constructors so `new` uses the 
default seed and
+  `with_seed` accepts a custom seed. This replaces the previous `new(seed)` and
+  `new_with_default_seed` methods on intersection and A-not-B operators.
 
 ### New features
 
diff --git a/datasketches/src/theta/a_not_b.rs 
b/datasketches/src/theta/a_not_b.rs
index 245bb39..559d754 100644
--- a/datasketches/src/theta/a_not_b.rs
+++ b/datasketches/src/theta/a_not_b.rs
@@ -43,7 +43,7 @@ use crate::thetacommon::a_not_b::RawAnotB;
 /// let mut b = ThetaSketchBuilder::default().build();
 /// b.update("banana");
 ///
-/// let a_not_b = ThetaAnotB::new_with_default_seed();
+/// let a_not_b = ThetaAnotB::new();
 /// let result = a_not_b.compute(&a, &b, true).unwrap();
 /// assert_eq!(result.num_retained(), 1); // only "apple" survives
 /// ```
@@ -53,18 +53,19 @@ pub struct ThetaAnotB {
 }
 
 impl ThetaAnotB {
+    /// Creates a new set difference operator with the default seed.
+    #[allow(clippy::new_without_default)]
+    pub fn new() -> Self {
+        Self::with_seed(DEFAULT_UPDATE_SEED)
+    }
+
     /// Creates a new set difference operator for the given `seed`.
-    pub fn new(seed: u64) -> Self {
+    pub fn with_seed(seed: u64) -> Self {
         Self {
             raw: RawAnotB::new(seed),
         }
     }
 
-    /// Creates a new set difference operator with the default seed.
-    pub fn new_with_default_seed() -> Self {
-        Self::new(DEFAULT_UPDATE_SEED)
-    }
-
     /// Computes `a and not b`.
     ///
     /// The result retains every key of `a` (below the combined theta) that is 
not present in `b`.
diff --git a/datasketches/src/theta/intersection.rs 
b/datasketches/src/theta/intersection.rs
index 9d317f0..23e3785 100644
--- a/datasketches/src/theta/intersection.rs
+++ b/datasketches/src/theta/intersection.rs
@@ -40,18 +40,19 @@ impl RawThetaIntersectionPolicy<ThetaEntry> for 
NoopIntersectionPolicy {
 }
 
 impl ThetaIntersection {
+    /// Creates a new intersection operator with the default seed.
+    #[allow(clippy::new_without_default)]
+    pub fn new() -> Self {
+        Self::with_seed(DEFAULT_UPDATE_SEED)
+    }
+
     /// Creates a new intersection operator for the given `seed`.
-    pub fn new(seed: u64) -> Self {
+    pub fn with_seed(seed: u64) -> Self {
         Self {
             raw: RawThetaIntersection::new(seed, NoopIntersectionPolicy),
         }
     }
 
-    /// Creates a new intersection operator with the default seed.
-    pub fn new_with_default_seed() -> Self {
-        Self::new(DEFAULT_UPDATE_SEED)
-    }
-
     /// Updates the intersection with a given sketch.
     ///
     /// The intersection can be viewed as starting from the "universe" set,
diff --git a/datasketches/src/tuple/a_not_b.rs 
b/datasketches/src/tuple/a_not_b.rs
index b113280..5403d44 100644
--- a/datasketches/src/tuple/a_not_b.rs
+++ b/datasketches/src/tuple/a_not_b.rs
@@ -46,7 +46,7 @@ use crate::tuple::sketch::TupleSketchView;
 /// let mut b = TupleSketchBuilder::new(update_policy).build();
 /// b.update("banana", 1);
 ///
-/// let a_not_b = TupleAnotB::new_with_default_seed();
+/// let a_not_b = TupleAnotB::new();
 /// let result = a_not_b.compute(&a, &b, true).unwrap();
 /// assert_eq!(result.num_retained(), 1); // only "apple" survives
 /// ```
@@ -56,18 +56,19 @@ pub struct TupleAnotB {
 }
 
 impl TupleAnotB {
+    /// Creates a new set difference operator with the default seed.
+    #[allow(clippy::new_without_default)]
+    pub fn new() -> Self {
+        Self::with_seed(DEFAULT_UPDATE_SEED)
+    }
+
     /// Creates a new set difference operator for the given `seed`.
-    pub fn new(seed: u64) -> Self {
+    pub fn with_seed(seed: u64) -> Self {
         Self {
             raw: RawAnotB::new(seed),
         }
     }
 
-    /// Creates a new set difference operator with the default seed.
-    pub fn new_with_default_seed() -> Self {
-        Self::new(DEFAULT_UPDATE_SEED)
-    }
-
     /// Computes `a and not b`.
     ///
     /// The result retains every key of `a` (below the combined theta) that is 
not present in `b`,
@@ -128,9 +129,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         // Keys 0..500 are only in A (exact mode).
         assert_eq!(result.num_retained(), 500);
         assert_eq!(result.estimate(), 500.0);
@@ -144,9 +143,7 @@ mod tests {
         let mut b = default_sketch_builder().build();
         b.update("shared", 99u64);
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert_eq!(result.num_retained(), 1);
         // The surviving key keeps A's summary; B's summary is never combined 
in.
         assert_eq!(result.iter().next().unwrap().1, &7);
@@ -160,9 +157,7 @@ mod tests {
         }
         let b = default_sketch_builder().build();
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert_eq!(result.num_retained(), 100);
         assert!(result.iter().all(|(_, &s)| s == 3));
     }
@@ -175,9 +170,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert!(result.is_empty());
         assert_eq!(result.num_retained(), 0);
         assert_eq!(result.estimate(), 0.0);
@@ -194,9 +187,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert_eq!(result.num_retained(), 0);
         assert_eq!(result.estimate(), 0.0);
     }
@@ -212,9 +203,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert_eq!(result.num_retained(), 500);
     }
 
@@ -231,14 +220,12 @@ mod tests {
         let b_compact = b.compact(true);
 
         // a (updatable) not b (compact)
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b_compact, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b_compact, true).unwrap();
         assert_eq!(result.num_retained(), 500);
 
         // a (compact) not b (compact)
         let a_compact = a.compact(true);
-        let result2 = TupleAnotB::new_with_default_seed()
+        let result2 = TupleAnotB::new()
             .compute(&a_compact, &b_compact, true)
             .unwrap();
         assert_eq!(result2.num_retained(), 500);
@@ -258,7 +245,7 @@ mod tests {
         }
         assert!(a.is_estimation_mode() && b.is_estimation_mode());
 
-        let op = TupleAnotB::new_with_default_seed();
+        let op = TupleAnotB::new();
         let unordered = op.compute(&a, &b, true).unwrap();
         let ordered = op
             .compute(&a.compact(true), &b.compact(true), true)
@@ -280,9 +267,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert!(result.is_ordered());
         let entries = sorted_entries(&result);
         let iter_order: Vec<u64> = result.iter().map(|(h, _)| h).collect();
@@ -297,7 +282,7 @@ mod tests {
         let mut b = default_sketch_builder().seed(1).build();
         b.update(2, 1u64);
 
-        let err = TupleAnotB::new(2).compute(&a, &b, true).unwrap_err();
+        let err = TupleAnotB::with_seed(2).compute(&a, &b, true).unwrap_err();
         assert_eq!(err.kind(), ErrorKind::InvalidArgument);
     }
 
@@ -309,7 +294,7 @@ mod tests {
         a.update(1, 1u64);
         let b = default_sketch_builder().seed(1).build(); // empty
 
-        let err = TupleAnotB::new(2).compute(&a, &b, true).unwrap_err();
+        let err = TupleAnotB::with_seed(2).compute(&a, &b, true).unwrap_err();
         assert_eq!(err.kind(), ErrorKind::InvalidArgument);
     }
 
@@ -327,9 +312,7 @@ mod tests {
         // lowered by B).
         let b = default_sketch_builder().seed(999).build();
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert!(!result.is_empty());
         assert_eq!(result.num_retained(), 0);
         assert_eq!(result.theta64(), a.theta64());
@@ -346,9 +329,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let result = TupleAnotB::new_with_default_seed()
-            .compute(&a, &b, true)
-            .unwrap();
+        let result = TupleAnotB::new().compute(&a, &b, true).unwrap();
         assert!(result.is_estimation_mode());
         // True difference size is 25000 (keys 0..25000).
         let lower = result.lower_bound(NumStdDev::Three);
diff --git a/datasketches/src/tuple/intersection.rs 
b/datasketches/src/tuple/intersection.rs
index 736cd94..678a9e8 100644
--- a/datasketches/src/tuple/intersection.rs
+++ b/datasketches/src/tuple/intersection.rs
@@ -75,7 +75,7 @@ use crate::tuple::sketch::TupleSketchView;
 /// b.update("shared", 4);
 /// b.update("only_b", 1);
 ///
-/// let mut intersection = TupleIntersection::new_with_default_seed(SumPolicy);
+/// let mut intersection = TupleIntersection::new(SumPolicy);
 /// intersection.update(&a).unwrap();
 /// intersection.update(&b).unwrap();
 ///
@@ -95,18 +95,18 @@ impl<P> TupleIntersection<P>
 where
     P: SummaryCombinePolicy,
 {
-    /// Creates a new intersection operator for the given `seed` and combine 
`policy`.
-    pub fn new(seed: u64, policy: P) -> Self {
+    /// Creates a new intersection operator with the default seed and the 
given combine `policy`.
+    pub fn new(policy: P) -> Self {
+        Self::with_seed(policy, DEFAULT_UPDATE_SEED)
+    }
+
+    /// Creates a new intersection operator for the given combine `policy` and 
`seed`.
+    pub fn with_seed(policy: P, seed: u64) -> Self {
         Self {
             raw: RawThetaIntersection::new(seed, policy),
         }
     }
 
-    /// Creates a new intersection operator with the default seed and the 
given combine `policy`.
-    pub fn new_with_default_seed(policy: P) -> Self {
-        Self::new(DEFAULT_UPDATE_SEED, policy)
-    }
-
     /// Updates the intersection with a given sketch.
     ///
     /// The intersection can be viewed as starting from the "universe" set, 
and every update reduces
@@ -201,7 +201,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
         intersection.update(&b).unwrap();
 
@@ -221,7 +221,7 @@ mod tests {
         b.update("shared", 4u64);
         b.update("only_b", 200u64);
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
         intersection.update(&b).unwrap();
 
@@ -241,11 +241,11 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let mut a_then_b = TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut a_then_b = TupleIntersection::new(SumPolicy);
         a_then_b.update(&a).unwrap();
         a_then_b.update(&b).unwrap();
 
-        let mut b_then_a = TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut b_then_a = TupleIntersection::new(SumPolicy);
         b_then_a.update(&b).unwrap();
         b_then_a.update(&a).unwrap();
 
@@ -267,7 +267,7 @@ mod tests {
         }
         let b_compact = b.compact(true);
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
         intersection.update(&b_compact).unwrap();
 
@@ -285,7 +285,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
         intersection.update(&b).unwrap();
 
@@ -302,7 +302,7 @@ mod tests {
         }
         let empty = default_sketch_builder().build();
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
         intersection.update(&empty).unwrap();
 
@@ -319,7 +319,7 @@ mod tests {
             a.update(i, 5u64);
         }
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
 
         let result = intersection.to_sketch(true);
@@ -330,7 +330,7 @@ mod tests {
 
     #[test]
     fn has_result_reflects_first_update() {
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         assert!(!intersection.has_result());
 
         let mut a = default_sketch_builder().build();
@@ -342,7 +342,7 @@ mod tests {
     #[test]
     #[should_panic(expected = "before first update")]
     fn result_before_update_panics() {
-        let intersection = TupleIntersection::new_with_default_seed(SumPolicy);
+        let intersection = TupleIntersection::new(SumPolicy);
         let _ = intersection.to_sketch(true);
     }
 
@@ -351,7 +351,7 @@ mod tests {
         let mut a = default_sketch_builder().seed(1).build();
         a.update(1, 1u64);
 
-        let mut intersection = TupleIntersection::new(2, SumPolicy);
+        let mut intersection = TupleIntersection::with_seed(SumPolicy, 2);
         let err = intersection.update(&a).unwrap_err();
         assert_eq!(err.kind(), crate::error::ErrorKind::InvalidArgument);
     }
@@ -367,7 +367,7 @@ mod tests {
             b.update(i, 1u64);
         }
 
-        let mut intersection = 
TupleIntersection::new_with_default_seed(SumPolicy);
+        let mut intersection = TupleIntersection::new(SumPolicy);
         intersection.update(&a).unwrap();
         intersection.update(&b).unwrap();
 
diff --git a/datasketches/tests/theta_a_not_b_test.rs 
b/datasketches/tests/theta_a_not_b_test.rs
index 2570398..24dfdfb 100644
--- a/datasketches/tests/theta_a_not_b_test.rs
+++ b/datasketches/tests/theta_a_not_b_test.rs
@@ -44,7 +44,7 @@ fn test_basic_difference() {
     b.update("shared");
     b.update("only_b");
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     // "shared" is subtracted; only "only_a" survives.
@@ -58,7 +58,7 @@ fn test_accepts_updatable_and_compact_inputs() {
     let a = sketch_with_range(0, 1000);
     let b = sketch_with_range(500, 1000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a.compact(true), &b, true).unwrap();
     assert_eq!(r.num_retained(), 500);
 
@@ -72,7 +72,7 @@ fn test_seed_mismatch_returns_error() {
     one_other_seed.update("value");
     let good = sketch_with_range(0, 10);
 
-    let a_not_b = ThetaAnotB::new(1);
+    let a_not_b = ThetaAnotB::with_seed(1);
     assert!(a_not_b.compute(&one_other_seed, &good, true).is_err());
     assert!(a_not_b.compute(&good, &one_other_seed, true).is_err());
 }
@@ -83,7 +83,7 @@ fn test_seed_mismatch_ignored_for_empty_inputs() {
     let empty_other_seed = ThetaSketchBuilder::default().seed(2).build();
     let good = sketch_with_range(0, 10);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
 
     let r = a_not_b.compute(&empty_other_seed, &good, true).unwrap();
     assert!(r.is_empty());
@@ -97,7 +97,7 @@ fn test_empty_a_returns_empty() {
     let empty = ThetaSketchBuilder::default().build();
     let b = sketch_with_range(0, 1000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&empty, &b, true).unwrap();
 
     assert!(r.is_empty());
@@ -110,7 +110,7 @@ fn test_empty_b_returns_a() {
     let a = sketch_with_range(0, 1000);
     let empty = ThetaSketchBuilder::default().build();
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &empty, true).unwrap();
 
     assert_eq!(r.num_retained(), 1000);
@@ -122,7 +122,7 @@ fn test_exact_partial_overlap_unordered() {
     let a = sketch_with_range(0, 1000);
     let b = sketch_with_range(500, 1000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     // Keys 0..500 survive (exact mode).
@@ -137,7 +137,7 @@ fn test_exact_partial_overlap_ordered() {
     let a = sketch_with_range(0, 1000);
     let b = sketch_with_range(500, 1000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b
         .compute(&a.compact(true), &b.compact(true), true)
         .unwrap();
@@ -153,7 +153,7 @@ fn test_exact_disjoint_returns_a() {
     let a = sketch_with_range(0, 1000);
     let b = sketch_with_range(1000, 1000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     assert!(!r.is_estimation_mode());
@@ -166,7 +166,7 @@ fn test_exact_superset_b_returns_empty() {
     let a = sketch_with_range(0, 1000);
     let b = sketch_with_range(0, 2000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     assert!(r.is_empty());
@@ -179,7 +179,7 @@ fn test_result_ordering() {
     let a = sketch_with_range(0, 64);
     let empty = ThetaSketchBuilder::default().build();
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
 
     let r = a_not_b.compute(&a, &empty, true).unwrap();
     assert!(r.is_ordered());
@@ -193,7 +193,7 @@ fn test_estimation_partial_overlap_unordered() {
     let a = sketch_with_range(0, 10000);
     let b = sketch_with_range(5000, 10000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     // True difference size is 5000 (keys 0..5000).
@@ -207,7 +207,7 @@ fn test_estimation_partial_overlap_ordered() {
     let a = sketch_with_range(0, 10000);
     let b = sketch_with_range(5000, 10000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b
         .compute(&a.compact(true), &b.compact(true), true)
         .unwrap();
@@ -224,7 +224,7 @@ fn test_estimation_partial_overlap_deserialized_compact() {
     let c1 = 
CompactThetaSketch::deserialize(&a.compact(true).serialize()).unwrap();
     let c2 = 
CompactThetaSketch::deserialize(&b.compact(true).serialize()).unwrap();
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&c1, &c2, true).unwrap();
 
     assert!(!r.is_empty());
@@ -237,7 +237,7 @@ fn test_estimation_disjoint_returns_a() {
     let a = sketch_with_range(0, 10000);
     let b = sketch_with_range(10000, 10000);
 
-    let a_not_b = ThetaAnotB::new_with_default_seed();
+    let a_not_b = ThetaAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     assert!(!r.is_empty());
diff --git a/datasketches/tests/theta_intersection_test.rs 
b/datasketches/tests/theta_intersection_test.rs
index aaa5d44..c4dc61e 100644
--- a/datasketches/tests/theta_intersection_test.rs
+++ b/datasketches/tests/theta_intersection_test.rs
@@ -35,7 +35,7 @@ fn test_has_result_state_machine() {
     let mut a = ThetaSketchBuilder::default().build();
     a.update("x");
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     assert!(!i.has_result());
     i.update(&a).unwrap();
     assert!(i.has_result());
@@ -44,7 +44,7 @@ fn test_has_result_state_machine() {
 
 #[test]
 fn test_result_before_update_panics() {
-    let i = ThetaIntersection::new(123);
+    let i = ThetaIntersection::with_seed(123);
     let result = std::panic::catch_unwind(|| {
         i.to_sketch(true);
     });
@@ -61,7 +61,7 @@ fn test_update_accepts_compact_sketch() {
     b.update("y");
     b.update("z");
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&a.compact(true)).unwrap();
     i.update(&b).unwrap();
 
@@ -84,7 +84,7 @@ fn test_update_accepts_compact_sketch() {
 #[test]
 fn test_seed_mismatch_behaviour_for_empty_sketch() {
     let empty_other_seed = ThetaSketchBuilder::default().seed(2).build();
-    let mut i = ThetaIntersection::new(1);
+    let mut i = ThetaIntersection::with_seed(1);
 
     i.update(&empty_other_seed).unwrap();
     assert!(i.has_result());
@@ -96,7 +96,7 @@ fn test_seed_mismatch_behaviour_for_empty_sketch() {
 fn test_seed_mismatch_behaviour() {
     let mut one_other_seed = ThetaSketchBuilder::default().seed(2).build();
     one_other_seed.update("value");
-    let mut i = ThetaIntersection::new(1);
+    let mut i = ThetaIntersection::with_seed(1);
 
     assert!(i.update(&one_other_seed).is_err());
 }
@@ -108,7 +108,7 @@ fn test_terminal_empty_state_ignores_future_updates() {
     let mut non_empty = ThetaSketchBuilder::default().build();
     non_empty.update("x");
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&empty).unwrap();
     i.update(&non_empty).unwrap();
 
@@ -122,7 +122,7 @@ fn test_to_sketch_unordered_is_not_ordered() {
     for i in 0..64 {
         a.update(i);
     }
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&a).unwrap();
 
     let r = i.to_sketch(false);
@@ -132,7 +132,7 @@ fn test_to_sketch_unordered_is_not_ordered() {
 #[test]
 fn test_empty_update_twice() {
     let empty = ThetaSketchBuilder::default().build();
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
 
     i.update(&empty).unwrap();
     let r1 = i.to_sketch(true);
@@ -156,7 +156,7 @@ fn test_non_empty_no_retained_keys() {
         .build();
     s.update(1u64);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s).unwrap();
     let r1 = i.to_sketch(true);
     assert_eq!(r1.num_retained(), 0);
@@ -179,7 +179,7 @@ fn test_exact_half_overlap_unordered() {
     let s1 = sketch_with_range(0, 1000);
     let s2 = sketch_with_range(500, 1000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -194,7 +194,7 @@ fn test_exact_half_overlap_ordered() {
     let s1 = sketch_with_range(0, 1000);
     let s2 = sketch_with_range(500, 1000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -209,7 +209,7 @@ fn test_exact_disjoint_unordered() {
     let s1 = sketch_with_range(0, 1000);
     let s2 = sketch_with_range(1000, 1000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -224,7 +224,7 @@ fn test_exact_disjoint_ordered() {
     let s1 = sketch_with_range(0, 1000);
     let s2 = sketch_with_range(1000, 1000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -239,7 +239,7 @@ fn test_estimation_half_overlap_unordered() {
     let s1 = sketch_with_range(0, 10000);
     let s2 = sketch_with_range(5000, 10000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -254,7 +254,7 @@ fn test_estimation_half_overlap_ordered() {
     let s1 = sketch_with_range(0, 10000);
     let s2 = sketch_with_range(5000, 10000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -271,7 +271,7 @@ fn 
test_estimation_half_overlap_ordered_deserialized_compact() {
     let c1 = 
CompactThetaSketch::deserialize(&s1.compact(true).serialize()).unwrap();
     let c2 = 
CompactThetaSketch::deserialize(&s2.compact(true).serialize()).unwrap();
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&c1).unwrap();
     i.update(&c2).unwrap();
     let r = i.to_sketch(true);
@@ -286,7 +286,7 @@ fn test_estimation_disjoint_unordered() {
     let s1 = sketch_with_range(0, 10000);
     let s2 = sketch_with_range(10000, 10000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -301,7 +301,7 @@ fn test_estimation_disjoint_ordered() {
     let s1 = sketch_with_range(0, 10000);
     let s2 = sketch_with_range(10000, 10000);
 
-    let mut i = ThetaIntersection::new_with_default_seed();
+    let mut i = ThetaIntersection::new();
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -316,6 +316,6 @@ fn test_seed_mismatch_non_empty_returns_error() {
     let mut s = ThetaSketchBuilder::default().build();
     s.update(1u64);
 
-    let mut i = ThetaIntersection::new(123);
+    let mut i = ThetaIntersection::with_seed(123);
     assert!(i.update(&s).is_err());
 }
diff --git a/datasketches/tests/tuple_test/a_not_b.rs 
b/datasketches/tests/tuple_test/a_not_b.rs
index c7ec9eb..b75da07 100644
--- a/datasketches/tests/tuple_test/a_not_b.rs
+++ b/datasketches/tests/tuple_test/a_not_b.rs
@@ -36,7 +36,7 @@ fn test_basic_difference_keeps_summaries_from_a() {
     b.update("shared", 9u64);
     b.update("only_b", 7u64);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     // "shared" is subtracted; "only_a" survives with A's summary.
@@ -51,7 +51,7 @@ fn test_accepts_updatable_and_compact_inputs() {
     let a = tuple_sketch_with_range(0, 1000);
     let b = tuple_sketch_with_range(500, 1000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a.compact(true), &b, true).unwrap();
     assert_eq!(r.num_retained(), 500);
 
@@ -65,7 +65,7 @@ fn test_seed_mismatch_returns_error() {
     one_other_seed.update("value", 1u64);
     let good = tuple_sketch_with_range(0, 10);
 
-    let a_not_b = TupleAnotB::new(1);
+    let a_not_b = TupleAnotB::with_seed(1);
     assert!(a_not_b.compute(&one_other_seed, &good, true).is_err());
     assert!(a_not_b.compute(&good, &one_other_seed, true).is_err());
 }
@@ -76,7 +76,7 @@ fn test_seed_mismatch_ignored_for_empty_inputs() {
     let empty_other_seed = default_tuple_sketch_builder().seed(2).build();
     let good = tuple_sketch_with_range(0, 10);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
 
     let r = a_not_b.compute(&empty_other_seed, &good, true).unwrap();
     assert!(r.is_empty());
@@ -90,7 +90,7 @@ fn test_empty_a_returns_empty() {
     let empty = default_tuple_sketch_builder().build();
     let b = tuple_sketch_with_range(0, 1000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&empty, &b, true).unwrap();
 
     assert!(r.is_empty());
@@ -103,7 +103,7 @@ fn test_empty_b_returns_a() {
     let a = tuple_sketch_with_range(0, 1000);
     let empty = default_tuple_sketch_builder().build();
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &empty, true).unwrap();
 
     assert_eq!(r.num_retained(), 1000);
@@ -115,7 +115,7 @@ fn test_exact_partial_overlap_unordered() {
     let a = tuple_sketch_with_range(0, 1000);
     let b = tuple_sketch_with_range(500, 1000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     // Keys 0..500 survive (exact mode).
@@ -130,7 +130,7 @@ fn test_exact_partial_overlap_ordered() {
     let a = tuple_sketch_with_range(0, 1000);
     let b = tuple_sketch_with_range(500, 1000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b
         .compute(&a.compact(true), &b.compact(true), true)
         .unwrap();
@@ -146,7 +146,7 @@ fn test_exact_disjoint_returns_a() {
     let a = tuple_sketch_with_range(0, 1000);
     let b = tuple_sketch_with_range(1000, 1000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     assert!(!r.is_estimation_mode());
@@ -159,7 +159,7 @@ fn test_exact_superset_b_returns_empty() {
     let a = tuple_sketch_with_range(0, 1000);
     let b = tuple_sketch_with_range(0, 2000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     assert!(r.is_empty());
@@ -175,7 +175,7 @@ fn test_result_ordering() {
     }
     let empty = default_tuple_sketch_builder().build();
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
 
     let r = a_not_b.compute(&a, &empty, true).unwrap();
     assert!(r.is_ordered());
@@ -189,7 +189,7 @@ fn test_estimation_partial_overlap_unordered() {
     let a = tuple_sketch_with_range(0, 10000);
     let b = tuple_sketch_with_range(5000, 10000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     // True difference size is 5000 (keys 0..5000).
@@ -203,7 +203,7 @@ fn test_estimation_partial_overlap_ordered() {
     let a = tuple_sketch_with_range(0, 10000);
     let b = tuple_sketch_with_range(5000, 10000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b
         .compute(&a.compact(true), &b.compact(true), true)
         .unwrap();
@@ -220,7 +220,7 @@ fn test_estimation_partial_overlap_deserialized_compact() {
     let c1 = 
CompactTupleSketch::<u64>::deserialize(&a.compact(true).serialize()).unwrap();
     let c2 = 
CompactTupleSketch::<u64>::deserialize(&b.compact(true).serialize()).unwrap();
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&c1, &c2, true).unwrap();
 
     assert!(!r.is_empty());
@@ -233,7 +233,7 @@ fn test_estimation_disjoint_returns_a() {
     let a = tuple_sketch_with_range(0, 10000);
     let b = tuple_sketch_with_range(10000, 10000);
 
-    let a_not_b = TupleAnotB::new_with_default_seed();
+    let a_not_b = TupleAnotB::new();
     let r = a_not_b.compute(&a, &b, true).unwrap();
 
     assert!(!r.is_empty());
diff --git a/datasketches/tests/tuple_test/intersection.rs 
b/datasketches/tests/tuple_test/intersection.rs
index 5beab8b..40000df 100644
--- a/datasketches/tests/tuple_test/intersection.rs
+++ b/datasketches/tests/tuple_test/intersection.rs
@@ -45,7 +45,7 @@ fn test_has_result_state_machine() {
     let mut a = default_tuple_sketch_builder().build();
     a.update("x", 1u64);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     assert!(!i.has_result());
     i.update(&a).unwrap();
     assert!(i.has_result());
@@ -54,7 +54,7 @@ fn test_has_result_state_machine() {
 
 #[test]
 fn test_result_before_update_panics() {
-    let i = TupleIntersection::new(123, SumPolicy);
+    let i = TupleIntersection::with_seed(SumPolicy, 123);
     let result = std::panic::catch_unwind(|| {
         let _ = i.to_sketch(true);
     });
@@ -71,7 +71,7 @@ fn test_update_accepts_compact_sketch() {
     b.update("y", 1u64);
     b.update("z", 1u64);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&a.compact(true)).unwrap();
     i.update(&b).unwrap();
 
@@ -94,7 +94,7 @@ fn test_update_accepts_compact_sketch() {
 #[test]
 fn test_seed_mismatch_behaviour_for_empty_sketch() {
     let empty_other_seed = default_tuple_sketch_builder().seed(2).build();
-    let mut i = TupleIntersection::new(1, SumPolicy);
+    let mut i = TupleIntersection::with_seed(SumPolicy, 1);
 
     i.update(&empty_other_seed).unwrap();
     assert!(i.has_result());
@@ -106,7 +106,7 @@ fn test_seed_mismatch_behaviour_for_empty_sketch() {
 fn test_seed_mismatch_behaviour() {
     let mut one_other_seed = default_tuple_sketch_builder().seed(2).build();
     one_other_seed.update("value", 1u64);
-    let mut i = TupleIntersection::new(1, SumPolicy);
+    let mut i = TupleIntersection::with_seed(SumPolicy, 1);
 
     assert!(i.update(&one_other_seed).is_err());
 }
@@ -118,7 +118,7 @@ fn test_terminal_empty_state_ignores_future_updates() {
     let mut non_empty = default_tuple_sketch_builder().build();
     non_empty.update("x", 1u64);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&empty).unwrap();
     i.update(&non_empty).unwrap();
 
@@ -132,7 +132,7 @@ fn test_to_sketch_unordered_is_not_ordered() {
     for i in 0..64 {
         a.update(i, 1u64);
     }
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&a).unwrap();
 
     let r = i.to_sketch(false);
@@ -142,7 +142,7 @@ fn test_to_sketch_unordered_is_not_ordered() {
 #[test]
 fn test_empty_update_twice() {
     let empty = default_tuple_sketch_builder().build();
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
 
     i.update(&empty).unwrap();
     let r1 = i.to_sketch(true);
@@ -166,7 +166,7 @@ fn test_non_empty_no_retained_keys() {
         .build();
     s.update(1u64, 1u64);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s).unwrap();
     let r1 = i.to_sketch(true);
     assert_eq!(r1.num_retained(), 0);
@@ -189,7 +189,7 @@ fn test_exact_half_overlap_unordered() {
     let s1 = tuple_sketch_with_range(0, 1000);
     let s2 = tuple_sketch_with_range(500, 1000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -204,7 +204,7 @@ fn test_exact_half_overlap_ordered() {
     let s1 = tuple_sketch_with_range(0, 1000);
     let s2 = tuple_sketch_with_range(500, 1000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -219,7 +219,7 @@ fn test_exact_disjoint_unordered() {
     let s1 = tuple_sketch_with_range(0, 1000);
     let s2 = tuple_sketch_with_range(1000, 1000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -234,7 +234,7 @@ fn test_exact_disjoint_ordered() {
     let s1 = tuple_sketch_with_range(0, 1000);
     let s2 = tuple_sketch_with_range(1000, 1000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -249,7 +249,7 @@ fn test_estimation_half_overlap_unordered() {
     let s1 = tuple_sketch_with_range(0, 10000);
     let s2 = tuple_sketch_with_range(5000, 10000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -264,7 +264,7 @@ fn test_estimation_half_overlap_ordered() {
     let s1 = tuple_sketch_with_range(0, 10000);
     let s2 = tuple_sketch_with_range(5000, 10000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -281,7 +281,7 @@ fn 
test_estimation_half_overlap_ordered_deserialized_compact() {
     let c1 = 
CompactTupleSketch::<u64>::deserialize(&s1.compact(true).serialize()).unwrap();
     let c2 = 
CompactTupleSketch::<u64>::deserialize(&s2.compact(true).serialize()).unwrap();
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&c1).unwrap();
     i.update(&c2).unwrap();
     let r = i.to_sketch(true);
@@ -296,7 +296,7 @@ fn test_estimation_disjoint_unordered() {
     let s1 = tuple_sketch_with_range(0, 10000);
     let s2 = tuple_sketch_with_range(10000, 10000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1).unwrap();
     i.update(&s2).unwrap();
     let r = i.to_sketch(true);
@@ -311,7 +311,7 @@ fn test_estimation_disjoint_ordered() {
     let s1 = tuple_sketch_with_range(0, 10000);
     let s2 = tuple_sketch_with_range(10000, 10000);
 
-    let mut i = TupleIntersection::new_with_default_seed(SumPolicy);
+    let mut i = TupleIntersection::new(SumPolicy);
     i.update(&s1.compact(true)).unwrap();
     i.update(&s2.compact(true)).unwrap();
     let r = i.to_sketch(true);
@@ -326,6 +326,6 @@ fn test_seed_mismatch_non_empty_returns_error() {
     let mut s = default_tuple_sketch_builder().build();
     s.update(1u64, 1u64);
 
-    let mut i = TupleIntersection::new(123, SumPolicy);
+    let mut i = TupleIntersection::with_seed(SumPolicy, 123);
     assert!(i.update(&s).is_err());
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to