Skip to content

Commit a04db78

Browse files
committed
some adjustments
Signed-off-by: Connor Tsui <[email protected]>
1 parent 7c36634 commit a04db78

25 files changed

Lines changed: 48 additions & 54 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ jobs:
666666
matrix:
667667
include:
668668
- { shard: 1, name: "Core foundation", packages: "vortex-buffer vortex-error" }
669-
- { shard: 2, name: "Arrays", packages: "vortex-array vortex-dtype", features: "--features _test-harness" }
669+
- { shard: 2, name: "Arrays", packages: "vortex-array", features: "--features _test-harness" }
670670
- { shard: 3, name: "Main library", packages: "vortex" }
671671
- { shard: 4, name: "Encodings 1", packages: "vortex-alp vortex-bytebool vortex-datetime-parts" }
672672
- { shard: 5, name: "Encodings 2", packages: "vortex-decimal-byte-parts vortex-fastlanes vortex-fsst", features: "--features _test-harness" }

‎vortex-array/src/arrays/arbitrary.rs‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,16 @@ fn random_array_chunk(
114114
},
115115
d @ DType::Decimal(decimal, n) => {
116116
let elem_len = chunk_len.unwrap_or(u.int_in_range(0..=20)?);
117-
match_each_decimal_value_type!(
118-
DecimalType::smallest_decimal_value_type(decimal),
119-
|DVT| {
120-
let mut builder = DecimalBuilder::new::<DVT>(*decimal, *n);
121-
for _i in 0..elem_len {
122-
let random_decimal = random_scalar(u, d)?;
123-
builder.append_scalar(&random_decimal).vortex_expect(
124-
"was somehow unable to append a decimal to a decimal builder",
125-
);
126-
}
127-
Ok(builder.finish())
117+
match_each_decimal_value_type!(DecimalType::smallest_decimal_value_type(decimal), |D| {
118+
let mut builder = DecimalBuilder::new::<D>(*decimal, *n);
119+
for _i in 0..elem_len {
120+
let random_decimal = random_scalar(u, d)?;
121+
builder.append_scalar(&random_decimal).vortex_expect(
122+
"was somehow unable to append a decimal to a decimal builder",
123+
);
128124
}
129-
)
125+
Ok(builder.finish())
126+
})
130127
}
131128
DType::Utf8(n) => random_string(u, *n, chunk_len),
132129
DType::Binary(n) => random_bytes(u, *n, chunk_len),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ fn sum_scalar(
6060
.map(|v| ScalarValue::Primitive(v.into())))
6161
}
6262
DType::Primitive(ptype, _) => {
63+
#[expect(dead_code, reason = "TODO(connor): good question")]
6364
let result = match_each_native_ptype!(
6465
ptype,
6566
unsigned: |T| { sum_integral::<u64>(scalar.as_primitive(), len, accumulator)?.map(|v| ScalarValue::Primitive(v.into())) },

‎vortex-array/src/arrays/decimal/array.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use crate::vtable::ValidityHelper;
7070
///
7171
/// ```
7272
/// use vortex_array::arrays::DecimalArray;
73-
/// use crate::dtype::DecimalDType;
73+
/// use vortex_array::dtype::DecimalDType;
7474
/// use vortex_buffer::{buffer, Buffer};
7575
/// use vortex_array::validity::Validity;
7676
///

‎vortex-array/src/arrays/primitive/compute/rules.rs‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::arrays::PrimitiveArray;
1111
use crate::arrays::PrimitiveVTable;
1212
use crate::arrays::SliceReduceAdaptor;
1313
use crate::expr::MaskReduceAdaptor;
14-
use crate::match_each_native_ptype;
1514
use crate::optimizer::rules::ArrayParentReduceRule;
1615
use crate::optimizer::rules::ParentRuleSet;
1716
use crate::vtable::ValidityHelper;
@@ -38,20 +37,19 @@ impl ArrayParentReduceRule<PrimitiveVTable> for PrimitiveMaskedValidityRule {
3837
parent: &MaskedArray,
3938
_child_idx: usize,
4039
) -> VortexResult<Option<ArrayRef>> {
41-
// Merge the parent's validity mask into the child's validity
4240
// TODO(joe): make this lazy
43-
let masked_array = match_each_native_ptype!(array.ptype(), |T| {
44-
// SAFETY: masking validity does not change PrimitiveArray invariants
45-
unsafe {
46-
PrimitiveArray::new_unchecked_from_handle(
47-
array.buffer_handle().clone(),
48-
array.ptype(),
49-
array.validity().clone().and(parent.validity().clone())?,
50-
)
51-
}
52-
.into_array()
53-
});
54-
55-
Ok(Some(masked_array))
41+
// Merge the parent's validity mask into the child's validity
42+
let new_validity = array.validity().clone().and(parent.validity().clone())?;
43+
44+
// SAFETY: masking validity does not change PrimitiveArray invariants
45+
let masked_array = unsafe {
46+
PrimitiveArray::new_unchecked_from_handle(
47+
array.buffer_handle().clone(),
48+
array.ptype(),
49+
new_validity,
50+
)
51+
};
52+
53+
Ok(Some(masked_array.into_array()))
5654
}
5755
}

‎vortex-array/src/arrays/struct_/array.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ use crate::vtable::ValidityHelper;
4343
/// ```
4444
/// use vortex_array::arrays::{StructArray, BoolArray};
4545
/// use vortex_array::validity::Validity;
46+
/// use vortex_array::dtype::FieldNames;
4647
/// use vortex_array::IntoArray;
47-
/// use crate::dtype::FieldNames;
4848
/// use vortex_buffer::buffer;
4949
///
5050
/// // Create struct with all non-null fields but struct-level nulls
@@ -76,8 +76,8 @@ use crate::vtable::ValidityHelper;
7676
/// ```
7777
/// use vortex_array::arrays::StructArray;
7878
/// use vortex_array::validity::Validity;
79+
/// use vortex_array::dtype::FieldNames;
7980
/// use vortex_array::IntoArray;
80-
/// use crate::dtype::FieldNames;
8181
/// use vortex_buffer::buffer;
8282
///
8383
/// // Create struct with duplicate "data" field names
@@ -116,8 +116,8 @@ use crate::vtable::ValidityHelper;
116116
/// ```
117117
/// use vortex_array::arrays::{StructArray, PrimitiveArray};
118118
/// use vortex_array::validity::Validity;
119+
/// use vortex_array::dtype::FieldNames;
119120
/// use vortex_array::IntoArray;
120-
/// use crate::dtype::FieldNames;
121121
/// use vortex_buffer::buffer;
122122
///
123123
/// // Create arrays for each field

‎vortex-array/src/arrays/varbinview/array.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use crate::validity::Validity;
6363
///
6464
/// ```
6565
/// use vortex_array::arrays::VarBinViewArray;
66-
/// use crate::dtype::{DType, Nullability};
66+
/// use vortex_array::dtype::{DType, Nullability};
6767
/// use vortex_array::IntoArray;
6868
///
6969
/// // Create from an Iterator<Item = &str>

‎vortex-array/src/builders/mod.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//!
1111
//! ```
1212
//! use vortex_array::builders::{builder_with_capacity, ArrayBuilder};
13-
//! use crate::dtype::{DType, Nullability};
13+
//! use vortex_array::dtype::{DType, Nullability};
1414
//!
1515
//! // Create a new builder for string data.
1616
//! let mut builder = builder_with_capacity(&DType::Utf8(Nullability::NonNullable), 4);
@@ -226,7 +226,7 @@ pub trait ArrayBuilder: Send {
226226
///
227227
/// ```
228228
/// use vortex_array::builders::{builder_with_capacity, ArrayBuilder};
229-
/// use crate::dtype::{DType, Nullability};
229+
/// use vortex_array::dtype::{DType, Nullability};
230230
///
231231
/// // Create a new builder for string data.
232232
/// let mut builder = builder_with_capacity(&DType::Utf8(Nullability::NonNullable), 4);

‎vortex-array/src/builders/primitive.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<T: NativePType> PrimitiveBuilder<T> {
7272
/// ```
7373
/// use std::mem::MaybeUninit;
7474
/// use vortex_array::builders::{ArrayBuilder, PrimitiveBuilder};
75-
/// use crate::dtype::Nullability;
75+
/// use vortex_array::dtype::Nullability;
7676
///
7777
/// // Create a new builder.
7878
/// let mut builder: PrimitiveBuilder<i32> =

‎vortex-array/src/dtype/dtype_impl.rs‎

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

4-
use std::fmt::Debug;
54
use std::fmt::Display;
65
use std::fmt::Formatter;
7-
use std::hash::Hash;
86
use std::sync::Arc;
97

108
use DType::*;

0 commit comments

Comments
 (0)