Skip to content
Closed
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: 7 additions & 1 deletion encodings/alp/src/alp/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::TypedArrayRef;
use vortex_array::VortexSessionExecute;
use vortex_array::array_slots;
use vortex_array::arrays::Primitive;
use vortex_array::buffer::BufferHandle;
Expand Down Expand Up @@ -83,6 +85,7 @@ impl VTable for ALP {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let alp_slots = ALPSlotsView::from_slots(slots);
let patches =
Expand Down Expand Up @@ -370,7 +373,10 @@ impl ALP {
let len = encoded.len();
let slots = ALPData::make_slots(&encoded, patches.as_ref());
let data = ALPData::new(exponents, patches);
Array::try_from_parts(ArrayParts::new(ALP, dtype, len, data).with_slots(slots))
Array::try_from_parts(
ArrayParts::new(ALP, dtype, len, data).with_slots(slots),
&mut LEGACY_SESSION.create_execution_ctx(),
)
}

/// # Safety
Expand Down
7 changes: 4 additions & 3 deletions encodings/alp/src/alp/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ impl ArrayPlugin for ALPPatchedPlugin {
children: &dyn ArrayChildren,
session: &VortexSession,
) -> VortexResult<ArrayRef> {
let alp_array = Array::<ALP>::try_from_parts(ArrayVTable::deserialize(
&ALP, dtype, len, metadata, buffers, children, session,
)?)
let alp_array = Array::<ALP>::try_from_parts(
ArrayVTable::deserialize(&ALP, dtype, len, metadata, buffers, children, session)?,
&mut session.create_execution_ctx(),
)
.map_err(|_| vortex_err!("ALP plugin should only deserialize vortex.alp"))?;

// Check if there are interior patches to externalize.
Expand Down
10 changes: 7 additions & 3 deletions encodings/alp/src/alp_rd/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl VTable for ALPRD {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
validate_parts(
dtype,
Expand Down Expand Up @@ -368,14 +369,17 @@ impl ALPRD {
right_parts: ArrayRef,
right_bit_width: u8,
left_parts_patches: Option<Patches>,
ctx: &mut ExecutionCtx,
) -> VortexResult<ALPRDArray> {
let len = left_parts.len();
let mut ctx = LEGACY_SESSION.create_execution_ctx();
let left_parts_patches =
ALPRDData::canonicalize_patches(&left_parts, left_parts_patches, ctx)?;
ALPRDData::canonicalize_patches(&left_parts, left_parts_patches, &mut ctx)?;
let slots = ALPRDData::make_slots(&left_parts, &right_parts, left_parts_patches.as_ref());
let data = ALPRDData::new(left_parts_dictionary, right_bit_width, left_parts_patches);
Array::try_from_parts(ArrayParts::new(ALPRD, dtype, len, data).with_slots(slots))
Array::try_from_parts(
ArrayParts::new(ALPRD, dtype, len, data).with_slots(slots),
&mut ctx,
)
}

/// # Safety
Expand Down
1 change: 0 additions & 1 deletion encodings/alp/src/alp_rd/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ impl FilterKernel for ALPRD {
array.right_parts().filter(mask.clone())?,
array.right_bit_width(),
left_parts_exceptions,
ctx,
)?
.into_array(),
))
Expand Down
5 changes: 0 additions & 5 deletions encodings/alp/src/alp_rd/compute/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use vortex_array::ArrayRef;
use vortex_array::ArrayView;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::scalar_fn::ScalarFnFactoryExt;
use vortex_array::scalar_fn::EmptyOptions;
use vortex_array::scalar_fn::fns::mask::Mask as MaskExpr;
Expand All @@ -22,8 +20,6 @@ impl MaskReduce for ALPRD {
EmptyOptions,
[array.left_parts().clone(), mask.clone()],
)?;
// NOTE: `MaskReduce::mask` has a fixed trait signature without `ExecutionCtx`, so we
// construct a legacy ctx locally at this trait boundary.
Ok(Some(
ALPRD::try_new(
array.dtype().as_nullable(),
Expand All @@ -32,7 +28,6 @@ impl MaskReduce for ALPRD {
array.right_parts().clone(),
array.right_bit_width(),
array.left_parts_patches(),
&mut LEGACY_SESSION.create_execution_ctx(),
)?
.into_array(),
))
Expand Down
1 change: 0 additions & 1 deletion encodings/alp/src/alp_rd/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ impl TakeExecute for ALPRD {
right_parts,
array.right_bit_width(),
left_parts_exceptions,
ctx,
)?
.into_array(),
))
Expand Down
3 changes: 1 addition & 2 deletions encodings/alp/src/alp_rd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl RDEncoder {
fn encode_generic<T>(
&self,
array: ArrayView<'_, Primitive>,
ctx: &mut ExecutionCtx,
_ctx: &mut ExecutionCtx,
) -> ALPRDArray
where
T: ALPRDFloat + NativePType,
Expand Down Expand Up @@ -294,7 +294,6 @@ impl RDEncoder {
packed_right,
self.right_bit_width,
exceptions,
ctx,
)
.vortex_expect("ALPRDArray construction in encode")
}
Expand Down
1 change: 1 addition & 0 deletions encodings/bytebool/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl VTable for ByteBool {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let validity = child_to_validity(slots[VALIDITY_SLOT].as_ref(), dtype.nullability());
ByteBoolData::validate(data.buffer(), &validity, dtype, len)
Expand Down
1 change: 1 addition & 0 deletions encodings/datetime-parts/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl VTable for DateTimeParts {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let slots = DateTimePartsSlotsView::from_slots(slots);
DateTimePartsData::validate(dtype, slots.days, slots.seconds, slots.subseconds, len)
Expand Down
1 change: 1 addition & 0 deletions encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl VTable for DecimalByteParts {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let Some(decimal_dtype) = dtype.as_decimal_opt() else {
vortex_bail!("expected decimal dtype, got {}", dtype)
Expand Down
1 change: 1 addition & 0 deletions encodings/experimental/onpair/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ impl VTable for OnPair {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let s = OnPairSlotsView::from_slots(slots);
validate_parts(
Expand Down
7 changes: 4 additions & 3 deletions encodings/fastlanes/src/bitpacking/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ impl ArrayPlugin for BitPackedPatchedPlugin {
children: &dyn ArrayChildren,
session: &VortexSession,
) -> VortexResult<ArrayRef> {
let bitpacked = Array::<BitPacked>::try_from_parts(ArrayVTable::deserialize(
&BitPacked, dtype, len, metadata, buffers, children, session,
)?)
let bitpacked = Array::<BitPacked>::try_from_parts(
ArrayVTable::deserialize(&BitPacked, dtype, len, metadata, buffers, children, session)?,
&mut session.create_execution_ctx(),
)
.map_err(|_| vortex_err!("BitPacked plugin should only deserialize fastlanes.bitpacked"))?;

// Create a new BitPackedArray without the interior patches installed.
Expand Down
8 changes: 7 additions & 1 deletion encodings/fastlanes/src/bitpacking/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::buffer::BufferHandle;
use vortex_array::builders::ArrayBuilder;
use vortex_array::dtype::DType;
Expand Down Expand Up @@ -106,6 +108,7 @@ impl VTable for BitPacked {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let bp_slots = BitPackedSlotsView::from_slots(slots);

Expand Down Expand Up @@ -301,7 +304,10 @@ impl BitPacked {
s
};
let data = BitPackedData::try_new(packed, patches, bit_width, offset)?;
Array::try_from_parts(ArrayParts::new(BitPacked, dtype, len, data).with_slots(slots))
Array::try_from_parts(
ArrayParts::new(BitPacked, dtype, len, data).with_slots(slots),
&mut LEGACY_SESSION.create_execution_ctx(),
)
}

pub fn into_parts(array: BitPackedArray) -> BitPackedDataParts {
Expand Down
8 changes: 7 additions & 1 deletion encodings/fastlanes/src/delta/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::buffer::BufferHandle;
use vortex_array::dtype::DType;
Expand Down Expand Up @@ -86,6 +88,7 @@ impl VTable for Delta {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let bases = slots[BASES_SLOT]
.as_ref()
Expand Down Expand Up @@ -191,7 +194,10 @@ impl Delta {
let dtype = bases.dtype().with_nullability(deltas.dtype().nullability());
let data = DeltaData::try_new(offset)?;
let slots = smallvec![Some(bases), Some(deltas)];
Array::try_from_parts(ArrayParts::new(Delta, dtype, len, data).with_slots(slots))
Array::try_from_parts(
ArrayParts::new(Delta, dtype, len, data).with_slots(slots),
&mut LEGACY_SESSION.create_execution_ctx(),
)
}

/// Compress a primitive array using Delta encoding.
Expand Down
8 changes: 7 additions & 1 deletion encodings/fastlanes/src/for/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::buffer::BufferHandle;
use vortex_array::dtype::DType;
Expand Down Expand Up @@ -81,6 +83,7 @@ impl VTable for FoR {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let encoded = slots[0].as_ref().vortex_expect("FoRArray encoded slot");
validate_parts(encoded.dtype(), encoded.len(), &data.reference, dtype, len)
Expand Down Expand Up @@ -169,7 +172,10 @@ impl FoR {
let len = encoded.len();
let data = FoRData::try_new(reference)?;
let slots = smallvec![Some(encoded)];
Array::try_from_parts(ArrayParts::new(FoR, dtype, len, data).with_slots(slots))
Array::try_from_parts(
ArrayParts::new(FoR, dtype, len, data).with_slots(slots),
&mut LEGACY_SESSION.create_execution_ctx(),
)
}

/// Encode a primitive array using Frame of Reference encoding.
Expand Down
8 changes: 7 additions & 1 deletion encodings/fastlanes/src/rle/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::Primitive;
use vortex_array::buffer::BufferHandle;
use vortex_array::dtype::DType;
Expand Down Expand Up @@ -92,6 +94,7 @@ impl VTable for RLE {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
validate_parts(
slots[VALUES_SLOT]
Expand Down Expand Up @@ -213,7 +216,10 @@ impl RLE {
let dtype = DType::Primitive(values.dtype().as_ptype(), indices.dtype().nullability());
let slots = smallvec![Some(values), Some(indices), Some(values_idx_offsets)];
let data = RLEData::try_new(offset)?;
Array::try_from_parts(ArrayParts::new(RLE, dtype, length, data).with_slots(slots))
Array::try_from_parts(
ArrayParts::new(RLE, dtype, length, data).with_slots(slots),
&mut LEGACY_SESSION.create_execution_ctx(),
)
}

/// Create a new RLE array without validation.
Expand Down
6 changes: 2 additions & 4 deletions encodings/fsst/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::TypedArrayRef;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::VarBin;
Expand Down Expand Up @@ -120,10 +119,9 @@ impl VTable for FSST {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
// TODO(ctx): trait fixes - VTable::validate has a fixed signature.
let mut ctx = LEGACY_SESSION.create_execution_ctx();
data.validate(dtype, len, slots, &mut ctx)
data.validate(dtype, len, slots, ctx)
}

fn nbuffers(_array: ArrayView<'_, Self>) -> usize {
Expand Down
3 changes: 3 additions & 0 deletions encodings/parquet-variant/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ use vortex_array::ArrayRef;
use vortex_array::EmptyArrayData;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::TypedArrayRef;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::ConstantArray;
use vortex_array::arrays::List;
use vortex_array::arrays::ListArray;
Expand Down Expand Up @@ -81,6 +83,7 @@ impl ParquetVariant {
];
Array::try_from_parts(
ArrayParts::new(ParquetVariant, dtype, len, EmptyArrayData).with_slots(slots),
&mut LEGACY_SESSION.create_execution_ctx(),
)
}

Expand Down
1 change: 1 addition & 0 deletions encodings/parquet-variant/src/vtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl VTable for ParquetVariant {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
vortex_ensure!(
slots.len() == NUM_SLOTS,
Expand Down
1 change: 1 addition & 0 deletions encodings/pco/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ impl VTable for Pco {
dtype: &DType,
len: usize,
slots: &[Option<ArrayRef>],
_ctx: &mut ExecutionCtx,
) -> VortexResult<()> {
let validity = child_to_validity(slots[0].as_ref(), dtype.nullability());
data.validate(dtype, len, &validity)
Expand Down
Loading
Loading