Skip to content

Commit 8e3b4e8

Browse files
committed
clean up
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 609289f commit 8e3b4e8

12 files changed

Lines changed: 29 additions & 88 deletions

File tree

vortex-btrblocks/benches/dict_encode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use vortex_array::arrays::BoolArray;
99
use vortex_array::arrays::PrimitiveArray;
1010
use vortex_array::builders::dict::dict_encode;
1111
use vortex_array::validity::Validity;
12-
use vortex_btrblocks::CompressorStats;
1312
use vortex_btrblocks::IntegerStats;
1413
use vortex_btrblocks::integer_dictionary_encode;
1514
use vortex_buffer::BufferMut;

vortex-btrblocks/benches/stats_calc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ mod benchmarks {
1010
use divan::Bencher;
1111
use vortex_array::arrays::PrimitiveArray;
1212
use vortex_array::validity::Validity;
13-
use vortex_btrblocks::CompressorStats;
1413
use vortex_btrblocks::GenerateStatsOptions;
1514
use vortex_btrblocks::IntegerStats;
1615
use vortex_buffer::Buffer;

vortex-btrblocks/src/compressor/float/dictionary.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ mod tests {
112112
use vortex_buffer::buffer;
113113

114114
use super::super::FloatStats;
115-
use crate::CompressorStats;
116115
use crate::compressor::float::dictionary::dictionary_encode;
117116

118117
#[test]

vortex-btrblocks/src/compressor/float/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use super::integer::SparseScheme as IntSparseScheme;
3434
use crate::ArrayAndStats;
3535
use crate::BtrBlocksCompressor;
3636
use crate::CompressorContext;
37-
use crate::CompressorStats;
3837
use crate::GenerateStatsOptions;
3938
use crate::Scheme;
4039
use crate::SchemeId;

vortex-btrblocks/src/compressor/float/stats.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ use std::hash::Hash;
66
use itertools::Itertools;
77
use num_traits::Float;
88
use rustc_hash::FxBuildHasher;
9-
use vortex_array::IntoArray;
10-
use vortex_array::ToCanonical;
11-
use vortex_array::arrays::Primitive;
129
use vortex_array::arrays::PrimitiveArray;
1310
use vortex_array::arrays::primitive::NativeValue;
1411
use vortex_array::dtype::NativePType;
@@ -21,10 +18,8 @@ use vortex_error::vortex_panic;
2118
use vortex_mask::AllOr;
2219
use vortex_utils::aliases::hash_set::HashSet;
2320

24-
use crate::CompressorStats;
2521
use crate::GenerateStatsOptions;
2622
use crate::compressor::rle::RLEStats;
27-
use crate::sample::sample;
2823

2924
#[derive(Debug, Clone)]
3025
pub struct DistinctInfo<T> {
@@ -100,24 +95,23 @@ impl FloatStats {
10095
}
10196
}
10297

103-
impl CompressorStats for FloatStats {
104-
type ArrayVTable = Primitive;
98+
impl FloatStats {
99+
/// Generates stats with default options.
100+
pub fn generate(input: &PrimitiveArray) -> Self {
101+
Self::generate_opts(input, GenerateStatsOptions::default())
102+
}
105103

106-
fn generate_opts(input: &PrimitiveArray, opts: GenerateStatsOptions) -> Self {
104+
/// Generates stats with provided options.
105+
pub fn generate_opts(input: &PrimitiveArray, opts: GenerateStatsOptions) -> Self {
107106
Self::generate_opts_fallible(input, opts)
108107
.vortex_expect("FloatStats::generate_opts should not fail")
109108
}
110109

111-
fn source(&self) -> &PrimitiveArray {
110+
/// Returns the underlying source array.
111+
#[expect(clippy::same_name_method)]
112+
pub fn source(&self) -> &PrimitiveArray {
112113
&self.src
113114
}
114-
115-
fn sample_opts(&self, sample_size: u32, sample_count: u32, opts: GenerateStatsOptions) -> Self {
116-
let sampled =
117-
sample(&self.src.clone().into_array(), sample_size, sample_count).to_primitive();
118-
119-
Self::generate_opts(&sampled, opts)
120-
}
121115
}
122116

123117
impl RLEStats for FloatStats {
@@ -245,7 +239,6 @@ mod tests {
245239
use vortex_buffer::buffer;
246240

247241
use super::FloatStats;
248-
use crate::CompressorStats;
249242

250243
#[test]
251244
fn test_float_stats() {

vortex-btrblocks/src/compressor/integer/dictionary.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ mod tests {
129129

130130
use super::IntegerStats;
131131
use super::dictionary_encode;
132-
use crate::CompressorStats;
133132

134133
#[test]
135134
fn test_dict_encode_integer_stats() {

vortex-btrblocks/src/compressor/integer/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use self::dictionary::dictionary_encode;
3535
use crate::ArrayAndStats;
3636
use crate::BtrBlocksCompressor;
3737
use crate::CompressorContext;
38-
use crate::CompressorStats;
3938
use crate::GenerateStatsOptions;
4039
use crate::Scheme;
4140
use crate::SchemeId;

vortex-btrblocks/src/compressor/integer/stats.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ use std::hash::Hash;
55

66
use num_traits::PrimInt;
77
use rustc_hash::FxBuildHasher;
8-
use vortex_array::IntoArray;
9-
use vortex_array::ToCanonical;
10-
use vortex_array::arrays::Primitive;
118
use vortex_array::arrays::PrimitiveArray;
129
use vortex_array::arrays::primitive::NativeValue;
1310
use vortex_array::dtype::IntegerPType;
@@ -22,10 +19,8 @@ use vortex_error::VortexResult;
2219
use vortex_mask::AllOr;
2320
use vortex_utils::aliases::hash_map::HashMap;
2421

25-
use crate::CompressorStats;
2622
use crate::GenerateStatsOptions;
2723
use crate::compressor::rle::RLEStats;
28-
use crate::sample::sample;
2924

3025
#[derive(Debug, Clone)]
3126
pub struct DistinctInfo<T> {
@@ -244,24 +239,23 @@ impl IntegerStats {
244239
}
245240
}
246241

247-
impl CompressorStats for IntegerStats {
248-
type ArrayVTable = Primitive;
242+
impl IntegerStats {
243+
/// Generates stats with default options.
244+
pub fn generate(input: &PrimitiveArray) -> Self {
245+
Self::generate_opts(input, GenerateStatsOptions::default())
246+
}
249247

250-
fn generate_opts(input: &PrimitiveArray, opts: GenerateStatsOptions) -> Self {
248+
/// Generates stats with provided options.
249+
pub fn generate_opts(input: &PrimitiveArray, opts: GenerateStatsOptions) -> Self {
251250
Self::generate_opts_fallible(input, opts)
252251
.vortex_expect("IntegerStats::generate_opts should not fail")
253252
}
254253

255-
fn source(&self) -> &PrimitiveArray {
254+
/// Returns the underlying source array.
255+
#[expect(clippy::same_name_method)]
256+
pub fn source(&self) -> &PrimitiveArray {
256257
&self.src
257258
}
258-
259-
fn sample_opts(&self, sample_size: u32, sample_count: u32, opts: GenerateStatsOptions) -> Self {
260-
let sampled =
261-
sample(&self.src.clone().into_array(), sample_size, sample_count).to_primitive();
262-
263-
Self::generate_opts(&sampled, opts)
264-
}
265259
}
266260

267261
impl RLEStats for IntegerStats {
@@ -520,7 +514,6 @@ mod tests {
520514

521515
use super::IntegerStats;
522516
use super::typed_int_stats;
523-
use crate::CompressorStats;
524517

525518
#[test]
526519
fn test_naive_count_distinct_values() -> VortexResult<()> {

vortex-btrblocks/src/compressor/string.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use vortex_array::arrays::ConstantArray;
99
use vortex_array::arrays::DictArray;
1010
use vortex_array::arrays::MaskedArray;
1111
use vortex_array::arrays::VarBinArray;
12-
use vortex_array::arrays::VarBinView;
1312
use vortex_array::arrays::VarBinViewArray;
1413
use vortex_array::builders::dict::dict_encode;
1514
use vortex_array::compute::is_constant;
@@ -33,11 +32,9 @@ use super::integer::SparseScheme as IntSparseScheme;
3332
use crate::ArrayAndStats;
3433
use crate::BtrBlocksCompressor;
3534
use crate::CompressorContext;
36-
use crate::CompressorStats;
3735
use crate::GenerateStatsOptions;
3836
use crate::Scheme;
3937
use crate::SchemeId;
40-
use crate::sample::sample;
4138
use crate::scheme::estimate_compression_ratio_with_sampling;
4239

4340
/// Returns `true` if the canonical array is a UTF-8 string type.
@@ -97,24 +94,22 @@ impl StringStats {
9794
}
9895
}
9996

100-
impl CompressorStats for StringStats {
101-
type ArrayVTable = VarBinView;
97+
impl StringStats {
98+
/// Generates stats with default options.
99+
pub fn generate(input: &VarBinViewArray) -> Self {
100+
Self::generate_opts(input, GenerateStatsOptions::default())
101+
}
102102

103-
fn generate_opts(input: &VarBinViewArray, opts: GenerateStatsOptions) -> Self {
103+
/// Generates stats with provided options.
104+
pub fn generate_opts(input: &VarBinViewArray, opts: GenerateStatsOptions) -> Self {
104105
Self::generate_opts_fallible(input, opts)
105106
.vortex_expect("StringStats::generate_opts should not fail")
106107
}
107108

108-
fn source(&self) -> &VarBinViewArray {
109+
/// Returns the underlying source array.
110+
pub fn source(&self) -> &VarBinViewArray {
109111
&self.src
110112
}
111-
112-
fn sample_opts(&self, sample_size: u32, sample_count: u32, opts: GenerateStatsOptions) -> Self {
113-
let sampled =
114-
sample(&self.src.clone().into_array(), sample_size, sample_count).to_varbinview();
115-
116-
Self::generate_opts(&sampled, opts)
117-
}
118113
}
119114

120115
/// Uncompressed string scheme (identity).

vortex-btrblocks/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,5 @@ pub use compressor::integer::dictionary::dictionary_encode as integer_dictionary
7575
pub use ctx::CompressorContext;
7676
pub use scheme::Scheme;
7777
pub use scheme::SchemeId;
78-
pub use stats::CompressorStats;
7978
pub use stats::GenerateStatsOptions;
8079
pub use stats_cache::ArrayAndStats;

0 commit comments

Comments
 (0)