Skip to content

Commit af6da6d

Browse files
committed
Normalize Execution
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 8e6d4e2 commit af6da6d

50 files changed

Lines changed: 571 additions & 441 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

encodings/alp/src/alp/array.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,14 @@ impl ALP {
452452
pub fn new(encoded: ArrayRef, exponents: Exponents, patches: Option<Patches>) -> ALPArray {
453453
let dtype = ALPData::logical_dtype(&encoded).vortex_expect("ALP encoded dtype");
454454
let len = encoded.len();
455-
Array::try_from_parts(ArrayParts::new(
456-
ALP,
457-
dtype,
458-
len,
459-
ALPData::new(encoded, exponents, patches),
460-
))
461-
.vortex_expect("ALPData is always valid")
455+
unsafe {
456+
Array::from_parts_unchecked(ArrayParts::new(
457+
ALP,
458+
dtype,
459+
len,
460+
ALPData::new(encoded, exponents, patches),
461+
))
462+
}
462463
}
463464

464465
pub fn try_new(
@@ -469,7 +470,7 @@ impl ALP {
469470
let dtype = ALPData::logical_dtype(&encoded)?;
470471
let len = encoded.len();
471472
let data = ALPData::try_new(encoded, exponents, patches)?;
472-
Array::try_from_parts(ArrayParts::new(ALP, dtype, len, data))
473+
Ok(unsafe { Array::from_parts_unchecked(ArrayParts::new(ALP, dtype, len, data)) })
473474
}
474475

475476
/// # Safety
@@ -481,10 +482,8 @@ impl ALP {
481482
) -> ALPArray {
482483
let dtype = ALPData::logical_dtype(&encoded).vortex_expect("ALP encoded dtype");
483484
let len = encoded.len();
484-
Array::try_from_parts(ArrayParts::new(ALP, dtype, len, unsafe {
485-
ALPData::new_unchecked(encoded, exponents, patches)
486-
}))
487-
.vortex_expect("ALPData is always valid")
485+
let data = unsafe { ALPData::new_unchecked(encoded, exponents, patches) };
486+
unsafe { Array::from_parts_unchecked(ArrayParts::new(ALP, dtype, len, data)) }
488487
}
489488
}
490489

encodings/alp/src/alp_rd/array.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ impl ALPRD {
379379
right_bit_width,
380380
left_parts_patches,
381381
)?;
382-
Array::try_from_parts(ArrayParts::new(ALPRD, logical_dtype, len, data))
382+
Ok(
383+
unsafe {
384+
Array::from_parts_unchecked(ArrayParts::new(ALPRD, logical_dtype, len, data))
385+
},
386+
)
383387
}
384388

385389
/// # Safety
@@ -404,8 +408,7 @@ impl ALPRD {
404408
left_parts_patches,
405409
)
406410
};
407-
Array::try_from_parts(ArrayParts::new(ALPRD, logical_dtype, len, data))
408-
.vortex_expect("ALPRDData is always valid")
411+
unsafe { Array::from_parts_unchecked(ArrayParts::new(ALPRD, logical_dtype, len, data)) }
409412
}
410413
}
411414

encodings/bytebool/src/array.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use vortex_array::vtable::ValidityVTableFromValidityHelper;
2828
use vortex_array::vtable::validity_to_child;
2929
use vortex_buffer::BitBuffer;
3030
use vortex_buffer::ByteBuffer;
31-
use vortex_error::VortexExpect;
3231
use vortex_error::VortexResult;
3332
use vortex_error::vortex_bail;
3433
use vortex_error::vortex_ensure;
@@ -189,26 +188,23 @@ impl ByteBool {
189188
let dtype = DType::Bool(validity.nullability());
190189
let data = ByteBoolData::new(buffer, validity);
191190
let len = data.len();
192-
Array::try_from_parts(ArrayParts::new(ByteBool, dtype, len, data))
193-
.vortex_expect("ByteBoolData is always valid")
191+
unsafe { Array::from_parts_unchecked(ArrayParts::new(ByteBool, dtype, len, data)) }
194192
}
195193

196194
/// Construct a [`ByteBoolArray`] from a `Vec<bool>` and validity.
197195
pub fn from_vec<V: Into<Validity>>(data: Vec<bool>, validity: V) -> ByteBoolArray {
198196
let data = ByteBoolData::from_vec(data, validity);
199197
let dtype = DType::Bool(data.validity.nullability());
200198
let len = data.len();
201-
Array::try_from_parts(ArrayParts::new(ByteBool, dtype, len, data))
202-
.vortex_expect("ByteBoolData is always valid")
199+
unsafe { Array::from_parts_unchecked(ArrayParts::new(ByteBool, dtype, len, data)) }
203200
}
204201

205202
/// Construct a [`ByteBoolArray`] from optional bools.
206203
pub fn from_option_vec(data: Vec<Option<bool>>) -> ByteBoolArray {
207204
let data = ByteBoolData::from(data);
208205
let dtype = DType::Bool(data.validity.nullability());
209206
let len = data.len();
210-
Array::try_from_parts(ArrayParts::new(ByteBool, dtype, len, data))
211-
.vortex_expect("ByteBoolData is always valid")
207+
unsafe { Array::from_parts_unchecked(ArrayParts::new(ByteBool, dtype, len, data)) }
212208
}
213209
}
214210

encodings/datetime-parts/src/array.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,23 @@ impl DateTimeParts {
234234
) -> VortexResult<DateTimePartsArray> {
235235
let data = DateTimePartsData::try_new(dtype.clone(), days, seconds, subseconds)?;
236236
let len = data.len();
237-
Array::try_from_parts(ArrayParts::new(DateTimeParts, dtype, len, data))
237+
Ok(
238+
unsafe {
239+
Array::from_parts_unchecked(ArrayParts::new(DateTimeParts, dtype, len, data))
240+
},
241+
)
238242
}
239243

240244
/// Construct a [`DateTimePartsArray`] from a [`TemporalArray`].
241245
pub fn try_from_temporal(temporal: TemporalArray) -> VortexResult<DateTimePartsArray> {
242246
let dtype = temporal.dtype().clone();
243247
let data = DateTimePartsData::try_from(temporal)?;
244248
let len = data.len();
245-
Array::try_from_parts(ArrayParts::new(DateTimeParts, dtype, len, data))
249+
Ok(
250+
unsafe {
251+
Array::from_parts_unchecked(ArrayParts::new(DateTimeParts, dtype, len, data))
252+
},
253+
)
246254
}
247255
}
248256

encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ impl DecimalByteParts {
266266
let data = DecimalBytePartsData::try_new(msp, decimal_dtype)?;
267267
let dtype = DType::Decimal(decimal_dtype, data.msp().dtype().nullability());
268268
let len = data.len();
269-
Array::try_from_parts(ArrayParts::new(DecimalByteParts, dtype, len, data))
269+
Ok(unsafe {
270+
Array::from_parts_unchecked(ArrayParts::new(DecimalByteParts, dtype, len, data))
271+
})
270272
}
271273
}
272274

encodings/fastlanes/public-api.lock

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, S>::decode_into(&mut sel
7878

7979
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, S>::initial(&mut self) -> core::option::Option<&mut [T]>
8080

81-
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, S>::new_with_strategy(strategy: S, packed: vortex_buffer::ByteBuffer, bit_width: usize, offset: usize, len: usize) -> Self
82-
8381
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, S>::trailer(&mut self) -> core::option::Option<&mut [T]>
8482

83+
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, S>::try_new_with_strategy(strategy: S, packed: vortex_buffer::ByteBuffer, bit_width: usize, offset: usize, len: usize) -> vortex_error::VortexResult<Self>
84+
8585
impl<T: vortex_fastlanes::unpack_iter::BitPacked> vortex_fastlanes::unpack_iter::UnpackedChunks<T, vortex_fastlanes::unpack_iter::BitPackingStrategy>
8686

8787
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, vortex_fastlanes::unpack_iter::BitPackingStrategy>::full_chunks(&mut self) -> vortex_fastlanes::unpack_iter::BitUnpackIterator<'_, T>
8888

89-
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, vortex_fastlanes::unpack_iter::BitPackingStrategy>::new(array: &vortex_fastlanes::BitPackedData, len: usize) -> Self
89+
pub fn vortex_fastlanes::unpack_iter::UnpackedChunks<T, vortex_fastlanes::unpack_iter::BitPackingStrategy>::try_new(array: &vortex_fastlanes::BitPackedData, len: usize) -> vortex_error::VortexResult<Self>
9090

9191
pub trait vortex_fastlanes::unpack_iter::BitPacked: vortex_array::dtype::ptype::PhysicalPType<Physicalfastlanes::bitpacking::BitPacking>
9292

@@ -218,6 +218,12 @@ pub fn vortex_fastlanes::BitPackedData::packed(&self) -> &vortex_array::buffer::
218218

219219
pub fn vortex_fastlanes::BitPackedData::packed_slice<T: vortex_array::dtype::ptype::NativePType + fastlanes::bitpacking::BitPacking>(&self) -> &[T]
220220

221+
pub fn vortex_fastlanes::BitPackedData::patch_chunk_offsets(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
222+
223+
pub fn vortex_fastlanes::BitPackedData::patch_indices(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
224+
225+
pub fn vortex_fastlanes::BitPackedData::patch_values(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
226+
221227
pub fn vortex_fastlanes::BitPackedData::patches(&self, len: usize) -> core::option::Option<vortex_array::patches::Patches>
222228

223229
pub fn vortex_fastlanes::BitPackedData::ptype(&self, dtype: &vortex_array::dtype::DType) -> vortex_array::dtype::ptype::PType
@@ -226,10 +232,12 @@ pub fn vortex_fastlanes::BitPackedData::replace_patches(&mut self, patches: core
226232

227233
pub fn vortex_fastlanes::BitPackedData::try_new(packed: vortex_array::buffer::BufferHandle, ptype: vortex_array::dtype::ptype::PType, validity: vortex_array::validity::Validity, patches: core::option::Option<vortex_array::patches::Patches>, bit_width: u8, length: usize, offset: u16) -> vortex_error::VortexResult<Self>
228234

229-
pub fn vortex_fastlanes::BitPackedData::unpacked_chunks<T: vortex_fastlanes::unpack_iter::BitPacked>(&self, dtype: &vortex_array::dtype::DType, len: usize) -> vortex_fastlanes::unpack_iter::BitUnpackedChunks<T>
235+
pub fn vortex_fastlanes::BitPackedData::unpacked_chunks<T: vortex_fastlanes::unpack_iter::BitPacked>(&self, dtype: &vortex_array::dtype::DType, len: usize) -> vortex_error::VortexResult<vortex_fastlanes::unpack_iter::BitUnpackedChunks<T>>
230236

231237
pub fn vortex_fastlanes::BitPackedData::validity(&self, nullability: vortex_array::dtype::nullability::Nullability) -> vortex_array::validity::Validity
232238

239+
pub fn vortex_fastlanes::BitPackedData::validity_child(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
240+
233241
pub fn vortex_fastlanes::BitPackedData::validity_mask(&self, len: usize, nullability: vortex_array::dtype::nullability::Nullability) -> vortex_mask::Mask
234242

235243
impl core::clone::Clone for vortex_fastlanes::BitPackedData
@@ -558,6 +566,102 @@ impl core::fmt::Debug for vortex_fastlanes::RLEData
558566

559567
pub fn vortex_fastlanes::RLEData::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
560568

569+
pub trait vortex_fastlanes::BitPackedArrayExt
570+
571+
pub fn vortex_fastlanes::BitPackedArrayExt::bit_width(&self) -> u8
572+
573+
pub fn vortex_fastlanes::BitPackedArrayExt::bitpacked_data(&self) -> &vortex_fastlanes::BitPackedData
574+
575+
pub fn vortex_fastlanes::BitPackedArrayExt::bitpacked_dtype(&self) -> &vortex_array::dtype::DType
576+
577+
pub fn vortex_fastlanes::BitPackedArrayExt::bitpacked_len(&self) -> usize
578+
579+
pub fn vortex_fastlanes::BitPackedArrayExt::offset(&self) -> u16
580+
581+
pub fn vortex_fastlanes::BitPackedArrayExt::packed(&self) -> &vortex_array::buffer::BufferHandle
582+
583+
pub fn vortex_fastlanes::BitPackedArrayExt::packed_slice<T: vortex_array::dtype::ptype::NativePType + fastlanes::bitpacking::BitPacking>(&self) -> &[T]
584+
585+
pub fn vortex_fastlanes::BitPackedArrayExt::patch_chunk_offsets(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
586+
587+
pub fn vortex_fastlanes::BitPackedArrayExt::patch_indices(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
588+
589+
pub fn vortex_fastlanes::BitPackedArrayExt::patch_values(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
590+
591+
pub fn vortex_fastlanes::BitPackedArrayExt::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
592+
593+
pub fn vortex_fastlanes::BitPackedArrayExt::unpacked_chunks<T: vortex_fastlanes::unpack_iter::BitPacked>(&self) -> vortex_error::VortexResult<vortex_fastlanes::unpack_iter::BitUnpackedChunks<T>>
594+
595+
pub fn vortex_fastlanes::BitPackedArrayExt::validity(&self) -> vortex_array::validity::Validity
596+
597+
pub fn vortex_fastlanes::BitPackedArrayExt::validity_child(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
598+
599+
pub fn vortex_fastlanes::BitPackedArrayExt::validity_mask(&self) -> vortex_mask::Mask
600+
601+
impl vortex_fastlanes::BitPackedArrayExt for vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>
602+
603+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::bit_width(&self) -> u8
604+
605+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::bitpacked_data(&self) -> &vortex_fastlanes::BitPackedData
606+
607+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::bitpacked_dtype(&self) -> &vortex_array::dtype::DType
608+
609+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::bitpacked_len(&self) -> usize
610+
611+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::offset(&self) -> u16
612+
613+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::packed(&self) -> &vortex_array::buffer::BufferHandle
614+
615+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::packed_slice<T: vortex_array::dtype::ptype::NativePType + fastlanes::bitpacking::BitPacking>(&self) -> &[T]
616+
617+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::patch_chunk_offsets(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
618+
619+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::patch_indices(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
620+
621+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::patch_values(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
622+
623+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
624+
625+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::unpacked_chunks<T: vortex_fastlanes::unpack_iter::BitPacked>(&self) -> vortex_error::VortexResult<vortex_fastlanes::unpack_iter::BitUnpackedChunks<T>>
626+
627+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::validity(&self) -> vortex_array::validity::Validity
628+
629+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::validity_child(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
630+
631+
pub fn vortex_array::array::typed::Array<vortex_fastlanes::BitPacked>::validity_mask(&self) -> vortex_mask::Mask
632+
633+
impl vortex_fastlanes::BitPackedArrayExt for vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>
634+
635+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::bit_width(&self) -> u8
636+
637+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::bitpacked_data(&self) -> &vortex_fastlanes::BitPackedData
638+
639+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::bitpacked_dtype(&self) -> &vortex_array::dtype::DType
640+
641+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::bitpacked_len(&self) -> usize
642+
643+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::offset(&self) -> u16
644+
645+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::packed(&self) -> &vortex_array::buffer::BufferHandle
646+
647+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::packed_slice<T: vortex_array::dtype::ptype::NativePType + fastlanes::bitpacking::BitPacking>(&self) -> &[T]
648+
649+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::patch_chunk_offsets(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
650+
651+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::patch_indices(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
652+
653+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::patch_values(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
654+
655+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
656+
657+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::unpacked_chunks<T: vortex_fastlanes::unpack_iter::BitPacked>(&self) -> vortex_error::VortexResult<vortex_fastlanes::unpack_iter::BitUnpackedChunks<T>>
658+
659+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::validity(&self) -> vortex_array::validity::Validity
660+
661+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::validity_child(&self) -> core::option::Option<&vortex_array::array::erased::ArrayRef>
662+
663+
pub fn vortex_array::array::view::ArrayView<'_, vortex_fastlanes::BitPacked>::validity_mask(&self) -> vortex_mask::Mask
664+
561665
pub fn vortex_fastlanes::delta_compress(array: &vortex_array::arrays::primitive::vtable::PrimitiveArray, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<(vortex_array::arrays::primitive::vtable::PrimitiveArray, vortex_array::arrays::primitive::vtable::PrimitiveArray)>
562666

563667
pub fn vortex_fastlanes::initialize(session: &mut vortex_session::VortexSession)

0 commit comments

Comments
 (0)