Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions fuzz/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,21 +370,19 @@ impl<'a> Arbitrary<'a> for FuzzArrayAction {
let mask = (0..current_array.len())
.map(|_| bool::arbitrary(u))
.collect::<arbitrary::Result<Vec<_>>>()?;
let mask = Mask::from_iter(mask);

// Compute expected result on canonical form
let expected_result = mask_canonical_array(
current_array
.to_canonical()
.vortex_expect("to_canonical should succeed in fuzz test"),
&Mask::from_iter(mask.iter().copied()),
&mask,
)
.vortex_expect("mask_canonical_array should succeed in fuzz test");
// Update current_array to the result for chaining
current_array = expected_result.clone();
(
Action::Mask(Mask::from_iter(mask)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep these as seperate they share cached state

ExpectedValue::Array(expected_result),
)
(Action::Mask(mask), ExpectedValue::Array(expected_result))
}
ActionType::ScalarAt => {
if current_array.is_empty() {
Expand Down
9 changes: 7 additions & 2 deletions vortex-array/src/arrow/executor/struct_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ fn create_from_fields(
let arrow_fields: Fields = names
.iter()
.zip_eq(arrow_arrays.iter())
.map(|(name, arr)| {
Arc::new(Field::new(name.as_ref(), arr.data_type().clone(), true))
.zip_eq(vortex_fields.iter().map(|f| f.dtype().is_nullable()))
.map(|((name, arr), vx_nullable)| {
Arc::new(Field::new(
name.as_ref(),
arr.data_type().clone(),
vx_nullable,
))
})
.collect();

Expand Down
5 changes: 3 additions & 2 deletions vortex-array/src/compute/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ impl ComputeFnVTable for MaskFn {
) -> VortexResult<Output> {
let MaskArgs { array, mask } = MaskArgs::try_from(args)?;

if matches!(mask, Mask::AllFalse(_)) {
let mask_true_count = mask.true_count();
if mask_true_count == 0 {
// Fast-path for empty mask
return Ok(cast(array, &array.dtype().as_nullable())?.into());
}

if matches!(mask, Mask::AllTrue(_)) {
if mask_true_count == mask.len() {
Comment on lines +118 to +124
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a east and common mistake to make are you sure it exists?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nice thing about the old version was that it avoided scanning the indices for the fast paths

// Fast-path for full mask.
return Ok(
ConstantArray::new(Scalar::null(array.dtype().as_nullable()), array.len())
Expand Down
7 changes: 5 additions & 2 deletions vortex-array/src/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,15 @@ impl Validity {
AllOr::None => self.clone().into_nullable(),
AllOr::Some(make_invalid) => match self {
Validity::NonNullable | Validity::AllValid => {
Validity::Array(BoolArray::from(!make_invalid).into_array())
Validity::from_bit_buffer(!make_invalid, Nullability::Nullable)
}
Validity::AllInvalid => Validity::AllInvalid,
Validity::Array(is_valid) => {
let is_valid = is_valid.to_bool();
Validity::from(is_valid.to_bit_buffer() & !make_invalid)
Validity::from_bit_buffer(
is_valid.to_bit_buffer() & !make_invalid,
Nullability::Nullable,
)
}
},
}
Expand Down
Loading