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 a580881  refactor: replace super-qualified module paths (#225)
a580881 is described below

commit a580881430192db1ae93367a6dbd3a74dfa10507
Author: tison <[email protected]>
AuthorDate: Tue Aug 25 23:31:14 2026 +0800

    refactor: replace super-qualified module paths (#225)
---
 datasketches/src/hash/value/canonical_float.rs |  4 +-
 datasketches/src/hash/value/natural_extend.rs  |  4 +-
 datasketches/src/hash/value/raw_bytes.rs       |  4 +-
 datasketches/src/hash/value/sign_extend.rs     |  4 +-
 datasketches/src/hll/array4.rs                 |  2 +-
 datasketches/src/req/compactor.rs              | 22 +++++-----
 datasketches/src/req/iter.rs                   |  4 +-
 datasketches/src/req/serialization.rs          |  6 +--
 datasketches/src/req/sketch.rs                 | 60 +++++++++++---------------
 datasketches/src/req/sorted_view.rs            |  8 ++--
 datasketches/src/req/union.rs                  |  6 +--
 datasketches/src/req/value.rs                  |  4 +-
 datasketches/tests/tuple_test/a_not_b.rs       |  4 +-
 datasketches/tests/tuple_test/intersection.rs  |  4 +-
 datasketches/tests/tuple_test/sketch.rs        |  2 +-
 datasketches/tests/tuple_test/union.rs         |  4 +-
 16 files changed, 68 insertions(+), 74 deletions(-)

diff --git a/datasketches/src/hash/value/canonical_float.rs 
b/datasketches/src/hash/value/canonical_float.rs
index 0feb526..4c29b5b 100644
--- a/datasketches/src/hash/value/canonical_float.rs
+++ b/datasketches/src/hash/value/canonical_float.rs
@@ -26,8 +26,8 @@
 use std::hash::Hash;
 use std::hash::Hasher;
 
-use super::HashStrategy;
-use super::Value;
+use crate::hash::value::HashStrategy;
+use crate::hash::value::Value;
 
 /// A floating-point value wrapper that uses canonical floating-point hashing.
 ///
diff --git a/datasketches/src/hash/value/natural_extend.rs 
b/datasketches/src/hash/value/natural_extend.rs
index 919060e..1b2ec4d 100644
--- a/datasketches/src/hash/value/natural_extend.rs
+++ b/datasketches/src/hash/value/natural_extend.rs
@@ -25,8 +25,8 @@
 use std::hash::Hash;
 use std::hash::Hasher;
 
-use super::HashStrategy;
-use super::Value;
+use crate::hash::value::HashStrategy;
+use crate::hash::value::Value;
 
 /// An integer value wrapper that uses Rust's natural integer widening before 
hashing.
 ///
diff --git a/datasketches/src/hash/value/raw_bytes.rs 
b/datasketches/src/hash/value/raw_bytes.rs
index 55e79ad..2b41735 100644
--- a/datasketches/src/hash/value/raw_bytes.rs
+++ b/datasketches/src/hash/value/raw_bytes.rs
@@ -26,8 +26,8 @@
 
 use std::hash::Hasher;
 
-use super::HashStrategy;
-use super::Value;
+use crate::hash::value::HashStrategy;
+use crate::hash::value::Value;
 
 /// A byte or string value wrapper that hashes raw bytes.
 ///
diff --git a/datasketches/src/hash/value/sign_extend.rs 
b/datasketches/src/hash/value/sign_extend.rs
index 060072b..561fbd1 100644
--- a/datasketches/src/hash/value/sign_extend.rs
+++ b/datasketches/src/hash/value/sign_extend.rs
@@ -25,8 +25,8 @@
 use std::hash::Hash;
 use std::hash::Hasher;
 
-use super::HashStrategy;
-use super::Value;
+use crate::hash::value::HashStrategy;
+use crate::hash::value::Value;
 
 /// An integer value wrapper that sign-extends the value before hashing.
 ///
diff --git a/datasketches/src/hll/array4.rs b/datasketches/src/hll/array4.rs
index 7438175..c2d0413 100644
--- a/datasketches/src/hll/array4.rs
+++ b/datasketches/src/hll/array4.rs
@@ -20,7 +20,6 @@
 //! Array4 stores HLL register values using 4 bits per slot (2 slots per byte).
 //! When values exceed 4 bits after cur_min offset, they're stored in an 
auxiliary hash map.
 
-use super::aux_map::AuxMap;
 use crate::codec::SketchBytes;
 use crate::codec::SketchSlice;
 use crate::codec::assert::insufficient_data;
@@ -28,6 +27,7 @@ use crate::codec::family::Family;
 use crate::common::NumStdDev;
 use crate::error::Error;
 use crate::hll::Coupon;
+use crate::hll::aux_map::AuxMap;
 use crate::hll::estimator::HipEstimator;
 use crate::hll::serialization::COMPACT_FLAG_MASK;
 use crate::hll::serialization::COUPON_SIZE_BYTES;
diff --git a/datasketches/src/req/compactor.rs 
b/datasketches/src/req/compactor.rs
index 43d8b23..fc43a73 100644
--- a/datasketches/src/req/compactor.rs
+++ b/datasketches/src/req/compactor.rs
@@ -20,11 +20,13 @@
 //! Each level in the REQ sketch uses a compactor to maintain a bounded set of 
items
 //! with deterministic compaction when capacity is exceeded.
 
-use super::MIN_K;
-use super::RankAccuracy;
-use super::nearest_even_section_size;
-use super::value::ReqValue;
 use crate::error::Error;
+use crate::req::INITIAL_SECTIONS_PER_COMPACTOR;
+use crate::req::MIN_K;
+use crate::req::RankAccuracy;
+use crate::req::nearest_even_section_size;
+use crate::req::serialization::validate_compactor_state;
+use crate::req::value::ReqValue;
 
 fn validate_deserialized_items<T: ReqValue>(items: &[T], sorted: bool) -> 
Result<(), Error> {
     if items.iter().any(ReqValue::is_nan) {
@@ -85,7 +87,7 @@ where
     pub(super) fn new(lg_weight: u8, k: u16, rank_accuracy: RankAccuracy) -> 
Self {
         let section_size_raw = k as f32;
         let section_size = nearest_even_section_size(section_size_raw);
-        let num_sections = super::INITIAL_SECTIONS_PER_COMPACTOR;
+        let num_sections = INITIAL_SECTIONS_PER_COMPACTOR;
 
         let nominal: usize = (2 * section_size * num_sections as u32) as usize;
 
@@ -152,7 +154,7 @@ where
     /// Counts the items at-or-below (`inclusive`) or strictly below `item`.
     ///
     /// Uses binary search when this compactor is sorted, and a linear scan
-    /// otherwise. This lets [`ReqSketch::rank`](super::ReqSketch::rank) sum
+    /// otherwise. This lets [`ReqSketch::rank`](crate::req::ReqSketch::rank) 
sum
     /// per-level weights directly without first building a sorted view.
     pub(super) fn count_below(&self, item: &T, inclusive: bool) -> usize {
         if self.is_sorted {
@@ -392,7 +394,7 @@ where
         cursor: &mut crate::codec::SketchSlice<'_>,
         k: u16,
         expected_lg_weight: u8,
-        rank_accuracy: super::RankAccuracy,
+        rank_accuracy: RankAccuracy,
         sorted: bool,
     ) -> Result<Self, crate::error::Error> {
         use crate::codec::assert::insufficient_data;
@@ -415,7 +417,7 @@ where
             .read_u32_le()
             .map_err(insufficient_data("compactor.num_items"))?;
 
-        super::serialization::validate_compactor_state(
+        validate_compactor_state(
             k,
             expected_lg_weight,
             state,
@@ -455,7 +457,7 @@ where
     /// so faithful round-trip requires preserving whatever the input said.
     pub(super) fn raw_items_compactor(
         k: u16,
-        rank_accuracy: super::RankAccuracy,
+        rank_accuracy: RankAccuracy,
         items: Vec<T>,
         is_sorted: bool,
     ) -> Result<Self, Error> {
@@ -482,7 +484,7 @@ where
         state: u64,
         items: Vec<T>,
         is_sorted: bool,
-        rank_accuracy: super::RankAccuracy,
+        rank_accuracy: RankAccuracy,
     ) -> Self {
         Self {
             items,
diff --git a/datasketches/src/req/iter.rs b/datasketches/src/req/iter.rs
index a3c9863..a35aadb 100644
--- a/datasketches/src/req/iter.rs
+++ b/datasketches/src/req/iter.rs
@@ -17,8 +17,8 @@
 
 //! Iterator implementations for REQ sketch inspection.
 
-use super::compactor::Compactor;
-use super::value::ReqValue;
+use crate::req::compactor::Compactor;
+use crate::req::value::ReqValue;
 
 /// Iterator over (item, weight) pairs in a REQ sketch.
 ///
diff --git a/datasketches/src/req/serialization.rs 
b/datasketches/src/req/serialization.rs
index e3ad461..0b5289b 100644
--- a/datasketches/src/req/serialization.rs
+++ b/datasketches/src/req/serialization.rs
@@ -17,12 +17,12 @@
 
 //! REQ sketch wire format — constants and helpers shared by sketch + 
compactor serdes.
 
-use super::INITIAL_SECTIONS_PER_COMPACTOR;
-use super::MIN_K;
-use super::nearest_even_section_size;
 use crate::codec::assert::ensure_preamble_longs_in;
 use crate::codec::assert::ensure_serial_version_is;
 use crate::error::Error;
+use crate::req::INITIAL_SECTIONS_PER_COMPACTOR;
+use crate::req::MIN_K;
+use crate::req::nearest_even_section_size;
 
 pub(super) const SERIAL_VERSION: u8 = 1;
 pub(super) const PREAMBLE_INTS_EXACT: u8 = 2;
diff --git a/datasketches/src/req/sketch.rs b/datasketches/src/req/sketch.rs
index 5af3ac7..bec4d8f 100644
--- a/datasketches/src/req/sketch.rs
+++ b/datasketches/src/req/sketch.rs
@@ -19,16 +19,31 @@
 
 use std::fmt;
 
-use super::DEFAULT_K;
-use super::MAX_K;
-use super::MIN_K;
-use super::RankAccuracy;
-use super::SearchCriteria;
-use super::compactor::Compactor;
-use super::iter::ReqSketchIterator;
-use super::sorted_view::SortedView;
-use super::value::ReqValue;
+use crate::codec::SketchBytes;
+use crate::codec::SketchSlice;
+use crate::codec::assert::insufficient_data;
+use crate::codec::family::Family;
 use crate::error::Error;
+use crate::req::DEFAULT_K;
+use crate::req::INITIAL_SECTIONS_PER_COMPACTOR;
+use crate::req::MAX_K;
+use crate::req::MIN_K;
+use crate::req::RankAccuracy;
+use crate::req::SearchCriteria;
+use crate::req::compactor::Compactor;
+use crate::req::iter::ReqSketchIterator;
+use crate::req::serialization::FLAG_IS_EMPTY;
+use crate::req::serialization::FLAG_IS_HIGH_RANK;
+use crate::req::serialization::FLAG_IS_LEVEL_ZERO_SORTED;
+use crate::req::serialization::FLAG_RAW_ITEMS;
+use crate::req::serialization::PREAMBLE_INTS_ESTIMATION;
+use crate::req::serialization::PREAMBLE_INTS_EXACT;
+use crate::req::serialization::RAW_ITEMS_THRESHOLD;
+use crate::req::serialization::SERIAL_VERSION;
+use crate::req::serialization::check_preamble_ints;
+use crate::req::serialization::check_serial_version;
+use crate::req::sorted_view::SortedView;
+use crate::req::value::ReqValue;
 
 /// A Relative Error Quantiles sketch for approximate quantile estimation.
 ///
@@ -360,7 +375,7 @@ impl<T: ReqValue> ReqSketch<T> {
 
     const FIXED_RSE_FACTOR: f64 = 0.084;
     fn relative_rse_factor() -> f64 {
-        (0.0512 / super::INITIAL_SECTIONS_PER_COMPACTOR as f64).sqrt()
+        (0.0512 / INITIAL_SECTIONS_PER_COMPACTOR as f64).sqrt()
     }
 
     fn compute_rank_lower_bound(
@@ -409,7 +424,7 @@ impl<T: ReqValue> ReqSketch<T> {
         n: u64,
         hra: bool,
     ) -> bool {
-        let base_cap = k as u64 * super::INITIAL_SECTIONS_PER_COMPACTOR as u64;
+        let base_cap = k as u64 * INITIAL_SECTIONS_PER_COMPACTOR as u64;
         if num_levels == 1 || n <= base_cap {
             return true;
         }
@@ -454,10 +469,6 @@ impl<T: ReqValue> ReqSketch<T> {
     }
 
     pub(super) fn flags_byte(&self) -> u8 {
-        use super::serialization::FLAG_IS_EMPTY;
-        use super::serialization::FLAG_IS_HIGH_RANK;
-        use super::serialization::FLAG_IS_LEVEL_ZERO_SORTED;
-        use super::serialization::FLAG_RAW_ITEMS;
         let mut flags = 0u8;
         if self.is_empty() {
             flags |= FLAG_IS_EMPTY;
@@ -475,7 +486,6 @@ impl<T: ReqValue> ReqSketch<T> {
     }
 
     pub(super) fn is_raw_items(&self) -> bool {
-        use super::serialization::RAW_ITEMS_THRESHOLD;
         self.n <= RAW_ITEMS_THRESHOLD && self.compactors.len() == 1
     }
 
@@ -510,12 +520,6 @@ impl<T: ReqValue> ReqSketch<T> {
 
     /// Serialize the sketch into a `Vec<u8>` matching the C++/Java REQ wire 
format.
     pub fn serialize(&self) -> Vec<u8> {
-        use super::serialization::PREAMBLE_INTS_ESTIMATION;
-        use super::serialization::PREAMBLE_INTS_EXACT;
-        use super::serialization::SERIAL_VERSION;
-        use crate::codec::SketchBytes;
-        use crate::codec::family::Family;
-
         let mut out = SketchBytes::with_capacity(self.serialized_size_bytes());
         let preamble_ints = if self.is_estimation_mode() {
             PREAMBLE_INTS_ESTIMATION
@@ -567,18 +571,6 @@ impl<T: ReqValue> ReqSketch<T> {
     /// Returns an error if the input is truncated or contains an inconsistent
     /// REQ serialized state.
     pub fn deserialize(bytes: &[u8]) -> Result<Self, Error> {
-        use super::compactor::Compactor;
-        use super::serialization::FLAG_IS_EMPTY;
-        use super::serialization::FLAG_IS_HIGH_RANK;
-        use super::serialization::FLAG_IS_LEVEL_ZERO_SORTED;
-        use super::serialization::FLAG_RAW_ITEMS;
-        use super::serialization::RAW_ITEMS_THRESHOLD;
-        use super::serialization::check_preamble_ints;
-        use super::serialization::check_serial_version;
-        use crate::codec::SketchSlice;
-        use crate::codec::assert::insufficient_data;
-        use crate::codec::family::Family;
-
         let mut cursor = SketchSlice::new(bytes);
         let preamble_ints = cursor
             .read_u8()
diff --git a/datasketches/src/req/sorted_view.rs 
b/datasketches/src/req/sorted_view.rs
index 312adf8..06ddcc0 100644
--- a/datasketches/src/req/sorted_view.rs
+++ b/datasketches/src/req/sorted_view.rs
@@ -17,14 +17,14 @@
 
 //! Sorted view implementation for efficient quantile queries.
 
-use super::SearchCriteria;
-use super::value::ReqValue;
 use crate::error::Error;
+use crate::req::SearchCriteria;
+use crate::req::value::ReqValue;
 
-/// An owned, sorted snapshot of a [`ReqSketch`](super::ReqSketch)'s items with
+/// An owned, sorted snapshot of a [`ReqSketch`](crate::req::ReqSketch)'s 
items with
 /// their cumulative weights.
 ///
-/// Obtain one with [`ReqSketch::sorted_view`](super::ReqSketch::sorted_view).
+/// Obtain one with 
[`ReqSketch::sorted_view`](crate::req::ReqSketch::sorted_view).
 /// The view is independent of the sketch: it can be queried (and sent to other
 /// threads) while the sketch keeps receiving updates, and it keeps answering
 /// from the state it was taken at. Building it costs `O(retained · log 
retained)`;
diff --git a/datasketches/src/req/union.rs b/datasketches/src/req/union.rs
index 38c1906..4ce49ae 100644
--- a/datasketches/src/req/union.rs
+++ b/datasketches/src/req/union.rs
@@ -17,10 +17,10 @@
 
 //! REQ union — combines REQ sketches into a single result.
 
-use super::RankAccuracy;
-use super::sketch::ReqSketch;
-use super::value::ReqValue;
 use crate::error::Error;
+use crate::req::RankAccuracy;
+use crate::req::sketch::ReqSketch;
+use crate::req::value::ReqValue;
 
 /// Combines multiple [`ReqSketch`]es into a single result.
 ///
diff --git a/datasketches/src/req/value.rs b/datasketches/src/req/value.rs
index a1db3fb..b065ae3 100644
--- a/datasketches/src/req/value.rs
+++ b/datasketches/src/req/value.rs
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! Trait for types storable in a [`ReqSketch`](super::ReqSketch).
+//! Trait for types storable in a [`ReqSketch`](crate::req::ReqSketch).
 
 use std::cmp::Ordering;
 
@@ -23,7 +23,7 @@ use crate::codec::SketchBytes;
 use crate::codec::SketchSlice;
 use crate::error::Error;
 
-/// Trait for types that can be stored in a [`ReqSketch`](super::ReqSketch).
+/// Trait for types that can be stored in a 
[`ReqSketch`](crate::req::ReqSketch).
 ///
 /// Provides total ordering (so floating-point types with NaN are well-defined 
under
 /// sketch operations) and binary serialization compatible with the Apache 
DataSketches
diff --git a/datasketches/tests/tuple_test/a_not_b.rs 
b/datasketches/tests/tuple_test/a_not_b.rs
index 18806dd..cae015b 100644
--- a/datasketches/tests/tuple_test/a_not_b.rs
+++ b/datasketches/tests/tuple_test/a_not_b.rs
@@ -24,8 +24,8 @@ use googletest::prelude::all;
 use googletest::prelude::ge;
 use googletest::prelude::le;
 
-use super::default_tuple_sketch_builder;
-use super::tuple_sketch_with_range;
+use crate::default_tuple_sketch_builder;
+use crate::tuple_sketch_with_range;
 
 fn sorted_entries(sketch: &CompactTupleSketch<u64>) -> Vec<(u64, u64)> {
     let mut entries: Vec<_> = sketch
diff --git a/datasketches/tests/tuple_test/intersection.rs 
b/datasketches/tests/tuple_test/intersection.rs
index 6338b43..8983c06 100644
--- a/datasketches/tests/tuple_test/intersection.rs
+++ b/datasketches/tests/tuple_test/intersection.rs
@@ -25,8 +25,8 @@ use googletest::prelude::all;
 use googletest::prelude::ge;
 use googletest::prelude::le;
 
-use super::default_tuple_sketch_builder;
-use super::tuple_sketch_with_range;
+use crate::default_tuple_sketch_builder;
+use crate::tuple_sketch_with_range;
 
 #[derive(Debug, Default, Clone, Copy)]
 struct SumPolicy;
diff --git a/datasketches/tests/tuple_test/sketch.rs 
b/datasketches/tests/tuple_test/sketch.rs
index 154a8b8..9a17a9d 100644
--- a/datasketches/tests/tuple_test/sketch.rs
+++ b/datasketches/tests/tuple_test/sketch.rs
@@ -28,7 +28,7 @@ use googletest::prelude::gt;
 use googletest::prelude::le;
 use googletest::prelude::lt;
 
-use super::default_tuple_sketch_builder;
+use crate::default_tuple_sketch_builder;
 
 #[test]
 fn updates_distinct_keys_and_accumulates_summaries() {
diff --git a/datasketches/tests/tuple_test/union.rs 
b/datasketches/tests/tuple_test/union.rs
index 5c3422c..b521888 100644
--- a/datasketches/tests/tuple_test/union.rs
+++ b/datasketches/tests/tuple_test/union.rs
@@ -26,8 +26,8 @@ use googletest::prelude::all;
 use googletest::prelude::ge;
 use googletest::prelude::le;
 
-use super::default_tuple_sketch_builder;
-use super::tuple_sketch_with_range;
+use crate::default_tuple_sketch_builder;
+use crate::tuple_sketch_with_range;
 
 fn default_union_builder() -> TupleUnionBuilder<DefaultUnionPolicy<u64>> {
     TupleUnionBuilder::new(DefaultUnionPolicy::<u64>::default())


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

Reply via email to