Skip to content

Commit 40ea250

Browse files
authored
demo module level imports granularity (#485)
if we're already using a nightly toolchain, this & `group_imports` => only a single way for imports to be ordered
1 parent ade9cc1 commit 40ea250

File tree

57 files changed

+100
-173
lines changed

Some content is hidden

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

57 files changed

+100
-173
lines changed

bench-vortex/src/reader.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ use vortex_buffer::Buffer;
3232
use vortex_dtype::DType;
3333
use vortex_error::{vortex_err, VortexResult};
3434
use vortex_ipc::chunked_reader::ChunkedArrayReader;
35-
use vortex_ipc::io::ObjectStoreExt;
36-
use vortex_ipc::io::{TokioAdapter, VortexReadAt, VortexWrite};
35+
use vortex_ipc::io::{ObjectStoreExt, TokioAdapter, VortexReadAt, VortexWrite};
3736
use vortex_ipc::writer::ArrayWriter;
3837
use vortex_ipc::MessageReader;
3938
use vortex_sampling_compressor::SamplingCompressor;

encodings/alp/src/compute.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use vortex::{Array, IntoArray};
44
use vortex_error::VortexResult;
55
use vortex_scalar::Scalar;
66

7-
use crate::ALPFloat;
8-
use crate::{match_each_alp_float_ptype, ALPArray};
7+
use crate::{match_each_alp_float_ptype, ALPArray, ALPFloat};
98

109
impl ArrayCompute for ALPArray {
1110
fn scalar_at(&self) -> Option<&dyn ScalarAtFn> {

encodings/byte_bool/src/compute/mod.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ use std::sync::Arc;
33

44
use arrow_buffer::BooleanBuffer;
55
use num_traits::AsPrimitive;
6+
use vortex::compute::unary::fill_forward::FillForwardFn;
7+
use vortex::compute::unary::scalar_at::ScalarAtFn;
68
use vortex::compute::{ArrayCompute, CompareFn, SliceFn, TakeFn};
7-
use vortex::validity::Validity;
8-
use vortex::Array;
9-
use vortex::{
10-
compute::{unary::fill_forward::FillForwardFn, unary::scalar_at::ScalarAtFn},
11-
encoding::ArrayEncodingRef,
12-
stats::StatsSet,
13-
validity::ArrayValidity,
14-
ArrayDType, ArrayData, IntoArray,
15-
};
16-
use vortex::{IntoArrayVariant, ToArrayData};
9+
use vortex::encoding::ArrayEncodingRef;
10+
use vortex::stats::StatsSet;
11+
use vortex::validity::{ArrayValidity, Validity};
12+
use vortex::{Array, ArrayDType, ArrayData, IntoArray, IntoArrayVariant, ToArrayData};
1713
use vortex_dtype::{match_each_integer_ptype, Nullability};
1814
use vortex_error::{vortex_bail, VortexResult};
1915
use vortex_expr::Operator;
@@ -186,11 +182,9 @@ impl FillForwardFn for ByteBoolArray {
186182

187183
#[cfg(test)]
188184
mod tests {
189-
use vortex::{
190-
compute::unary::scalar_at::scalar_at,
191-
compute::{compare, slice},
192-
AsArray as _,
193-
};
185+
use vortex::compute::unary::scalar_at::scalar_at;
186+
use vortex::compute::{compare, slice};
187+
use vortex::AsArray as _;
194188

195189
use super::*;
196190

encodings/byte_bool/src/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ use std::mem::ManuallyDrop;
33
use arrow_buffer::BooleanBuffer;
44
use serde::{Deserialize, Serialize};
55
use vortex::array::bool::BoolArray;
6+
use vortex::validity::{ArrayValidity, LogicalValidity, Validity, ValidityMetadata};
67
use vortex::variants::{ArrayVariants, BoolArrayTrait};
7-
use vortex::{
8-
impl_encoding,
9-
validity::{ArrayValidity, LogicalValidity, Validity, ValidityMetadata},
10-
visitor::{AcceptArrayVisitor, ArrayVisitor},
11-
};
12-
use vortex::{Canonical, IntoCanonical};
8+
use vortex::visitor::{AcceptArrayVisitor, ArrayVisitor};
9+
use vortex::{impl_encoding, Canonical, IntoCanonical};
1310
use vortex_buffer::Buffer;
1411

1512
mod compute;

encodings/byte_bool/src/stats.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
use vortex::{
2-
stats::{ArrayStatisticsCompute, Stat, StatsSet},
3-
AsArray, IntoArrayVariant,
4-
};
1+
use vortex::stats::{ArrayStatisticsCompute, Stat, StatsSet};
2+
use vortex::{AsArray, IntoArrayVariant};
53
use vortex_error::VortexResult;
64

75
use super::ByteBoolArray;

encodings/datetime-parts/src/compute.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use vortex::array::datetime::temporal::TemporalMetadata;
22
use vortex::array::datetime::{TemporalArray, TimeUnit};
33
use vortex::array::primitive::PrimitiveArray;
44
use vortex::compute::unary::scalar_at::{scalar_at, ScalarAtFn};
5-
use vortex::compute::ArrayCompute;
6-
use vortex::compute::{slice, take, SliceFn, TakeFn};
5+
use vortex::compute::{slice, take, ArrayCompute, SliceFn, TakeFn};
76
use vortex::validity::ArrayValidity;
87
use vortex::{Array, ArrayDType, IntoArray, IntoArrayVariant};
98
use vortex_dtype::DType;

encodings/dict/src/compress.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use vortex::array::primitive::PrimitiveArray;
99
use vortex::array::varbin::VarBinArray;
1010
use vortex::validity::Validity;
1111
use vortex::{ArrayDType, IntoArray};
12-
use vortex_dtype::{match_each_native_ptype, DType};
13-
use vortex_dtype::{NativePType, ToBytes};
12+
use vortex_dtype::{match_each_native_ptype, DType, NativePType, ToBytes};
1413

1514
#[derive(Debug)]
1615
struct Value<T>(T);

encodings/fastlanes/src/bitpacking/compress.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use vortex::array::primitive::PrimitiveArray;
55
use vortex::array::sparse::{Sparse, SparseArray};
66
use vortex::stats::ArrayStatistics;
77
use vortex::validity::Validity;
8-
use vortex::IntoArrayVariant;
9-
use vortex::{Array, ArrayDType, ArrayDef, IntoArray};
8+
use vortex::{Array, ArrayDType, ArrayDef, IntoArray, IntoArrayVariant};
109
use vortex_dtype::{
1110
match_each_integer_ptype, match_each_unsigned_integer_ptype, NativePType, PType,
1211
};
@@ -307,8 +306,7 @@ pub fn count_exceptions(bit_width: usize, bit_width_freq: &[usize]) -> usize {
307306

308307
#[cfg(test)]
309308
mod test {
310-
use vortex::IntoArrayVariant;
311-
use vortex::ToArray;
309+
use vortex::{IntoArrayVariant, ToArray};
312310
use vortex_scalar::PrimitiveScalar;
313311

314312
use super::*;

encodings/fastlanes/src/bitpacking/compute/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use vortex::compute::unary::scalar_at::{scalar_at, ScalarAtFn};
2-
use vortex::compute::ArrayCompute;
3-
use vortex::compute::{SearchSortedFn, SliceFn, TakeFn};
2+
use vortex::compute::{ArrayCompute, SearchSortedFn, SliceFn, TakeFn};
43
use vortex::ArrayDType;
54
use vortex_error::{vortex_err, VortexResult};
65
use vortex_scalar::Scalar;

encodings/fastlanes/src/delta/compress.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use vortex::array::primitive::PrimitiveArray;
55
use vortex::compute::unary::fill_forward::fill_forward;
66
use vortex::validity::Validity;
77
use vortex::IntoArrayVariant;
8-
use vortex_dtype::NativePType;
9-
use vortex_dtype::{match_each_unsigned_integer_ptype, Nullability};
8+
use vortex_dtype::{match_each_unsigned_integer_ptype, NativePType, Nullability};
109
use vortex_error::VortexResult;
1110

1211
use crate::DeltaArray;

encodings/fastlanes/src/delta/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
pub use compress::*;
22
use serde::{Deserialize, Serialize};
33
use vortex::stats::ArrayStatisticsCompute;
4-
use vortex::validity::ValidityMetadata;
5-
use vortex::validity::{ArrayValidity, LogicalValidity, Validity};
4+
use vortex::validity::{ArrayValidity, LogicalValidity, Validity, ValidityMetadata};
65
use vortex::variants::{ArrayVariants, PrimitiveArrayTrait};
76
use vortex::visitor::{AcceptArrayVisitor, ArrayVisitor};
87
use vortex::{impl_encoding, ArrayDType, Canonical, IntoCanonical};

encodings/roaring/src/boolean/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use arrow_buffer::BooleanBuffer;
2-
use arrow_buffer::Buffer as ArrowBuffer;
1+
use arrow_buffer::{BooleanBuffer, Buffer as ArrowBuffer};
32
pub use compress::*;
43
use croaring::{Bitmap, Portable};
54
use serde::{Deserialize, Serialize};
@@ -10,8 +9,7 @@ use vortex::variants::{ArrayVariants, BoolArrayTrait};
109
use vortex::visitor::{AcceptArrayVisitor, ArrayVisitor};
1110
use vortex::{impl_encoding, ArrayDType, Canonical, IntoCanonical};
1211
use vortex_buffer::Buffer;
13-
use vortex_dtype::Nullability::NonNullable;
14-
use vortex_dtype::Nullability::Nullable;
12+
use vortex_dtype::Nullability::{NonNullable, Nullable};
1513
use vortex_error::{vortex_bail, vortex_err};
1614

1715
mod compress;

encodings/runend/src/compress.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use vortex::array::primitive::PrimitiveArray;
66
use vortex::stats::{ArrayStatistics, Stat};
77
use vortex::validity::Validity;
88
use vortex::ArrayDType;
9-
use vortex_dtype::Nullability;
10-
use vortex_dtype::{match_each_integer_ptype, match_each_native_ptype, NativePType};
9+
use vortex_dtype::{match_each_integer_ptype, match_each_native_ptype, NativePType, Nullability};
1110
use vortex_error::VortexResult;
1211

1312
pub fn runend_encode(array: &PrimitiveArray) -> (PrimitiveArray, PrimitiveArray) {

encodings/runend/src/compute.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use vortex::array::primitive::PrimitiveArray;
22
use vortex::compute::unary::scalar_at::{scalar_at, ScalarAtFn};
3-
use vortex::compute::ArrayCompute;
4-
use vortex::compute::{slice, take, SliceFn, TakeFn};
3+
use vortex::compute::{slice, take, ArrayCompute, SliceFn, TakeFn};
54
use vortex::{Array, IntoArray, IntoArrayVariant};
65
use vortex_dtype::match_each_integer_ptype;
76
use vortex_error::VortexResult;

pyvortex/src/array.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ use vortex::array::varbin::{VarBin, VarBinArray, VarBinEncoding};
1010
use vortex::array::varbinview::{VarBinView, VarBinViewArray, VarBinViewEncoding};
1111
use vortex::compute::take;
1212
use vortex::encoding::EncodingRef;
13-
use vortex::ToArray;
14-
use vortex::{Array, ArrayDType, ArrayData, IntoArray};
15-
use vortex::{ArrayDef, IntoArrayData};
13+
use vortex::{Array, ArrayDType, ArrayData, ArrayDef, IntoArray, IntoArrayData, ToArray};
1614
use vortex_alp::{ALPArray, ALPEncoding, ALP};
1715
use vortex_dict::{Dict, DictArray, DictEncoding};
1816
use vortex_fastlanes::{

rustfmt.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ format_macro_matchers = true
33
format_macro_bodies = true
44
group_imports = "StdExternalCrate"
55
unstable_features = true
6-
use_field_init_shorthand = true
6+
use_field_init_shorthand = true
7+
imports_granularity = "Module"

vortex-array/benches/filter_indices.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use rand::{thread_rng, Rng};
55
use vortex::IntoArray;
66
use vortex_dtype::field::FieldPath;
77
use vortex_error::VortexError;
8-
use vortex_expr::FieldPathOperations;
9-
use vortex_expr::{lit, Conjunction, Disjunction};
8+
use vortex_expr::{lit, Conjunction, Disjunction, FieldPathOperations};
109

1110
fn filter_indices(c: &mut Criterion) {
1211
let mut group = c.benchmark_group("filter_indices");

vortex-array/src/array/bool/compute/slice.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ mod tests {
1919

2020
use super::*;
2121
use crate::compute::slice;
22+
use crate::compute::unary::scalar_at::scalar_at;
2223
use crate::validity::ArrayValidity;
23-
use crate::{compute::unary::scalar_at::scalar_at, AsArray};
24+
use crate::AsArray;
2425

2526
#[test]
2627
fn test_slice() {

vortex-array/src/array/bool/compute/take.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use vortex_error::VortexResult;
55

66
use crate::array::bool::BoolArray;
77
use crate::compute::TakeFn;
8-
use crate::Array;
9-
use crate::IntoArray;
10-
use crate::{AsArray, IntoArrayVariant};
8+
use crate::{Array, AsArray, IntoArray, IntoArrayVariant};
119

1210
impl TakeFn for BoolArray {
1311
fn take(&self, indices: &Array) -> VortexResult<Array> {

vortex-array/src/array/bool/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use itertools::Itertools;
33
use serde::{Deserialize, Serialize};
44
use vortex_buffer::Buffer;
55

6-
use crate::validity::{ArrayValidity, ValidityMetadata};
7-
use crate::validity::{LogicalValidity, Validity};
6+
use crate::validity::{ArrayValidity, LogicalValidity, Validity, ValidityMetadata};
87
use crate::variants::{ArrayVariants, BoolArrayTrait};
98
use crate::visitor::{AcceptArrayVisitor, ArrayVisitor};
109
use crate::{impl_encoding, Canonical, IntoCanonical};

vortex-array/src/array/chunked/compute/take.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use crate::compute::unary::scalar_at::scalar_at;
1010
use crate::compute::unary::scalar_subtract::subtract_scalar;
1111
use crate::compute::{search_sorted, slice, take, SearchSortedSide, TakeFn};
1212
use crate::stats::ArrayStatistics;
13-
use crate::ArrayDType;
14-
use crate::{Array, IntoArray, ToArray};
13+
use crate::{Array, ArrayDType, IntoArray, ToArray};
1514

1615
impl TakeFn for ChunkedArray {
1716
fn take(&self, indices: &Array) -> VortexResult<Array> {

vortex-array/src/array/chunked/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ impl SubtractScalarFn for ChunkedArray {
162162

163163
#[cfg(test)]
164164
mod test {
165-
use vortex_dtype::{DType, Nullability};
166-
use vortex_dtype::{NativePType, PType};
165+
use vortex_dtype::{DType, NativePType, Nullability, PType};
167166

168167
use crate::array::chunked::ChunkedArray;
169168
use crate::compute::slice;

vortex-array/src/array/chunked/stats.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use vortex_error::VortexResult;
22

33
use crate::array::chunked::ChunkedArray;
4-
use crate::stats::ArrayStatistics;
5-
use crate::stats::{ArrayStatisticsCompute, Stat, StatsSet};
4+
use crate::stats::{ArrayStatistics, ArrayStatisticsCompute, Stat, StatsSet};
65

76
impl ArrayStatisticsCompute for ChunkedArray {
87
fn compute_statistics(&self, stat: Stat) -> VortexResult<StatsSet> {

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use crate::array::constant::ConstantArray;
99
use crate::array::primitive::PrimitiveArray;
1010
use crate::array::varbin::VarBinArray;
1111
use crate::validity::Validity;
12-
use crate::ArrayDType;
13-
use crate::{Canonical, IntoCanonical};
12+
use crate::{ArrayDType, Canonical, IntoCanonical};
1413

1514
impl IntoCanonical for ConstantArray {
1615
fn into_canonical(self) -> VortexResult<Canonical> {

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use vortex_scalar::Scalar;
55

66
use crate::array::constant::ConstantArray;
77
use crate::compute::unary::scalar_at::ScalarAtFn;
8-
use crate::compute::{ArrayCompute, SliceFn, TakeFn};
9-
use crate::compute::{SearchResult, SearchSortedFn, SearchSortedSide};
8+
use crate::compute::{
9+
ArrayCompute, SearchResult, SearchSortedFn, SearchSortedSide, SliceFn, TakeFn,
10+
};
1011
use crate::{Array, IntoArray};
1112

1213
impl ArrayCompute for ConstantArray {

vortex-array/src/array/extension/compute.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use vortex_scalar::Scalar;
44
use crate::array::extension::ExtensionArray;
55
use crate::compute::unary::cast::CastFn;
66
use crate::compute::unary::scalar_at::{scalar_at, ScalarAtFn};
7-
use crate::compute::ArrayCompute;
8-
use crate::compute::{slice, take, SliceFn, TakeFn};
7+
use crate::compute::{slice, take, ArrayCompute, SliceFn, TakeFn};
98
use crate::{Array, IntoArray};
109

1110
impl ArrayCompute for ExtensionArray {

vortex-array/src/array/null/compute.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use vortex_scalar::Scalar;
44

55
use crate::array::null::NullArray;
66
use crate::compute::unary::scalar_at::ScalarAtFn;
7-
use crate::compute::ArrayCompute;
8-
use crate::compute::{SliceFn, TakeFn};
7+
use crate::compute::{ArrayCompute, SliceFn, TakeFn};
98
use crate::{Array, IntoArray, IntoArrayVariant};
109

1110
impl ArrayCompute for NullArray {
@@ -57,9 +56,8 @@ mod test {
5756
use vortex_dtype::DType;
5857

5958
use crate::array::null::NullArray;
60-
use crate::compute::slice;
61-
use crate::compute::take;
6259
use crate::compute::unary::scalar_at::scalar_at;
60+
use crate::compute::{slice, take};
6361
use crate::validity::{ArrayValidity, LogicalValidity};
6462
use crate::IntoArray;
6563

vortex-array/src/array/primitive/compute/cast.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
use vortex_dtype::{match_each_native_ptype, DType};
2-
use vortex_dtype::{NativePType, PType};
1+
use vortex_dtype::{match_each_native_ptype, DType, NativePType, PType};
32
use vortex_error::{vortex_err, VortexResult};
43

54
use crate::array::primitive::PrimitiveArray;
65
use crate::compute::unary::cast::CastFn;
76
use crate::validity::Validity;
8-
use crate::IntoArray;
9-
use crate::{Array, ArrayDType};
7+
use crate::{Array, ArrayDType, IntoArray};
108

119
impl CastFn for PrimitiveArray {
1210
fn cast(&self, dtype: &DType) -> VortexResult<Array> {

vortex-array/src/array/primitive/compute/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use crate::compute::unary::cast::CastFn;
33
use crate::compute::unary::fill_forward::FillForwardFn;
44
use crate::compute::unary::scalar_at::ScalarAtFn;
55
use crate::compute::unary::scalar_subtract::SubtractScalarFn;
6-
use crate::compute::FilterIndicesFn;
7-
use crate::compute::SearchSortedFn;
8-
use crate::compute::{ArrayCompute, CompareFn, SliceFn, TakeFn};
6+
use crate::compute::{ArrayCompute, CompareFn, FilterIndicesFn, SearchSortedFn, SliceFn, TakeFn};
97

108
mod cast;
119
mod compare;

vortex-array/src/array/primitive/compute/slice.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use vortex_error::VortexResult;
22

33
use crate::array::primitive::PrimitiveArray;
44
use crate::compute::SliceFn;
5-
use crate::Array;
6-
use crate::IntoArray;
5+
use crate::{Array, IntoArray};
76

87
impl SliceFn for PrimitiveArray {
98
fn slice(&self, start: usize, stop: usize) -> VortexResult<Array> {

vortex-array/src/array/primitive/compute/subtract_scalar.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use itertools::Itertools;
22
use num_traits::WrappingSub;
33
use vortex_dtype::{match_each_float_ptype, match_each_integer_ptype, NativePType};
44
use vortex_error::{vortex_bail, vortex_err, VortexError, VortexResult};
5-
use vortex_scalar::PrimitiveScalar;
6-
use vortex_scalar::Scalar;
5+
use vortex_scalar::{PrimitiveScalar, Scalar};
76

87
use crate::array::constant::ConstantArray;
98
use crate::array::primitive::PrimitiveArray;

vortex-array/src/array/primitive/compute/take.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
use num_traits::PrimInt;
2-
use vortex_dtype::NativePType;
3-
use vortex_dtype::{match_each_integer_ptype, match_each_native_ptype};
2+
use vortex_dtype::{match_each_integer_ptype, match_each_native_ptype, NativePType};
43
use vortex_error::VortexResult;
54

65
use crate::array::primitive::PrimitiveArray;
76
use crate::compute::TakeFn;
8-
use crate::Array;
9-
use crate::{IntoArray, IntoArrayVariant};
7+
use crate::{Array, IntoArray, IntoArrayVariant};
108

119
impl TakeFn for PrimitiveArray {
1210
fn take(&self, indices: &Array) -> VortexResult<Array> {

0 commit comments

Comments
 (0)