From c4687a770c2bb53ec36fe8efe660924d90526058 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 27 Jun 2026 14:15:40 +0000 Subject: [PATCH] Thread ExecutionCtx into VTable::validate Add a `ctx: &mut ExecutionCtx` parameter to `VTable::validate` and wire it through `Array::try_from_parts` / `ArrayInner::try_new`, so encoding validation that needs canonicalization can use a real execution context. `ALPRD::try_new` no longer takes a `ctx`: it mints a `LEGACY_SESSION` context internally for its patch canonicalization and the `try_from_parts` validation, matching the other constructors that have no ctx in scope (and grandfathered by the LEGACY_SESSION allow-list). Its callers (filter/mask/take/encode) and the btrblocks ALPRD scheme drop the trailing `ctx` argument accordingly. Signed-off-by: Robert Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Mkrgj5SuJpaKBXK9jydtSc --- encodings/alp/src/alp/array.rs | 8 ++++++- encodings/alp/src/alp/plugin.rs | 7 +++--- encodings/alp/src/alp_rd/array.rs | 10 ++++++--- encodings/alp/src/alp_rd/compute/filter.rs | 1 - encodings/alp/src/alp_rd/compute/mask.rs | 5 ----- encodings/alp/src/alp_rd/compute/take.rs | 1 - encodings/alp/src/alp_rd/mod.rs | 3 +-- encodings/bytebool/src/array.rs | 1 + encodings/datetime-parts/src/array.rs | 1 + .../src/decimal_byte_parts/mod.rs | 1 + encodings/experimental/onpair/src/array.rs | 1 + encodings/fastlanes/src/bitpacking/plugin.rs | 7 +++--- .../fastlanes/src/bitpacking/vtable/mod.rs | 8 ++++++- encodings/fastlanes/src/delta/vtable/mod.rs | 8 ++++++- encodings/fastlanes/src/for/vtable/mod.rs | 8 ++++++- encodings/fastlanes/src/rle/vtable/mod.rs | 8 ++++++- encodings/fsst/src/array.rs | 6 ++--- encodings/parquet-variant/src/array.rs | 3 +++ encodings/parquet-variant/src/vtable.rs | 1 + encodings/pco/src/array.rs | 1 + encodings/runend/src/array.rs | 22 ++++++++++++------- encodings/sequence/src/array.rs | 1 + encodings/sparse/src/lib.rs | 1 + encodings/zigzag/src/array.rs | 1 + encodings/zstd/src/array.rs | 1 + encodings/zstd/src/zstd_buffers.rs | 8 ++++++- vortex-array/src/array/foreign.rs | 4 ++++ vortex-array/src/array/mod.rs | 3 +++ vortex-array/src/array/plugin.rs | 8 ++++--- vortex-array/src/array/typed.rs | 10 ++++----- vortex-array/src/array/vtable/mod.rs | 1 + vortex-array/src/arrays/bool/vtable/mod.rs | 1 + vortex-array/src/arrays/chunked/vtable/mod.rs | 1 + .../src/arrays/constant/vtable/mod.rs | 1 + vortex-array/src/arrays/decimal/array.rs | 12 ++++++++-- vortex-array/src/arrays/decimal/vtable/mod.rs | 1 + vortex-array/src/arrays/dict/array.rs | 3 +++ vortex-array/src/arrays/dict/vtable/mod.rs | 1 + .../src/arrays/extension/vtable/mod.rs | 1 + vortex-array/src/arrays/filter/vtable.rs | 1 + .../src/arrays/fixed_size_list/vtable/mod.rs | 1 + vortex-array/src/arrays/interleave/mod.rs | 1 + vortex-array/src/arrays/list/vtable/mod.rs | 1 + .../src/arrays/listview/vtable/mod.rs | 1 + vortex-array/src/arrays/masked/vtable/mod.rs | 1 + vortex-array/src/arrays/null/mod.rs | 1 + vortex-array/src/arrays/patched/vtable/mod.rs | 1 + .../src/arrays/primitive/array/mod.rs | 9 ++++++-- .../src/arrays/primitive/vtable/mod.rs | 1 + .../src/arrays/scalar_fn/vtable/mod.rs | 1 + vortex-array/src/arrays/shared/vtable.rs | 1 + vortex-array/src/arrays/slice/vtable.rs | 1 + vortex-array/src/arrays/struct_/array.rs | 4 ++++ vortex-array/src/arrays/struct_/vtable/mod.rs | 1 + vortex-array/src/arrays/varbin/vtable/mod.rs | 1 + .../src/arrays/varbinview/vtable/mod.rs | 1 + vortex-array/src/arrays/variant/mod.rs | 3 +++ vortex-array/src/arrays/variant/vtable/mod.rs | 1 + vortex-btrblocks/src/schemes/float/alprd.rs | 1 - vortex-python/src/arrays/py/array.rs | 7 +++++- vortex-python/src/arrays/py/vtable.rs | 1 + 61 files changed, 161 insertions(+), 50 deletions(-) diff --git a/encodings/alp/src/alp/array.rs b/encodings/alp/src/alp/array.rs index 8e581fe51fc..398f46c1a4a 100644 --- a/encodings/alp/src/alp/array.rs +++ b/encodings/alp/src/alp/array.rs @@ -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; @@ -83,6 +85,7 @@ impl VTable for ALP { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let alp_slots = ALPSlotsView::from_slots(slots); let patches = @@ -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 diff --git a/encodings/alp/src/alp/plugin.rs b/encodings/alp/src/alp/plugin.rs index c14133109d1..78f4177886a 100644 --- a/encodings/alp/src/alp/plugin.rs +++ b/encodings/alp/src/alp/plugin.rs @@ -56,9 +56,10 @@ impl ArrayPlugin for ALPPatchedPlugin { children: &dyn ArrayChildren, session: &VortexSession, ) -> VortexResult { - let alp_array = Array::::try_from_parts(ArrayVTable::deserialize( - &ALP, dtype, len, metadata, buffers, children, session, - )?) + let alp_array = Array::::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. diff --git a/encodings/alp/src/alp_rd/array.rs b/encodings/alp/src/alp_rd/array.rs index 160723e83b2..ceba83bf6c7 100644 --- a/encodings/alp/src/alp_rd/array.rs +++ b/encodings/alp/src/alp_rd/array.rs @@ -107,6 +107,7 @@ impl VTable for ALPRD { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { validate_parts( dtype, @@ -368,14 +369,17 @@ impl ALPRD { right_parts: ArrayRef, right_bit_width: u8, left_parts_patches: Option, - ctx: &mut ExecutionCtx, ) -> VortexResult { 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 diff --git a/encodings/alp/src/alp_rd/compute/filter.rs b/encodings/alp/src/alp_rd/compute/filter.rs index 5d98b4561ce..912529cba9b 100644 --- a/encodings/alp/src/alp_rd/compute/filter.rs +++ b/encodings/alp/src/alp_rd/compute/filter.rs @@ -32,7 +32,6 @@ impl FilterKernel for ALPRD { array.right_parts().filter(mask.clone())?, array.right_bit_width(), left_parts_exceptions, - ctx, )? .into_array(), )) diff --git a/encodings/alp/src/alp_rd/compute/mask.rs b/encodings/alp/src/alp_rd/compute/mask.rs index 335f18a33cb..d28233f2d7f 100644 --- a/encodings/alp/src/alp_rd/compute/mask.rs +++ b/encodings/alp/src/alp_rd/compute/mask.rs @@ -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; @@ -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(), @@ -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(), )) diff --git a/encodings/alp/src/alp_rd/compute/take.rs b/encodings/alp/src/alp_rd/compute/take.rs index 6db6eae2978..1c1fe19ee0b 100644 --- a/encodings/alp/src/alp_rd/compute/take.rs +++ b/encodings/alp/src/alp_rd/compute/take.rs @@ -48,7 +48,6 @@ impl TakeExecute for ALPRD { right_parts, array.right_bit_width(), left_parts_exceptions, - ctx, )? .into_array(), )) diff --git a/encodings/alp/src/alp_rd/mod.rs b/encodings/alp/src/alp_rd/mod.rs index a9ac7ca82fe..4f65ea33e9d 100644 --- a/encodings/alp/src/alp_rd/mod.rs +++ b/encodings/alp/src/alp_rd/mod.rs @@ -194,7 +194,7 @@ impl RDEncoder { fn encode_generic( &self, array: ArrayView<'_, Primitive>, - ctx: &mut ExecutionCtx, + _ctx: &mut ExecutionCtx, ) -> ALPRDArray where T: ALPRDFloat + NativePType, @@ -294,7 +294,6 @@ impl RDEncoder { packed_right, self.right_bit_width, exceptions, - ctx, ) .vortex_expect("ALPRDArray construction in encode") } diff --git a/encodings/bytebool/src/array.rs b/encodings/bytebool/src/array.rs index dd5db041c15..efabf9c9b7f 100644 --- a/encodings/bytebool/src/array.rs +++ b/encodings/bytebool/src/array.rs @@ -71,6 +71,7 @@ impl VTable for ByteBool { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let validity = child_to_validity(slots[VALIDITY_SLOT].as_ref(), dtype.nullability()); ByteBoolData::validate(data.buffer(), &validity, dtype, len) diff --git a/encodings/datetime-parts/src/array.rs b/encodings/datetime-parts/src/array.rs index 64c6419a012..7c5f6b34e10 100644 --- a/encodings/datetime-parts/src/array.rs +++ b/encodings/datetime-parts/src/array.rs @@ -105,6 +105,7 @@ impl VTable for DateTimeParts { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let slots = DateTimePartsSlotsView::from_slots(slots); DateTimePartsData::validate(dtype, slots.days, slots.seconds, slots.subseconds, len) diff --git a/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs b/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs index 8f4e9fed409..983fb80a8a1 100644 --- a/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs +++ b/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs @@ -86,6 +86,7 @@ impl VTable for DecimalByteParts { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let Some(decimal_dtype) = dtype.as_decimal_opt() else { vortex_bail!("expected decimal dtype, got {}", dtype) diff --git a/encodings/experimental/onpair/src/array.rs b/encodings/experimental/onpair/src/array.rs index 7fe1cfbce5e..f635e9fd449 100644 --- a/encodings/experimental/onpair/src/array.rs +++ b/encodings/experimental/onpair/src/array.rs @@ -330,6 +330,7 @@ impl VTable for OnPair { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let s = OnPairSlotsView::from_slots(slots); validate_parts( diff --git a/encodings/fastlanes/src/bitpacking/plugin.rs b/encodings/fastlanes/src/bitpacking/plugin.rs index a621d085514..5cda1670b44 100644 --- a/encodings/fastlanes/src/bitpacking/plugin.rs +++ b/encodings/fastlanes/src/bitpacking/plugin.rs @@ -55,9 +55,10 @@ impl ArrayPlugin for BitPackedPatchedPlugin { children: &dyn ArrayChildren, session: &VortexSession, ) -> VortexResult { - let bitpacked = Array::::try_from_parts(ArrayVTable::deserialize( - &BitPacked, dtype, len, metadata, buffers, children, session, - )?) + let bitpacked = Array::::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. diff --git a/encodings/fastlanes/src/bitpacking/vtable/mod.rs b/encodings/fastlanes/src/bitpacking/vtable/mod.rs index 9f8d41de014..a2e3ef25a4d 100644 --- a/encodings/fastlanes/src/bitpacking/vtable/mod.rs +++ b/encodings/fastlanes/src/bitpacking/vtable/mod.rs @@ -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; @@ -106,6 +108,7 @@ impl VTable for BitPacked { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let bp_slots = BitPackedSlotsView::from_slots(slots); @@ -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 { diff --git a/encodings/fastlanes/src/delta/vtable/mod.rs b/encodings/fastlanes/src/delta/vtable/mod.rs index dfb440620ab..1c097553bb5 100644 --- a/encodings/fastlanes/src/delta/vtable/mod.rs +++ b/encodings/fastlanes/src/delta/vtable/mod.rs @@ -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; @@ -86,6 +88,7 @@ impl VTable for Delta { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let bases = slots[BASES_SLOT] .as_ref() @@ -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. diff --git a/encodings/fastlanes/src/for/vtable/mod.rs b/encodings/fastlanes/src/for/vtable/mod.rs index c840c0e0af1..d447109b048 100644 --- a/encodings/fastlanes/src/for/vtable/mod.rs +++ b/encodings/fastlanes/src/for/vtable/mod.rs @@ -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; @@ -81,6 +83,7 @@ impl VTable for FoR { dtype: &DType, len: usize, slots: &[Option], + _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) @@ -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. diff --git a/encodings/fastlanes/src/rle/vtable/mod.rs b/encodings/fastlanes/src/rle/vtable/mod.rs index 5cb50c82953..88235daeb5b 100644 --- a/encodings/fastlanes/src/rle/vtable/mod.rs +++ b/encodings/fastlanes/src/rle/vtable/mod.rs @@ -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; @@ -92,6 +94,7 @@ impl VTable for RLE { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { validate_parts( slots[VALUES_SLOT] @@ -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. diff --git a/encodings/fsst/src/array.rs b/encodings/fsst/src/array.rs index 9438b772469..01bb2f09276 100644 --- a/encodings/fsst/src/array.rs +++ b/encodings/fsst/src/array.rs @@ -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; @@ -120,10 +119,9 @@ impl VTable for FSST { dtype: &DType, len: usize, slots: &[Option], + 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 { diff --git a/encodings/parquet-variant/src/array.rs b/encodings/parquet-variant/src/array.rs index 7e55357c78f..22f6eae5203 100644 --- a/encodings/parquet-variant/src/array.rs +++ b/encodings/parquet-variant/src/array.rs @@ -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; @@ -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(), ) } diff --git a/encodings/parquet-variant/src/vtable.rs b/encodings/parquet-variant/src/vtable.rs index 5aae70c7d24..6ddbb8f16cf 100644 --- a/encodings/parquet-variant/src/vtable.rs +++ b/encodings/parquet-variant/src/vtable.rs @@ -101,6 +101,7 @@ impl VTable for ParquetVariant { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/encodings/pco/src/array.rs b/encodings/pco/src/array.rs index 231b73264ba..d0540dc0299 100644 --- a/encodings/pco/src/array.rs +++ b/encodings/pco/src/array.rs @@ -138,6 +138,7 @@ impl VTable for Pco { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let validity = child_to_validity(slots[0].as_ref(), dtype.nullability()); data.validate(dtype, len, &validity) diff --git a/encodings/runend/src/array.rs b/encodings/runend/src/array.rs index fde553a2fd4..c86d4d6ec60 100644 --- a/encodings/runend/src/array.rs +++ b/encodings/runend/src/array.rs @@ -19,9 +19,7 @@ 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::Primitive; use vortex_array::arrays::VarBinViewArray; use vortex_array::buffer::BufferHandle; @@ -92,6 +90,7 @@ impl VTable for RunEnd { dtype: &DType, len: usize, slots: &[Option], + ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let ends = slots[ENDS_SLOT] .as_ref() @@ -99,9 +98,7 @@ impl VTable for RunEnd { let values = slots[VALUES_SLOT] .as_ref() .vortex_expect("RunEndArray values slot"); - // TODO(ctx): trait fixes - VTable::validate has a fixed signature. - let mut ctx = LEGACY_SESSION.create_execution_ctx(); - RunEndData::validate_parts(ends, values, data.offset, len, &mut ctx)?; + RunEndData::validate_parts(ends, values, data.offset, len, ctx)?; vortex_ensure!( values.dtype() == dtype, "expected dtype {}, got {}", @@ -269,7 +266,10 @@ impl RunEnd { let dtype = values.dtype().clone(); let slots = smallvec![Some(ends), Some(values)]; let data = RunEndData::new(0); - Array::try_from_parts(ArrayParts::new(RunEnd, dtype, len, data).with_slots(slots)) + Array::try_from_parts( + ArrayParts::new(RunEnd, dtype, len, data).with_slots(slots), + ctx, + ) } /// Build a new [`RunEndArray`] from ends, values, offset, and length. @@ -284,7 +284,10 @@ impl RunEnd { let dtype = values.dtype().clone(); let slots = smallvec![Some(ends), Some(values)]; let data = RunEndData::new(offset); - Array::try_from_parts(ArrayParts::new(RunEnd, dtype, length, data).with_slots(slots)) + Array::try_from_parts( + ArrayParts::new(RunEnd, dtype, length, data).with_slots(slots), + ctx, + ) } /// Build a new [`RunEndArray`] from ends and values (panics on invalid input). @@ -301,7 +304,10 @@ impl RunEnd { let dtype = values.dtype().clone(); let slots = smallvec![Some(ends), Some(values)]; let data = unsafe { RunEndData::new_unchecked(0) }; - Array::try_from_parts(ArrayParts::new(RunEnd, dtype, len, data).with_slots(slots)) + Array::try_from_parts( + ArrayParts::new(RunEnd, dtype, len, data).with_slots(slots), + ctx, + ) } else { vortex_bail!("REE can only encode primitive arrays") } diff --git a/encodings/sequence/src/array.rs b/encodings/sequence/src/array.rs index 56e62764ce4..f14e081b3e5 100644 --- a/encodings/sequence/src/array.rs +++ b/encodings/sequence/src/array.rs @@ -242,6 +242,7 @@ impl VTable for Sequence { dtype: &DType, len: usize, _slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { SequenceData::validate(data.base, data.multiplier, dtype, len) } diff --git a/encodings/sparse/src/lib.rs b/encodings/sparse/src/lib.rs index a37aab0c774..3dbe98cfc49 100644 --- a/encodings/sparse/src/lib.rs +++ b/encodings/sparse/src/lib.rs @@ -196,6 +196,7 @@ impl VTable for Sparse { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let patches = SparseData::patches_from_slots(data, len, slots); SparseData::validate(&patches, data.fill_scalar(), dtype, len) diff --git a/encodings/zigzag/src/array.rs b/encodings/zigzag/src/array.rs index 8c4be0d5544..917d37d1661 100644 --- a/encodings/zigzag/src/array.rs +++ b/encodings/zigzag/src/array.rs @@ -61,6 +61,7 @@ impl VTable for ZigZag { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let encoded = slots[ENCODED_SLOT] .as_ref() diff --git a/encodings/zstd/src/array.rs b/encodings/zstd/src/array.rs index c5b0ff19780..6e9d77a34ea 100644 --- a/encodings/zstd/src/array.rs +++ b/encodings/zstd/src/array.rs @@ -142,6 +142,7 @@ impl VTable for Zstd { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let validity = child_to_validity(slots[0].as_ref(), dtype.nullability()); data.validate(dtype, len, &validity) diff --git a/encodings/zstd/src/zstd_buffers.rs b/encodings/zstd/src/zstd_buffers.rs index 2edd82e4a84..73676d86b85 100644 --- a/encodings/zstd/src/zstd_buffers.rs +++ b/encodings/zstd/src/zstd_buffers.rs @@ -21,6 +21,7 @@ use vortex_array::EqMode; use vortex_array::ExecutionCtx; use vortex_array::ExecutionResult; use vortex_array::LEGACY_SESSION; +use vortex_array::VortexSessionExecute; use vortex_array::buffer::BufferHandle; use vortex_array::dtype::DType; use vortex_array::scalar::Scalar; @@ -55,7 +56,10 @@ impl ZstdBuffers { len: usize, data: ZstdBuffersData, ) -> VortexResult { - Array::try_from_parts(ArrayParts::new(ZstdBuffers, dtype, len, data)) + Array::try_from_parts( + ArrayParts::new(ZstdBuffers, dtype, len, data), + &mut LEGACY_SESSION.create_execution_ctx(), + ) } /// Compress every top-level buffer of `array` independently with zstd. @@ -99,6 +103,7 @@ impl ZstdBuffers { let compressed = Array::try_from_parts( ArrayParts::new(ZstdBuffers, array.dtype().clone(), array.len(), data) .with_slots(slots), + &mut session.create_execution_ctx(), )?; compressed.statistics().inherit_from(array.statistics()); Ok(compressed) @@ -397,6 +402,7 @@ impl VTable for ZstdBuffers { _dtype: &DType, _len: usize, _slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { data.validate() } diff --git a/vortex-array/src/array/foreign.rs b/vortex-array/src/array/foreign.rs index e7ea7238346..fac8b9550ac 100644 --- a/vortex-array/src/array/foreign.rs +++ b/vortex-array/src/array/foreign.rs @@ -16,6 +16,8 @@ use crate::ArrayRef; use crate::ArraySlots; use crate::ExecutionResult; use crate::IntoArray; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::array::ArrayId; use crate::array::ArrayParts; use crate::array::ArrayView; @@ -104,6 +106,7 @@ impl VTable for ForeignArray { _dtype: &DType, _len: usize, _slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { Ok(()) } @@ -177,6 +180,7 @@ pub fn new_foreign_array( ForeignArrayData::new(metadata, buffers), ) .with_slots(children), + &mut LEGACY_SESSION.create_execution_ctx(), )? .into_array()) } diff --git a/vortex-array/src/array/mod.rs b/vortex-array/src/array/mod.rs index a0943864738..f66f6048e06 100644 --- a/vortex-array/src/array/mod.rs +++ b/vortex-array/src/array/mod.rs @@ -16,6 +16,8 @@ use vortex_error::vortex_panic; use vortex_session::registry::Id; use crate::ExecutionCtx; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::buffer::BufferHandle; use crate::builders::ArrayBuilder; use crate::dtype::DType; @@ -358,6 +360,7 @@ impl DynArrayData for ArrayData { self.data.clone(), ) .with_slots(slots), + &mut LEGACY_SESSION.create_execution_ctx(), )? .with_stats_set(stats) .into_array()) diff --git a/vortex-array/src/array/plugin.rs b/vortex-array/src/array/plugin.rs index 66845eb9a0a..91e9bd791c2 100644 --- a/vortex-array/src/array/plugin.rs +++ b/vortex-array/src/array/plugin.rs @@ -11,6 +11,7 @@ use vortex_session::VortexSession; use crate::ArrayRef; use crate::IntoArray; +use crate::VortexSessionExecute; use crate::array::Array; use crate::array::ArrayId; use crate::array::VTable; @@ -98,9 +99,10 @@ impl ArrayPlugin for V { children: &dyn ArrayChildren, session: &VortexSession, ) -> VortexResult { - Ok(Array::::try_from_parts(V::deserialize( - self, dtype, len, metadata, buffers, children, session, - )?)? + Ok(Array::::try_from_parts( + V::deserialize(self, dtype, len, metadata, buffers, children, session)?, + &mut session.create_execution_ctx(), + )? .into_array()) } } diff --git a/vortex-array/src/array/typed.rs b/vortex-array/src/array/typed.rs index 91225ac75d6..16058621aa5 100644 --- a/vortex-array/src/array/typed.rs +++ b/vortex-array/src/array/typed.rs @@ -117,9 +117,9 @@ pub(crate) struct ArrayData { impl ArrayInner> { /// Create a new validated [`ArrayInner`] from construction parameters. #[doc(hidden)] - pub fn try_new(new: ArrayParts) -> VortexResult { + pub fn try_new(new: ArrayParts, ctx: &mut ExecutionCtx) -> VortexResult { new.vtable - .validate(&new.data, &new.dtype, new.len, &new.slots)?; + .validate(&new.data, &new.dtype, new.len, &new.slots, ctx)?; Ok(ArrayInner { len: new.len, encoding_id: new.vtable.id(), @@ -208,8 +208,8 @@ impl Array { /// /// This is the safe construction path for encoding implementors. It calls /// [`VTable::validate`] before publishing the array as an [`ArrayRef`]. - pub fn try_from_parts(new: ArrayParts) -> VortexResult { - let store = ArrayInner::>::try_new(new)?; + pub fn try_from_parts(new: ArrayParts, ctx: &mut ExecutionCtx) -> VortexResult { + let store = ArrayInner::>::try_new(new, ctx)?; let inner = ArrayRef::from_inner(Arc::new(store)); Ok(Self { inner, @@ -541,7 +541,7 @@ mod tests { let expected = PrimitiveArray::new(buffer![1i32, 2, 3], Validity::NonNullable); let parts = array.try_into_parts().unwrap(); - let rebuilt = Array::::try_from_parts(parts).unwrap(); + let rebuilt = Array::::try_from_parts(parts, &mut ctx).unwrap(); assert_arrays_eq!(rebuilt, expected, &mut ctx); } diff --git a/vortex-array/src/array/vtable/mod.rs b/vortex-array/src/array/vtable/mod.rs index 2613eec2c61..3770defae9c 100644 --- a/vortex-array/src/array/vtable/mod.rs +++ b/vortex-array/src/array/vtable/mod.rs @@ -87,6 +87,7 @@ pub trait VTable: 'static + Clone + Sized + Send + Sync + Debug { dtype: &DType, len: usize, slots: &[Option], + ctx: &mut ExecutionCtx, ) -> VortexResult<()>; /// Returns the number of top-level buffers in the array. diff --git a/vortex-array/src/arrays/bool/vtable/mod.rs b/vortex-array/src/arrays/bool/vtable/mod.rs index e27f5c7464d..193065b2a7f 100644 --- a/vortex-array/src/arrays/bool/vtable/mod.rs +++ b/vortex-array/src/arrays/bool/vtable/mod.rs @@ -117,6 +117,7 @@ impl VTable for Bool { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let DType::Bool(nullability) = dtype else { vortex_bail!("Expected bool dtype, got {dtype:?}"); diff --git a/vortex-array/src/arrays/chunked/vtable/mod.rs b/vortex-array/src/arrays/chunked/vtable/mod.rs index f7d1668c85a..5a0c3c1fbdc 100644 --- a/vortex-array/src/arrays/chunked/vtable/mod.rs +++ b/vortex-array/src/arrays/chunked/vtable/mod.rs @@ -82,6 +82,7 @@ impl VTable for Chunked { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( !slots.is_empty(), diff --git a/vortex-array/src/arrays/constant/vtable/mod.rs b/vortex-array/src/arrays/constant/vtable/mod.rs index 682035f2d78..9da80e1dc42 100644 --- a/vortex-array/src/arrays/constant/vtable/mod.rs +++ b/vortex-array/src/arrays/constant/vtable/mod.rs @@ -81,6 +81,7 @@ impl VTable for Constant { dtype: &DType, _len: usize, _slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( data.scalar.dtype() == dtype, diff --git a/vortex-array/src/arrays/decimal/array.rs b/vortex-array/src/arrays/decimal/array.rs index 1f4d6c0c277..be041c52a59 100644 --- a/vortex-array/src/arrays/decimal/array.rs +++ b/vortex-array/src/arrays/decimal/array.rs @@ -20,6 +20,8 @@ use crate::ArrayRef; use crate::ArraySlots; use crate::ExecutionCtx; use crate::IntoArray; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::array::Array; use crate::array::ArrayParts; use crate::array::TypedArrayRef; @@ -440,7 +442,10 @@ impl Array { let len = buffer.len(); let slots = DecimalData::make_slots(&validity, len); let data = DecimalData::try_new(buffer, decimal_dtype)?; - Array::try_from_parts(ArrayParts::new(Decimal, dtype, len, data).with_slots(slots)) + Array::try_from_parts( + ArrayParts::new(Decimal, dtype, len, data).with_slots(slots), + &mut LEGACY_SESSION.create_execution_ctx(), + ) } /// Creates a new [`DecimalArray`] from an iterator of values. @@ -510,7 +515,10 @@ impl Array { let len = values.len() / values_type.byte_width(); let slots = DecimalData::make_slots(&validity, len); let data = DecimalData::try_new_handle(values, values_type, decimal_dtype)?; - Array::try_from_parts(ArrayParts::new(Decimal, dtype, len, data).with_slots(slots)) + Array::try_from_parts( + ArrayParts::new(Decimal, dtype, len, data).with_slots(slots), + &mut LEGACY_SESSION.create_execution_ctx(), + ) } /// Creates a new [`DecimalArray`] without validation from a [`BufferHandle`]. diff --git a/vortex-array/src/arrays/decimal/vtable/mod.rs b/vortex-array/src/arrays/decimal/vtable/mod.rs index 32b3ea98510..6181d9cf370 100644 --- a/vortex-array/src/arrays/decimal/vtable/mod.rs +++ b/vortex-array/src/arrays/decimal/vtable/mod.rs @@ -115,6 +115,7 @@ impl VTable for Decimal { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let DType::Decimal(_, nullability) = dtype else { vortex_bail!("Expected decimal dtype, got {dtype:?}"); diff --git a/vortex-array/src/arrays/dict/array.rs b/vortex-array/src/arrays/dict/array.rs index cefc5a381fd..b5f4c50b772 100644 --- a/vortex-array/src/arrays/dict/array.rs +++ b/vortex-array/src/arrays/dict/array.rs @@ -16,6 +16,8 @@ use vortex_mask::AllOr; use crate::ArrayRef; use crate::ArraySlots; use crate::ExecutionCtx; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::array::Array; use crate::array::ArrayParts; use crate::array::TypedArrayRef; @@ -232,6 +234,7 @@ impl Array { Array::try_from_parts( ArrayParts::new(Dict, dtype, len, data) .with_slots(smallvec![Some(codes), Some(values)]), + &mut LEGACY_SESSION.create_execution_ctx(), ) } diff --git a/vortex-array/src/arrays/dict/vtable/mod.rs b/vortex-array/src/arrays/dict/vtable/mod.rs index cd2ef72a7ee..8abe4c9e6bb 100644 --- a/vortex-array/src/arrays/dict/vtable/mod.rs +++ b/vortex-array/src/arrays/dict/vtable/mod.rs @@ -89,6 +89,7 @@ impl VTable for Dict { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let view = DictSlotsView::from_slots(slots); let codes = view.codes; diff --git a/vortex-array/src/arrays/extension/vtable/mod.rs b/vortex-array/src/arrays/extension/vtable/mod.rs index a1429e2180b..16b2a069afc 100644 --- a/vortex-array/src/arrays/extension/vtable/mod.rs +++ b/vortex-array/src/arrays/extension/vtable/mod.rs @@ -100,6 +100,7 @@ impl VTable for Extension { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let storage = slots[STORAGE_SLOT] .as_ref() diff --git a/vortex-array/src/arrays/filter/vtable.rs b/vortex-array/src/arrays/filter/vtable.rs index 074c588ffda..0580de6cb12 100644 --- a/vortex-array/src/arrays/filter/vtable.rs +++ b/vortex-array/src/arrays/filter/vtable.rs @@ -76,6 +76,7 @@ impl VTable for Filter { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots[CHILD_SLOT].is_some(), diff --git a/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs b/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs index 5c7fde36682..177f0cb66e3 100644 --- a/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs +++ b/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs @@ -103,6 +103,7 @@ impl VTable for FixedSizeList { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/vortex-array/src/arrays/interleave/mod.rs b/vortex-array/src/arrays/interleave/mod.rs index b480ac142fb..db10faf4fcf 100644 --- a/vortex-array/src/arrays/interleave/mod.rs +++ b/vortex-array/src/arrays/interleave/mod.rs @@ -296,6 +296,7 @@ impl VTable for Interleave { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == data.num_values + 2, diff --git a/vortex-array/src/arrays/list/vtable/mod.rs b/vortex-array/src/arrays/list/vtable/mod.rs index faa91c459bc..8aca9943ebf 100644 --- a/vortex-array/src/arrays/list/vtable/mod.rs +++ b/vortex-array/src/arrays/list/vtable/mod.rs @@ -113,6 +113,7 @@ impl VTable for List { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/vortex-array/src/arrays/listview/vtable/mod.rs b/vortex-array/src/arrays/listview/vtable/mod.rs index 95944bb99fe..35d4884e3f4 100644 --- a/vortex-array/src/arrays/listview/vtable/mod.rs +++ b/vortex-array/src/arrays/listview/vtable/mod.rs @@ -117,6 +117,7 @@ impl VTable for ListView { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/vortex-array/src/arrays/masked/vtable/mod.rs b/vortex-array/src/arrays/masked/vtable/mod.rs index 70f7f566e41..c4f8aef6f50 100644 --- a/vortex-array/src/arrays/masked/vtable/mod.rs +++ b/vortex-array/src/arrays/masked/vtable/mod.rs @@ -77,6 +77,7 @@ impl VTable for Masked { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots[MaskedSlots::CHILD].is_some(), diff --git a/vortex-array/src/arrays/null/mod.rs b/vortex-array/src/arrays/null/mod.rs index ce32cc89342..4e071f668df 100644 --- a/vortex-array/src/arrays/null/mod.rs +++ b/vortex-array/src/arrays/null/mod.rs @@ -50,6 +50,7 @@ impl VTable for Null { dtype: &DType, _len: usize, _slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!(*dtype == DType::Null, "NullArray dtype must be DType::Null"); Ok(()) diff --git a/vortex-array/src/arrays/patched/vtable/mod.rs b/vortex-array/src/arrays/patched/vtable/mod.rs index 67183d1cdf5..0d0dc2a0149 100644 --- a/vortex-array/src/arrays/patched/vtable/mod.rs +++ b/vortex-array/src/arrays/patched/vtable/mod.rs @@ -113,6 +113,7 @@ impl VTable for Patched { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { data.validate(dtype, len, &PatchedSlotsView::from_slots(slots)) } diff --git a/vortex-array/src/arrays/primitive/array/mod.rs b/vortex-array/src/arrays/primitive/array/mod.rs index 867c7d0c783..dad11228842 100644 --- a/vortex-array/src/arrays/primitive/array/mod.rs +++ b/vortex-array/src/arrays/primitive/array/mod.rs @@ -18,6 +18,8 @@ use vortex_error::vortex_panic; use crate::ArraySlots; use crate::ExecutionCtx; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::array::Array; use crate::array::ArrayParts; use crate::array::TypedArrayRef; @@ -422,8 +424,11 @@ impl Array { let len = handle.len() / ptype.byte_width(); let slots = PrimitiveData::make_slots(&validity, len); let data = PrimitiveData::from_buffer_handle(handle, ptype, validity); - Array::try_from_parts(ArrayParts::new(Primitive, dtype, len, data).with_slots(slots)) - .vortex_expect("PrimitiveData is always valid") + Array::try_from_parts( + ArrayParts::new(Primitive, dtype, len, data).with_slots(slots), + &mut LEGACY_SESSION.create_execution_ctx(), + ) + .vortex_expect("PrimitiveData is always valid") } /// Creates a new `PrimitiveArray` from a [`ByteBuffer`]. diff --git a/vortex-array/src/arrays/primitive/vtable/mod.rs b/vortex-array/src/arrays/primitive/vtable/mod.rs index 39aa0e32f81..8200003c246 100644 --- a/vortex-array/src/arrays/primitive/vtable/mod.rs +++ b/vortex-array/src/arrays/primitive/vtable/mod.rs @@ -99,6 +99,7 @@ impl VTable for Primitive { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let DType::Primitive(_, nullability) = dtype else { vortex_bail!("Expected primitive dtype, got {dtype:?}"); diff --git a/vortex-array/src/arrays/scalar_fn/vtable/mod.rs b/vortex-array/src/arrays/scalar_fn/vtable/mod.rs index 6833848deae..b67f4bf8f25 100644 --- a/vortex-array/src/arrays/scalar_fn/vtable/mod.rs +++ b/vortex-array/src/arrays/scalar_fn/vtable/mod.rs @@ -82,6 +82,7 @@ impl VTable for ScalarFn { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( data.scalar_fn.id() == self.id, diff --git a/vortex-array/src/arrays/shared/vtable.rs b/vortex-array/src/arrays/shared/vtable.rs index 3c3a09216d2..e7faaa0dedd 100644 --- a/vortex-array/src/arrays/shared/vtable.rs +++ b/vortex-array/src/arrays/shared/vtable.rs @@ -63,6 +63,7 @@ impl VTable for Shared { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let source = slots[0] .as_ref() diff --git a/vortex-array/src/arrays/slice/vtable.rs b/vortex-array/src/arrays/slice/vtable.rs index ba716bee024..f7c7882cd52 100644 --- a/vortex-array/src/arrays/slice/vtable.rs +++ b/vortex-array/src/arrays/slice/vtable.rs @@ -74,6 +74,7 @@ impl VTable for Slice { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots[CHILD_SLOT].is_some(), diff --git a/vortex-array/src/arrays/struct_/array.rs b/vortex-array/src/arrays/struct_/array.rs index 8b939deb911..af332b59cb8 100644 --- a/vortex-array/src/arrays/struct_/array.rs +++ b/vortex-array/src/arrays/struct_/array.rs @@ -14,6 +14,8 @@ use vortex_error::vortex_err; use crate::ArrayRef; use crate::ArraySlots; use crate::IntoArray; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::array::Array; use crate::array::ArrayParts; use crate::array::EmptyArrayData; @@ -262,6 +264,7 @@ impl Array { EmptyArrayData, ) .with_slots(slots), + &mut LEGACY_SESSION.create_execution_ctx(), ) } @@ -298,6 +301,7 @@ impl Array { let slots = make_struct_slots(&fields, &validity, length); Array::try_from_parts( ArrayParts::new(Struct, outer_dtype, length, EmptyArrayData).with_slots(slots), + &mut LEGACY_SESSION.create_execution_ctx(), ) } diff --git a/vortex-array/src/arrays/struct_/vtable/mod.rs b/vortex-array/src/arrays/struct_/vtable/mod.rs index 5488f91baa7..41b99823fc1 100644 --- a/vortex-array/src/arrays/struct_/vtable/mod.rs +++ b/vortex-array/src/arrays/struct_/vtable/mod.rs @@ -62,6 +62,7 @@ impl VTable for Struct { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { let DType::Struct(struct_dtype, nullability) = dtype else { vortex_bail!("Expected struct dtype, found {:?}", dtype) diff --git a/vortex-array/src/arrays/varbin/vtable/mod.rs b/vortex-array/src/arrays/varbin/vtable/mod.rs index 90dcf320427..1c4b97fe990 100644 --- a/vortex-array/src/arrays/varbin/vtable/mod.rs +++ b/vortex-array/src/arrays/varbin/vtable/mod.rs @@ -88,6 +88,7 @@ impl VTable for VarBin { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/vortex-array/src/arrays/varbinview/vtable/mod.rs b/vortex-array/src/arrays/varbinview/vtable/mod.rs index 6af44097824..337d3d24746 100644 --- a/vortex-array/src/arrays/varbinview/vtable/mod.rs +++ b/vortex-array/src/arrays/varbinview/vtable/mod.rs @@ -90,6 +90,7 @@ impl VTable for VarBinView { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/vortex-array/src/arrays/variant/mod.rs b/vortex-array/src/arrays/variant/mod.rs index 1a5157e9aa1..7139c319fb6 100644 --- a/vortex-array/src/arrays/variant/mod.rs +++ b/vortex-array/src/arrays/variant/mod.rs @@ -17,6 +17,8 @@ pub(crate) fn initialize(session: &vortex_session::VortexSession) { } use crate::ArrayRef; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; use crate::array::Array; use crate::array::ArrayParts; use crate::array::EmptyArrayData; @@ -73,6 +75,7 @@ impl Array { Ok(Array::try_from_parts( ArrayParts::new(Variant, dtype, len, EmptyArrayData) .with_slots(vec![Some(core_storage), shredded].into()), + &mut LEGACY_SESSION.create_execution_ctx(), )? .with_stats_set(stats)) } diff --git a/vortex-array/src/arrays/variant/vtable/mod.rs b/vortex-array/src/arrays/variant/vtable/mod.rs index 19ade687875..18f4497fb12 100644 --- a/vortex-array/src/arrays/variant/vtable/mod.rs +++ b/vortex-array/src/arrays/variant/vtable/mod.rs @@ -73,6 +73,7 @@ impl VTable for Variant { dtype: &DType, len: usize, slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!( slots.len() == NUM_SLOTS, diff --git a/vortex-btrblocks/src/schemes/float/alprd.rs b/vortex-btrblocks/src/schemes/float/alprd.rs index f97ae077882..1636a165df0 100644 --- a/vortex-btrblocks/src/schemes/float/alprd.rs +++ b/vortex-btrblocks/src/schemes/float/alprd.rs @@ -82,7 +82,6 @@ impl Scheme for ALPRDScheme { parts.right_parts, right_bit_width, parts.left_parts_patches, - exec_ctx, )? .into_array()) } diff --git a/vortex-python/src/arrays/py/array.rs b/vortex-python/src/arrays/py/array.rs index e18972bdaf2..4ad9d5900d4 100644 --- a/vortex-python/src/arrays/py/array.rs +++ b/vortex-python/src/arrays/py/array.rs @@ -14,6 +14,8 @@ use vortex::array::Array; use vortex::array::ArrayParts; use vortex::array::ArrayRef; use vortex::array::IntoArray; +use vortex::array::LEGACY_SESSION; +use vortex::array::VortexSessionExecute; use vortex::array::stats::ArrayStats; use vortex::array::stats::StatsSet; use vortex::dtype::DType; @@ -75,7 +77,10 @@ impl IntoArray for PythonArray { let dtype = self.dtype.clone(); let len = self.len; let stats = StatsSet::from(self.stats.clone()); - match Array::try_from_parts(ArrayParts::new(vtable, dtype, len, self)) { + match Array::try_from_parts( + ArrayParts::new(vtable, dtype, len, self), + &mut LEGACY_SESSION.create_execution_ctx(), + ) { Ok(array) => array.with_stats_set(stats).into_array(), Err(err) => unreachable!( "PythonArray metadata extracted from PyPythonArray must be valid: {err}" diff --git a/vortex-python/src/arrays/py/vtable.rs b/vortex-python/src/arrays/py/vtable.rs index f8c8f44d7f8..d56b48a180c 100644 --- a/vortex-python/src/arrays/py/vtable.rs +++ b/vortex-python/src/arrays/py/vtable.rs @@ -64,6 +64,7 @@ impl VTable for PythonVTable { dtype: &DType, len: usize, _slots: &[Option], + _ctx: &mut ExecutionCtx, ) -> VortexResult<()> { vortex_ensure!(data.vtable.id == self.id, "PythonArray vtable id mismatch"); vortex_ensure!(&data.dtype == dtype, "PythonArray dtype mismatch");