Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 committed Apr 13, 2024
1 parent 55e9db9 commit 04db3c8
Show file tree
Hide file tree
Showing 28 changed files with 46 additions and 42 deletions.
4 changes: 2 additions & 2 deletions vortex-alp/src/array.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::{Arc, RwLock};

use vortex::array::{Array, ArrayRef};
use vortex::array::{Array, ArrayKind, ArrayRef};
use vortex::compress::EncodingCompression;
use vortex::compute::ArrayCompute;
use vortex::encoding::{Encoding, EncodingId, EncodingRef};
Expand Down Expand Up @@ -48,7 +48,7 @@ impl ALPArray {
exponents,
patches,
dtype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/bool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl BoolArray {
}
Ok(Self {
buffer,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
validity,
})
}
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/chunked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl ChunkedArray {
chunks,
chunk_ends,
dtype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/chunked/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl StatsCompute for ChunkedArray {
s.compute(stat);
s.get_all()
})
.fold(StatsSet::default(), |mut acc, x| {
.fold(StatsSet::new(), |mut acc, x| {
acc.merge(&x);
acc
}))
Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/array/composite/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl CompositeArray {
metadata,
underlying,
dtype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
}
}

Expand Down Expand Up @@ -122,7 +122,7 @@ impl Array for CompositeArray {

impl StatsCompute for CompositeArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/constant/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ impl StatsCompute for ConstantArray {
)])));
}

Ok(StatsSet::default())
Ok(StatsSet::new())
}
}
2 changes: 1 addition & 1 deletion vortex-array/src/array/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl PrimitiveArray {
ptype,
dtype,
validity,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/array/primitive/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl StatsCompute for PrimitiveArray {
impl<T: NativePType> StatsCompute for &[T] {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
if self.is_empty() {
return Ok(StatsSet::default());
return Ok(StatsSet::new());
}
let mut stats = StatsAccumulator::new(self[0]);
self.iter().skip(1).for_each(|next| stats.next(*next));
Expand Down Expand Up @@ -64,7 +64,7 @@ impl<'a, T: NativePType> StatsCompute for NullableValues<'a, T> {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
let values = self.0;
if values.is_empty() {
return Ok(StatsSet::default());
return Ok(StatsSet::new());
}

let first_non_null = self
Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/array/sparse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl SparseArray {
values,
indices_offset,
len,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
fill_value,
})
}
Expand Down Expand Up @@ -159,7 +159,7 @@ impl Array for SparseArray {

impl StatsCompute for SparseArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/array/struct_/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl StructArray {
fields,
dtype,
len,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ impl Array for StructArray {

impl StatsCompute for StructArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl VarBinArray {
bytes,
dtype,
validity,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
11 changes: 5 additions & 6 deletions vortex-array/src/array/varbin/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::collections::HashMap;
use vortex_error::VortexResult;
use vortex_schema::DType;

use crate::array::varbin::VarBinArray;
use crate::array::varbin::{varbin_scalar, VarBinArray};
use crate::array::Array;
use crate::stats::{Stat, StatsCompute, StatsSet};

impl StatsCompute for VarBinArray {
fn compute(&self, _stat: &Stat) -> VortexResult<StatsSet> {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
if self.is_empty() {
return Ok(StatsSet::new());
}
Expand Down Expand Up @@ -105,8 +105,7 @@ mod test {
use vortex_schema::{DType, Nullability};

use crate::array::varbin::VarBinArray;
use crate::array::Array;
use crate::stats::ArrayStatistics;
use crate::stats::{ArrayStatistics, Stat};

fn array(dtype: DType) -> VarBinArray {
VarBinArray::from_vec(
Expand Down Expand Up @@ -174,7 +173,7 @@ mod test {
vec![Option::<&str>::None, None, None],
DType::Utf8(Nullability::Nullable),
);
assert!(array.statistics().compute_min().is_none());
assert!(array.statistics().compute_max().is_none());
assert!(array.statistics().get(Stat::Min).is_none());
assert!(array.statistics().get(Stat::Max).is_none());
}
}
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbinview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl VarBinViewArray {
data,
dtype,
validity,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbinview/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::array::Array;
use crate::stats::{Stat, StatsCompute, StatsSet};

impl StatsCompute for VarBinViewArray {
fn compute(&self, _stat: &Stat) -> VortexResult<StatsSet> {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
if self.is_empty() {
return Ok(StatsSet::new());
}
Expand Down
6 changes: 6 additions & 0 deletions vortex-array/src/stats/statsset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ impl From<HashMap<Stat, Scalar>> for StatsSet {
}

impl StatsSet {
pub fn new() -> Self {
Self {
values: HashMap::new(),
}
}

pub fn of(stat: Stat, value: Scalar) -> Self {
StatsSet::from(HashMap::from([(stat, value)]))
}
Expand Down
4 changes: 2 additions & 2 deletions vortex-datetime/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl DateTimeArray {
subsecond,
validity,
dtype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down Expand Up @@ -141,7 +141,7 @@ impl ArrayStatistics for DateTimeArray {

impl StatsCompute for DateTimeArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
1 change: 0 additions & 1 deletion vortex-dict/src/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use vortex::compress::{CompressConfig, CompressCtx, EncodingCompression};
use vortex::match_each_native_ptype;
use vortex::ptype::NativePType;
use vortex::scalar::AsBytes;
use vortex::validity::Validity;
use vortex_error::VortexResult;
use vortex_schema::DType;

Expand Down
2 changes: 1 addition & 1 deletion vortex-dict/src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl DictArray {
Ok(Self {
codes,
values: dict,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-dict/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::dict::DictArray;

impl StatsCompute for DictArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
let mut stats = StatsSet::default();
let mut stats = StatsSet::new();

if let Some(rc) = self.codes().statistics().compute(Stat::RunCount) {
stats.set(Stat::RunCount, rc);
Expand Down
4 changes: 2 additions & 2 deletions vortex-fastlanes/src/bitpacking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl BitPackedArray {
len,
bit_width,
dtype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down Expand Up @@ -177,7 +177,7 @@ impl ArrayDisplay for BitPackedArray {

impl StatsCompute for BitPackedArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
4 changes: 2 additions & 2 deletions vortex-fastlanes/src/delta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl DeltaArray {
bases,
deltas,
validity,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
};

let expected_bases_len = {
Expand Down Expand Up @@ -162,7 +162,7 @@ impl ArrayDisplay for DeltaArray {

impl StatsCompute for DeltaArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
4 changes: 2 additions & 2 deletions vortex-fastlanes/src/for/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl FoRArray {
encoded: child,
reference,
shift,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down Expand Up @@ -120,7 +120,7 @@ impl ArrayDisplay for FoRArray {

impl StatsCompute for FoRArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
4 changes: 2 additions & 2 deletions vortex-ree/src/ree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl REEArray {
validity,
length,
offset,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down Expand Up @@ -161,7 +161,7 @@ impl OwnedValidity for REEArray {

impl StatsCompute for REEArray {
fn compute(&self, _stat: Stat) -> VortexResult<StatsSet> {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-roaring/src/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl RoaringBoolArray {
Self {
bitmap,
length,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
}
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-roaring/src/boolean/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl StatsCompute for RoaringBoolArray {
} {
Ok(StatsSet::of(stat, value))
} else {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion vortex-roaring/src/integer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl RoaringIntArray {
Ok(Self {
bitmap,
ptype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down
2 changes: 1 addition & 1 deletion vortex-roaring/src/integer/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl StatsCompute for RoaringIntArray {
} {
Ok(StatsSet::of(stat, value))
} else {
Ok(StatsSet::default())
Ok(StatsSet::new())
}
}
}
2 changes: 1 addition & 1 deletion vortex-zigzag/src/zigzag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl ZigZagArray {
Ok(Self {
encoded,
dtype,
stats: Arc::new(RwLock::new(StatsSet::default())),
stats: Arc::new(RwLock::new(StatsSet::new())),
})
}

Expand Down

0 comments on commit 04db3c8

Please sign in to comment.