Skip to content

Commit 05aa7b6

Browse files
committed
Move stats into expr module
Signed-off-by: Nicholas Gates <[email protected]>
1 parent 475fd98 commit 05aa7b6

File tree

45 files changed

+276
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+276
-262
lines changed

encodings/datetime-parts/src/compute/take.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use vortex_array::compute::fill_null;
5-
use vortex_array::compute::take;
4+
use vortex_array::Array;
5+
use vortex_array::ArrayRef;
6+
use vortex_array::IntoArray;
7+
use vortex_array::ToCanonical;
68
use vortex_array::compute::TakeKernel;
79
use vortex_array::compute::TakeKernelAdapter;
10+
use vortex_array::compute::fill_null;
11+
use vortex_array::compute::take;
812
use vortex_array::expr::stats::Stat;
913
use vortex_array::register_kernel;
1014
use vortex_array::stats::StatsProvider;
11-
use vortex_array::Array;
12-
use vortex_array::ArrayRef;
13-
use vortex_array::IntoArray;
14-
use vortex_array::ToCanonical;
1515
use vortex_dtype::Nullability;
16-
use vortex_error::vortex_panic;
1716
use vortex_error::VortexResult;
17+
use vortex_error::vortex_panic;
1818
use vortex_scalar::Scalar;
1919

2020
use crate::DateTimePartsArray;
@@ -98,10 +98,10 @@ register_kernel!(TakeKernelAdapter(DateTimePartsVTable).lift());
9898
#[cfg(test)]
9999
mod tests {
100100
use rstest::rstest;
101+
use vortex_array::IntoArray;
101102
use vortex_array::arrays::PrimitiveArray;
102103
use vortex_array::arrays::TemporalArray;
103104
use vortex_array::compute::conformance::take::test_take_conformance;
104-
use vortex_array::IntoArray;
105105
use vortex_buffer::buffer;
106106
use vortex_dtype::datetime::TimeUnit;
107107

encodings/fastlanes/src/for/array/for_compress.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
use num_traits::PrimInt;
55
use num_traits::WrappingSub;
6+
use vortex_array::IntoArray;
67
use vortex_array::arrays::PrimitiveArray;
78
use vortex_array::expr::stats::Stat;
8-
use vortex_array::IntoArray;
9-
use vortex_dtype::match_each_integer_ptype;
109
use vortex_dtype::NativePType;
11-
use vortex_error::vortex_err;
10+
use vortex_dtype::match_each_integer_ptype;
1211
use vortex_error::VortexResult;
12+
use vortex_error::vortex_err;
1313

1414
use crate::FoRArray;
1515

@@ -45,18 +45,18 @@ fn compress_primitive<T: NativePType + WrappingSub + PrimInt>(
4545
#[cfg(test)]
4646
mod test {
4747
use itertools::Itertools;
48+
use vortex_array::ToCanonical;
4849
use vortex_array::assert_arrays_eq;
4950
use vortex_array::stats::StatsProvider;
5051
use vortex_array::validity::Validity;
51-
use vortex_array::ToCanonical;
5252
use vortex_buffer::buffer;
5353
use vortex_dtype::PType;
5454
use vortex_scalar::Scalar;
5555

5656
use super::*;
57+
use crate::BitPackedArray;
5758
use crate::r#for::array::for_decompress::decompress;
5859
use crate::r#for::array::for_decompress::fused_decompress;
59-
use crate::BitPackedArray;
6060

6161
#[test]
6262
fn test_compress_round_trip_small() {

encodings/runend/src/compute/is_constant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use vortex_array::compute::is_constant_opts;
4+
use vortex_array::Array;
55
use vortex_array::compute::IsConstantKernel;
66
use vortex_array::compute::IsConstantKernelAdapter;
77
use vortex_array::compute::IsConstantOpts;
8+
use vortex_array::compute::is_constant_opts;
89
use vortex_array::expr::stats::Stat;
910
use vortex_array::register_kernel;
10-
use vortex_array::Array;
1111
use vortex_error::VortexResult;
1212

1313
use crate::RunEndVTable;

vortex-array/src/array/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ pub use visitor::*;
2020
use vortex_buffer::ByteBuffer;
2121
use vortex_dtype::DType;
2222
use vortex_dtype::Nullability;
23-
use vortex_error::vortex_bail;
24-
use vortex_error::vortex_panic;
2523
use vortex_error::VortexExpect;
2624
use vortex_error::VortexResult;
25+
use vortex_error::vortex_bail;
26+
use vortex_error::vortex_panic;
2727
use vortex_mask::Mask;
2828
use vortex_scalar::Scalar;
2929

30+
use crate::ArrayEq;
31+
use crate::ArrayHash;
32+
use crate::Canonical;
33+
use crate::DynArrayEq;
34+
use crate::DynArrayHash;
3035
use crate::arrays::BoolVTable;
3136
use crate::arrays::ConstantVTable;
3237
use crate::arrays::DecimalVTable;
@@ -39,12 +44,12 @@ use crate::arrays::StructVTable;
3944
use crate::arrays::VarBinVTable;
4045
use crate::arrays::VarBinViewVTable;
4146
use crate::builders::ArrayBuilder;
42-
use crate::compute::is_constant_opts;
4347
use crate::compute::ComputeFn;
4448
use crate::compute::Cost;
4549
use crate::compute::InvocationArgs;
4650
use crate::compute::IsConstantOpts;
4751
use crate::compute::Output;
52+
use crate::compute::is_constant_opts;
4853
use crate::expr::stats::Stat;
4954
use crate::hash;
5055
use crate::serde::ArrayChildren;
@@ -60,11 +65,6 @@ use crate::vtable::OperationsVTable;
6065
use crate::vtable::VTable;
6166
use crate::vtable::ValidityVTable;
6267
use crate::vtable::VisitorVTable;
63-
use crate::ArrayEq;
64-
use crate::ArrayHash;
65-
use crate::Canonical;
66-
use crate::DynArrayEq;
67-
use crate::DynArrayHash;
6868

6969
/// The public API trait for all Vortex arrays.
7070
pub trait Array:

vortex-array/src/arrays/constant/compute/sum.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
use num_traits::AsPrimitive;
55
use num_traits::CheckedAdd;
66
use num_traits::CheckedMul;
7-
use vortex_dtype::i256;
8-
use vortex_dtype::match_each_native_ptype;
97
use vortex_dtype::DType;
108
use vortex_dtype::DecimalDType;
119
use vortex_dtype::NativePType;
1210
use vortex_dtype::Nullability;
13-
use vortex_error::vortex_bail;
14-
use vortex_error::vortex_err;
11+
use vortex_dtype::i256;
12+
use vortex_dtype::match_each_native_ptype;
1513
use vortex_error::VortexExpect;
1614
use vortex_error::VortexResult;
15+
use vortex_error::vortex_bail;
16+
use vortex_error::vortex_err;
1717
use vortex_scalar::DecimalScalar;
1818
use vortex_scalar::DecimalValue;
1919
use vortex_scalar::PrimitiveScalar;
@@ -169,22 +169,22 @@ register_kernel!(SumKernelAdapter(ConstantVTable).lift());
169169

170170
#[cfg(test)]
171171
mod tests {
172-
use vortex_dtype::i256;
173172
use vortex_dtype::DType;
174173
use vortex_dtype::DecimalDType;
175174
use vortex_dtype::Nullability;
176175
use vortex_dtype::Nullability::Nullable;
177176
use vortex_dtype::PType;
177+
use vortex_dtype::i256;
178178
use vortex_error::VortexUnwrap;
179179
use vortex_scalar::DecimalValue;
180180
use vortex_scalar::Scalar;
181181

182+
use crate::Array;
183+
use crate::IntoArray;
182184
use crate::arrays::ConstantArray;
183185
use crate::compute::sum;
184186
use crate::compute::sum_with_accumulator;
185187
use crate::expr::stats::Stat;
186-
use crate::Array;
187-
use crate::IntoArray;
188188

189189
#[test]
190190
fn test_sum_unsigned() {

vortex-array/src/arrays/constant/vtable/canonical.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
use std::sync::Arc;
55

6-
use vortex_buffer::buffer;
76
use vortex_buffer::BitBuffer;
87
use vortex_buffer::Buffer;
9-
use vortex_dtype::match_each_decimal_value;
10-
use vortex_dtype::match_each_decimal_value_type;
11-
use vortex_dtype::match_each_native_ptype;
8+
use vortex_buffer::buffer;
129
use vortex_dtype::DType;
1310
use vortex_dtype::DecimalType;
1411
use vortex_dtype::Nullability;
12+
use vortex_dtype::match_each_decimal_value;
13+
use vortex_dtype::match_each_decimal_value_type;
14+
use vortex_dtype::match_each_native_ptype;
1515
use vortex_error::VortexExpect;
1616
use vortex_scalar::BinaryScalar;
1717
use vortex_scalar::BoolScalar;
@@ -23,8 +23,8 @@ use vortex_scalar::StructScalar;
2323
use vortex_scalar::Utf8Scalar;
2424
use vortex_vector::binaryview::BinaryView;
2525

26-
use crate::arrays::constant::ConstantArray;
27-
use crate::arrays::primitive::PrimitiveArray;
26+
use crate::Canonical;
27+
use crate::IntoArray;
2828
use crate::arrays::BoolArray;
2929
use crate::arrays::ConstantVTable;
3030
use crate::arrays::DecimalArray;
@@ -34,11 +34,11 @@ use crate::arrays::ListViewArray;
3434
use crate::arrays::NullArray;
3535
use crate::arrays::StructArray;
3636
use crate::arrays::VarBinViewArray;
37+
use crate::arrays::constant::ConstantArray;
38+
use crate::arrays::primitive::PrimitiveArray;
3739
use crate::builders::builder_with_capacity;
3840
use crate::validity::Validity;
3941
use crate::vtable::CanonicalVTable;
40-
use crate::Canonical;
41-
use crate::IntoArray;
4242

4343
impl CanonicalVTable<ConstantVTable> for ConstantVTable {
4444
fn canonicalize(array: &ConstantArray) -> Canonical {
@@ -325,21 +325,21 @@ mod tests {
325325

326326
use enum_iterator::all;
327327
use itertools::Itertools;
328-
use vortex_dtype::half::f16;
329328
use vortex_dtype::DType;
330329
use vortex_dtype::Nullability;
331330
use vortex_dtype::PType;
331+
use vortex_dtype::half::f16;
332332
use vortex_scalar::Scalar;
333333

334+
use crate::Array;
335+
use crate::IntoArray;
334336
use crate::arrays::ConstantArray;
335337
use crate::arrays::ListViewRebuildMode;
336338
use crate::canonical::ToCanonical;
337339
use crate::expr::stats::Stat;
338340
use crate::stats::StatsProvider;
339341
use crate::validity::Validity;
340342
use crate::vtable::ValidityHelper;
341-
use crate::Array;
342-
use crate::IntoArray;
343343

344344
#[test]
345345
fn test_canonicalize_null() {

vortex-array/src/arrays/decimal/compute/sum.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use num_traits::AsPrimitive;
66
use num_traits::CheckedAdd;
77
use vortex_buffer::BitBuffer;
88
use vortex_buffer::Buffer;
9-
use vortex_dtype::match_each_decimal_value_type;
109
use vortex_dtype::DecimalType;
1110
use vortex_dtype::Nullability::Nullable;
12-
use vortex_error::vortex_bail;
11+
use vortex_dtype::match_each_decimal_value_type;
1312
use vortex_error::VortexExpect;
1413
use vortex_error::VortexResult;
14+
use vortex_error::vortex_bail;
1515
use vortex_mask::Mask;
1616
use vortex_scalar::DecimalScalar;
1717
use vortex_scalar::DecimalValue;
@@ -130,10 +130,10 @@ mod tests {
130130
use vortex_dtype::DecimalDType;
131131
use vortex_dtype::Nullability;
132132
use vortex_error::VortexUnwrap;
133-
use vortex_scalar::i256;
134133
use vortex_scalar::DecimalValue;
135134
use vortex_scalar::Scalar;
136135
use vortex_scalar::ScalarValue;
136+
use vortex_scalar::i256;
137137

138138
use crate::arrays::DecimalArray;
139139
use crate::compute::sum;

vortex-array/src/arrays/varbin/compute/min_max.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
use itertools::Itertools;
55
use vortex_dtype::DType;
66
use vortex_dtype::Nullability::NonNullable;
7-
use vortex_error::vortex_panic;
87
use vortex_error::VortexResult;
8+
use vortex_error::vortex_panic;
99
use vortex_scalar::Scalar;
1010

1111
use crate::accessor::ArrayAccessor;
@@ -68,8 +68,8 @@ mod tests {
6868
use vortex_scalar::Scalar;
6969

7070
use crate::arrays::VarBinArray;
71-
use crate::compute::min_max;
7271
use crate::compute::MinMaxResult;
72+
use crate::compute::min_max;
7373
use crate::expr::stats::Stat;
7474
use crate::stats::StatsProvider;
7575

vortex-array/src/compute/is_constant.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ use std::sync::LazyLock;
77
use arcref::ArcRef;
88
use vortex_dtype::DType;
99
use vortex_dtype::Nullability;
10-
use vortex_error::vortex_bail;
11-
use vortex_error::vortex_err;
1210
use vortex_error::VortexError;
1311
use vortex_error::VortexResult;
12+
use vortex_error::vortex_bail;
13+
use vortex_error::vortex_err;
1414
use vortex_scalar::Scalar;
1515

16+
use crate::Array;
1617
use crate::arrays::ConstantVTable;
1718
use crate::arrays::NullVTable;
1819
use crate::compute::ComputeFn;
@@ -26,7 +27,6 @@ use crate::stats::Precision;
2627
use crate::stats::StatsProvider;
2728
use crate::stats::StatsProviderExt;
2829
use crate::vtable::VTable;
29-
use crate::Array;
3030

3131
static IS_CONSTANT_FN: LazyLock<ComputeFn> = LazyLock::new(|| {
3232
let compute = ComputeFn::new("is_constant".into(), ArcRef::new_ref(&IsConstant));
@@ -305,9 +305,9 @@ impl IsConstantOpts {
305305
mod tests {
306306
use vortex_buffer::buffer;
307307

308+
use crate::IntoArray as _;
308309
use crate::arrays::PrimitiveArray;
309310
use crate::expr::stats::Stat;
310-
use crate::IntoArray as _;
311311

312312
#[test]
313313
fn is_constant_min_max_no_nan() {

vortex-array/src/compute/is_sorted.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ use std::sync::LazyLock;
77
use arcref::ArcRef;
88
use vortex_dtype::DType;
99
use vortex_dtype::Nullability;
10-
use vortex_error::vortex_bail;
11-
use vortex_error::vortex_err;
1210
use vortex_error::VortexError;
1311
use vortex_error::VortexResult;
12+
use vortex_error::vortex_bail;
13+
use vortex_error::vortex_err;
1414
use vortex_scalar::Scalar;
1515

16+
use crate::Array;
1617
use crate::arrays::ConstantVTable;
1718
use crate::arrays::NullVTable;
1819
use crate::compute::ComputeFn;
@@ -25,7 +26,6 @@ use crate::expr::stats::Stat;
2526
use crate::stats::Precision;
2627
use crate::stats::StatsProviderExt;
2728
use crate::vtable::VTable;
28-
use crate::Array;
2929

3030
static IS_SORTED_FN: LazyLock<ComputeFn> = LazyLock::new(|| {
3131
let compute = ComputeFn::new("is_sorted".into(), ArcRef::new_ref(&IsSorted));
@@ -309,12 +309,12 @@ fn is_sorted_impl(
309309
mod tests {
310310
use vortex_buffer::buffer;
311311

312+
use crate::IntoArray;
312313
use crate::arrays::BoolArray;
313314
use crate::arrays::PrimitiveArray;
314315
use crate::compute::is_sorted;
315316
use crate::compute::is_strict_sorted;
316317
use crate::validity::Validity;
317-
use crate::IntoArray;
318318
#[test]
319319
fn test_is_sorted() {
320320
assert!(

0 commit comments

Comments
 (0)