Skip to content
Open
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
9 changes: 9 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@ disallowed-methods = [
{ path = "vortex_session::registry::Id::new", reason = "Interning a static id on every call grabs the interner lock (#8380). Use a `CachedId` static for static ids; for a dynamic string, annotate the call with `#[expect(clippy::disallowed_methods)]`.", allow-invalid = true },
{ path = "vortex_session::registry::Id::new_static", reason = "Interning a static id on every call grabs the interner lock; use a `CachedId` static instead (#8380).", allow-invalid = true },
{ path = "vortex_array::legacy_session", reason = "Relies on the hidden global session; thread an explicit `VortexSession`/`ExecutionCtx` through instead" },
{ path = "vortex_array::ToCanonical::to_null", reason = "This function doesn't take the context, use `array.execute::<NullArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_bool", reason = "This function doesn't take the context, use `array.execute::<BoolArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_primitive", reason = "This function doesn't take the context, use `array.execute::<PrimitiveArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_decimal", reason = "This function doesn't take the context, use `array.execute::<DecimalArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_struct", reason = "This function doesn't take the context, use `array.execute::<StructArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_listview", reason = "This function doesn't take the context, use `array.execute::<ListViewArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_fixed_size_list", reason = "This function doesn't take the context, use `array.execute::<FixedSizeListArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_varbinview", reason = "This function doesn't take the context, use `array.execute::<VarBinViewArray>(ctx)` instead", allow-invalid = true },
{ path = "vortex_array::ToCanonical::to_extension", reason = "This function doesn't take the context, use `array.execute::<ExtensionArray>(ctx)` instead", allow-invalid = true },
]
2 changes: 1 addition & 1 deletion encodings/alp/src/alp/compute/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ mod tests {
let array_primitive = array.execute::<PrimitiveArray>(&mut ctx)?;
let alp =
alp_encode(array_primitive.as_view(), None, &mut ctx).vortex_expect("cannot fail");
test_cast_conformance(&alp.into_array());
test_cast_conformance(&alp.into_array(), &mut ctx);

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion encodings/alp/src/alp/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ mod test {
let mut ctx = array_session().create_execution_ctx();
let array_primitive = array.execute::<PrimitiveArray>(&mut ctx).unwrap();
let alp = alp_encode(array_primitive.as_view(), None, &mut ctx).unwrap();
test_filter_conformance(&alp.into_array());
test_filter_conformance(&alp.into_array(), &mut ctx);
}
}
4 changes: 2 additions & 2 deletions encodings/alp/src/alp/compute/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod test {
let mut ctx = array_session().create_execution_ctx();
let array_primitive = array.execute::<PrimitiveArray>(&mut ctx).unwrap();
let alp = alp_encode(array_primitive.as_view(), None, &mut ctx).unwrap();
test_mask_conformance(&alp.into_array());
test_mask_conformance(&alp.into_array(), &mut ctx);
}

#[test]
Expand All @@ -90,7 +90,7 @@ mod test {
let array = PrimitiveArray::from_iter(values);
let alp = alp_encode(array.as_view(), None, &mut ctx).unwrap();
assert!(alp.patches().is_some(), "expected patches");
test_mask_conformance(&alp.into_array());
test_mask_conformance(&alp.into_array(), &mut ctx);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion encodings/alp/src/alp/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ mod test {
let mut ctx = array_session().create_execution_ctx();
let array_primitive = array.execute::<PrimitiveArray>(&mut ctx).unwrap();
let alp = alp_encode(array_primitive.as_view(), None, &mut ctx).unwrap();
test_take_conformance(&alp.into_array());
test_take_conformance(&alp.into_array(), &mut ctx);
}
}
7 changes: 4 additions & 3 deletions encodings/alp/src/alp_rd/compute/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ impl CastReduce for ALPRD {
.with_nullability(dtype.nullability()),
)?;

// NOTE: `CastReduce::cast` has a fixed trait signature without `ExecutionCtx`, so we
// construct a legacy ctx locally at this trait boundary.
Ok(Some(
unsafe {
ALPRD::new_unchecked(
Expand Down Expand Up @@ -149,6 +147,9 @@ mod tests {
encoder.encode(arr.as_view())
})]
fn test_cast_alprd_conformance(#[case] alprd: crate::alp_rd::ALPRDArray) {
test_cast_conformance(&alprd.into_array());
test_cast_conformance(
&alprd.into_array(),
&mut array_session().create_execution_ctx(),
);
}
}
4 changes: 4 additions & 0 deletions encodings/alp/src/alp_rd/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,28 @@ mod test {
#[case(0.1f32, 0.2f32, 3e25f32)]
#[case(0.1f64, 0.2f64, 3e100f64)]
fn test_filter_simple<T: ALPRDFloat>(#[case] a: T, #[case] b: T, #[case] outlier: T) {
let mut ctx = SESSION.create_execution_ctx();
test_filter_conformance(
&RDEncoder::new(&[a, b])
.encode(PrimitiveArray::from_iter([a, b, outlier, b, outlier]).as_view())
.into_array(),
&mut ctx,
);
}

#[rstest]
#[case(0.1f32, 3e25f32)]
#[case(0.5f64, 1e100f64)]
fn test_filter_with_nulls<T: ALPRDFloat>(#[case] a: T, #[case] outlier: T) {
let mut ctx = SESSION.create_execution_ctx();
test_filter_conformance(
&RDEncoder::new(&[a])
.encode(
PrimitiveArray::from_option_iter([Some(a), None, Some(outlier), Some(a), None])
.as_view(),
)
.into_array(),
&mut ctx,
);
}
}
15 changes: 15 additions & 0 deletions encodings/alp/src/alp_rd/compute/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,51 @@ impl MaskReduce for ALPRD {

#[cfg(test)]
mod tests {
use std::sync::LazyLock;

use rstest::rstest;
use vortex_array::IntoArray;
use vortex_array::VortexSessionExecute;
use vortex_array::array_session;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::compute::conformance::mask::test_mask_conformance;
use vortex_session::VortexSession;

use crate::ALPRDFloat;
use crate::RDEncoder;

static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
let session = array_session();
crate::initialize(&session);
session
});

#[rstest]
#[case(0.1f32, 0.2f32, 3e25f32)]
#[case(0.1f64, 0.2f64, 3e100f64)]
fn test_mask_simple<T: ALPRDFloat>(#[case] a: T, #[case] b: T, #[case] outlier: T) {
let mut ctx = SESSION.create_execution_ctx();
test_mask_conformance(
&RDEncoder::new(&[a, b])
.encode(PrimitiveArray::from_iter([a, b, outlier, b, outlier]).as_view())
.into_array(),
&mut ctx,
);
}

#[rstest]
#[case(0.1f32, 3e25f32)]
#[case(0.5f64, 1e100f64)]
fn test_mask_with_nulls<T: ALPRDFloat>(#[case] a: T, #[case] outlier: T) {
let mut ctx = SESSION.create_execution_ctx();
test_mask_conformance(
&RDEncoder::new(&[a])
.encode(
PrimitiveArray::from_option_iter([Some(a), None, Some(outlier), Some(a), None])
.as_view(),
)
.into_array(),
&mut ctx,
);
}
}
4 changes: 4 additions & 0 deletions encodings/alp/src/alp_rd/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,28 @@ mod test {
#[case(0.1f32, 0.2f32, 3e25f32)]
#[case(0.1f64, 0.2f64, 3e100f64)]
fn test_take_conformance_alprd<T: ALPRDFloat>(#[case] a: T, #[case] b: T, #[case] outlier: T) {
let mut ctx = SESSION.create_execution_ctx();
test_take_conformance(
&RDEncoder::new(&[a, b])
.encode(PrimitiveArray::from_iter([a, b, outlier, b, outlier]).as_view())
.into_array(),
&mut ctx,
);
}

#[rstest]
#[case(0.1f32, 3e25f32)]
#[case(0.5f64, 1e100f64)]
fn test_take_with_nulls_conformance<T: ALPRDFloat>(#[case] a: T, #[case] outlier: T) {
let mut ctx = SESSION.create_execution_ctx();
test_take_conformance(
&RDEncoder::new(&[a])
.encode(
PrimitiveArray::from_option_iter([Some(a), None, Some(outlier), Some(a), None])
.as_view(),
)
.into_array(),
&mut ctx,
);
}
}
16 changes: 12 additions & 4 deletions encodings/bytebool/src/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,25 @@ mod tests {

#[test]
fn test_mask_byte_bool() {
test_mask_conformance(&bb(vec![true, false, true, true, false]).into_array());
test_mask_conformance(
&bb(vec![true, false, true, true, false]).into_array(),
&mut SESSION.create_execution_ctx(),
);
test_mask_conformance(
&bb_opt(vec![Some(true), Some(true), None, Some(false), None]).into_array(),
&mut SESSION.create_execution_ctx(),
);
}

#[test]
fn test_filter_byte_bool() {
test_filter_conformance(&bb(vec![true, false, true, true, false]).into_array());
test_filter_conformance(
&bb(vec![true, false, true, true, false]).into_array(),
&mut SESSION.create_execution_ctx(),
);
test_filter_conformance(
&bb_opt(vec![Some(true), Some(true), None, Some(false), None]).into_array(),
&mut SESSION.create_execution_ctx(),
);
}

Expand All @@ -317,7 +325,7 @@ mod tests {
#[case(bb(vec![true, false]))]
#[case(bb(vec![true]))]
fn test_take_byte_bool_conformance(#[case] array: ByteBoolArray) {
test_take_conformance(&array.into_array());
test_take_conformance(&array.into_array(), &mut SESSION.create_execution_ctx());
}

#[test]
Expand All @@ -338,7 +346,7 @@ mod tests {
#[case(bb(vec![true]))]
#[case(bb_opt(vec![Some(true), None]))]
fn test_cast_bytebool_conformance(#[case] array: ByteBoolArray) {
test_cast_conformance(&array.into_array());
test_cast_conformance(&array.into_array(), &mut SESSION.create_execution_ctx());
}

#[rstest]
Expand Down
5 changes: 4 additions & 1 deletion encodings/datetime-parts/src/compute/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ mod tests {
), &mut array_session().create_execution_ctx()).unwrap())]
fn test_cast_datetime_parts_conformance(#[case] array: DateTimePartsArray) {
use vortex_array::compute::conformance::cast::test_cast_conformance;
test_cast_conformance(&array.into_array());
test_cast_conformance(
&array.into_array(),
&mut array_session().create_execution_ctx(),
);
}
}
4 changes: 2 additions & 2 deletions encodings/datetime-parts/src/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod test {
TemporalArray::new_timestamp(timestamps, TimeUnit::Milliseconds, Some("UTC".into()));

let array = DateTimeParts::try_from_temporal(temporal, &mut ctx).unwrap();
test_filter_conformance(&array.into_array());
test_filter_conformance(&array.into_array(), &mut ctx);

// Test with nullable values
let timestamps = PrimitiveArray::from_option_iter([
Expand All @@ -70,6 +70,6 @@ mod test {
TemporalArray::new_timestamp(timestamps, TimeUnit::Milliseconds, Some("UTC".into()));

let array = DateTimeParts::try_from_temporal(temporal, &mut ctx).unwrap();
test_filter_conformance(&array.into_array());
test_filter_conformance(&array.into_array(), &mut ctx);
}
}
5 changes: 4 additions & 1 deletion encodings/datetime-parts/src/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ mod tests {
Some("UTC".into())
), &mut array_session().create_execution_ctx()).unwrap())]
fn test_take_datetime_parts_conformance(#[case] array: DateTimePartsArray) {
test_take_conformance(&array.into_array());
test_take_conformance(
&array.into_array(),
&mut array_session().create_execution_ctx(),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ mod tests {
DecimalDType::new(10, 2),
).unwrap())]
fn test_cast_decimal_byte_parts_conformance(#[case] array: DecimalBytePartsArray) {
test_cast_conformance(&array.into_array());
test_cast_conformance(
&array.into_array(),
&mut array_session().create_execution_ctx(),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ impl FilterReduce for DecimalByteParts {
#[cfg(test)]
mod test {
use vortex_array::IntoArray;
use vortex_array::VortexSessionExecute;
use vortex_array::array_session;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::compute::conformance::filter::test_filter_conformance;
use vortex_array::dtype::DecimalDType;
Expand All @@ -41,14 +43,20 @@ mod test {

let decimal_dtype = DecimalDType::new(8, 2);
let array = DecimalByteParts::try_new(msp, decimal_dtype).unwrap();
test_filter_conformance(&array.into_array());
test_filter_conformance(
&array.into_array(),
&mut array_session().create_execution_ctx(),
);

// Test with nullable values
let msp = PrimitiveArray::from_option_iter([Some(10i64), None, Some(30), Some(40), None])
.into_array();

let decimal_dtype = DecimalDType::new(18, 4);
let array = DecimalByteParts::try_new(msp, decimal_dtype).unwrap();
test_filter_conformance(&array.into_array());
test_filter_conformance(
&array.into_array(),
&mut array_session().create_execution_ctx(),
);
}
}
14 changes: 6 additions & 8 deletions encodings/experimental/onpair/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,12 @@ impl VTable for OnPair {
ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let Some(builder) = builder.as_any_mut().downcast_mut::<VarBinViewBuilder>() else {
builder.extend_from_array(
&array
.array()
.clone()
.execute::<Canonical>(ctx)?
.into_array(),
);
return Ok(());
return array
.array()
.clone()
.execute::<Canonical>(ctx)?
.into_array()
.append_to_builder(builder, ctx);
};

let next_buffer_index = builder.completed_block_count() + u32::from(builder.in_progress());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ mod test {

let mut primitive_builder =
PrimitiveBuilder::<i32>::with_capacity(chunked.dtype().nullability(), 10 * 100);
primitive_builder.extend_from_array(&chunked);
chunked.append_to_builder(&mut primitive_builder, &mut ctx)?;
let ca_into = primitive_builder.finish();

assert_arrays_eq!(into_ca, ca_into, &mut ctx);
Expand Down
2 changes: 1 addition & 1 deletion encodings/fastlanes/src/bitpacking/compute/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,6 @@ mod tests {
#[case(bp(&buffer![0u32, 1000, 2000, 3000, 4000].into_array(), 12))]
#[case(bp(&PrimitiveArray::from_option_iter([Some(1u32), None, Some(7), Some(15), None]).into_array(), 4))]
fn test_cast_bitpacked_conformance(#[case] array: BitPackedArray) {
test_cast_conformance(&array.into_array());
test_cast_conformance(&array.into_array(), &mut SESSION.create_execution_ctx());
}
}
6 changes: 3 additions & 3 deletions encodings/fastlanes/src/bitpacking/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,17 @@ mod test {
// Test with u8 values
let unpacked = buffer![1u8, 2, 3, 4, 5].into_array();
let bitpacked = BitPackedData::encode(&unpacked, 3, &mut ctx).unwrap();
test_filter_conformance(&bitpacked.into_array());
test_filter_conformance(&bitpacked.into_array(), &mut ctx);

// Test with u32 values
let unpacked = buffer![100u32, 200, 300, 400, 500].into_array();
let bitpacked = BitPackedData::encode(&unpacked, 9, &mut ctx).unwrap();
test_filter_conformance(&bitpacked.into_array());
test_filter_conformance(&bitpacked.into_array(), &mut ctx);

// Test with nullable values
let unpacked = PrimitiveArray::from_option_iter([Some(1u16), None, Some(3), Some(4), None]);
let bitpacked = BitPackedData::encode(&unpacked.into_array(), 3, &mut ctx).unwrap();
test_filter_conformance(&bitpacked.into_array());
test_filter_conformance(&bitpacked.into_array(), &mut ctx);
}

/// Regression test for signed integers with patches.
Expand Down
4 changes: 2 additions & 2 deletions encodings/fastlanes/src/bitpacking/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ mod test {
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::assert_arrays_eq;
use vortex_array::compute::conformance::take::test_take_conformance;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_buffer::buffer;
Expand Down Expand Up @@ -327,7 +328,6 @@ mod test {
#[case(bp(buffer![42u32].into_array(), 6))]
#[case(bp(PrimitiveArray::from_iter((0..1024).map(|i| i as u32)).into_array(), 8))]
fn test_take_bitpacked_conformance(#[case] bitpacked: BitPackedArray) {
use vortex_array::compute::conformance::take::test_take_conformance;
test_take_conformance(&bitpacked.into_array());
test_take_conformance(&bitpacked.into_array(), &mut SESSION.create_execution_ctx());
}
}
Loading
Loading