Skip to content

Commit 73d7102

Browse files
committed
Engine
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 0631946 commit 73d7102

129 files changed

Lines changed: 1650 additions & 3606 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/public-api.lock

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ pub type vortex_alp::ALP::OperationsVTable = vortex_alp::ALP
3232

3333
pub type vortex_alp::ALP::ValidityVTable = vortex_array::array::vtable::validity::ValidityVTableFromChild
3434

35-
pub fn vortex_alp::ALP::array_eq(array: vortex_array::array::view::ArrayView<'_, Self>, other: vortex_array::array::view::ArrayView<'_, Self>, precision: vortex_array::hash::Precision) -> bool
35+
pub fn vortex_alp::ALP::array_eq(data: &vortex_alp::ALPData, other: &vortex_alp::ALPData, _precision: vortex_array::hash::Precision) -> bool
3636

37-
pub fn vortex_alp::ALP::array_hash<H: core::hash::Hasher>(array: vortex_array::array::view::ArrayView<'_, Self>, state: &mut H, precision: vortex_array::hash::Precision)
37+
pub fn vortex_alp::ALP::array_hash<H: core::hash::Hasher>(data: &vortex_alp::ALPData, state: &mut H, precision: vortex_array::hash::Precision)
3838

3939
pub fn vortex_alp::ALP::buffer(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> vortex_array::buffer::BufferHandle
4040

@@ -166,9 +166,9 @@ pub type vortex_alp::ALPRD::OperationsVTable = vortex_alp::ALPRD
166166

167167
pub type vortex_alp::ALPRD::ValidityVTable = vortex_array::array::vtable::validity::ValidityVTableFromChild
168168

169-
pub fn vortex_alp::ALPRD::array_eq(array: vortex_array::array::view::ArrayView<'_, Self>, other: vortex_array::array::view::ArrayView<'_, Self>, precision: vortex_array::hash::Precision) -> bool
169+
pub fn vortex_alp::ALPRD::array_eq(data: &vortex_alp::ALPRDData, other: &vortex_alp::ALPRDData, precision: vortex_array::hash::Precision) -> bool
170170

171-
pub fn vortex_alp::ALPRD::array_hash<H: core::hash::Hasher>(array: vortex_array::array::view::ArrayView<'_, Self>, state: &mut H, precision: vortex_array::hash::Precision)
171+
pub fn vortex_alp::ALPRD::array_hash<H: core::hash::Hasher>(data: &vortex_alp::ALPRDData, state: &mut H, precision: vortex_array::hash::Precision)
172172

173173
pub fn vortex_alp::ALPRD::buffer(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> vortex_array::buffer::BufferHandle
174174

@@ -330,47 +330,21 @@ pub fn vortex_alp::RDEncoder::from_parts(right_bit_width: u8, codes: alloc::vec:
330330

331331
pub fn vortex_alp::RDEncoder::new<T>(sample: &[T]) -> Self where T: vortex_alp::ALPRDFloat + vortex_array::dtype::ptype::NativePType, <T as vortex_alp::ALPRDFloat>::UINT: vortex_array::dtype::ptype::NativePType
332332

333-
pub trait vortex_alp::ALPArrayExt
334-
335-
pub fn vortex_alp::ALPArrayExt::alp_data(&self) -> &vortex_alp::ALPData
336-
337-
pub fn vortex_alp::ALPArrayExt::alp_len(&self) -> usize
338-
339-
pub fn vortex_alp::ALPArrayExt::as_slots(&self) -> &[core::option::Option<vortex_array::array::erased::ArrayRef>]
333+
pub trait vortex_alp::ALPArrayExt: vortex_array::array::typed::TypedArrayRef<vortex_alp::ALP>
340334

341335
pub fn vortex_alp::ALPArrayExt::encoded(&self) -> &vortex_array::array::erased::ArrayRef
342336

343337
pub fn vortex_alp::ALPArrayExt::exponents(&self) -> vortex_alp::Exponents
344338

345339
pub fn vortex_alp::ALPArrayExt::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
346340

347-
impl vortex_alp::ALPArrayExt for vortex_array::array::typed::Array<vortex_alp::ALP>
348-
349-
pub fn vortex_array::array::typed::Array<vortex_alp::ALP>::alp_data(&self) -> &vortex_alp::ALPData
350-
351-
pub fn vortex_array::array::typed::Array<vortex_alp::ALP>::alp_len(&self) -> usize
352-
353-
pub fn vortex_array::array::typed::Array<vortex_alp::ALP>::as_slots(&self) -> &[core::option::Option<vortex_array::array::erased::ArrayRef>]
354-
355-
pub fn vortex_array::array::typed::Array<vortex_alp::ALP>::encoded(&self) -> &vortex_array::array::erased::ArrayRef
356-
357-
pub fn vortex_array::array::typed::Array<vortex_alp::ALP>::exponents(&self) -> vortex_alp::Exponents
358-
359-
pub fn vortex_array::array::typed::Array<vortex_alp::ALP>::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
360-
361-
impl vortex_alp::ALPArrayExt for vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>
362-
363-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>::alp_data(&self) -> &vortex_alp::ALPData
364-
365-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>::alp_len(&self) -> usize
366-
367-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>::as_slots(&self) -> &[core::option::Option<vortex_array::array::erased::ArrayRef>]
341+
impl<T: vortex_array::array::typed::TypedArrayRef<vortex_alp::ALP>> vortex_alp::ALPArrayExt for T
368342

369-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>::encoded(&self) -> &vortex_array::array::erased::ArrayRef
343+
pub fn T::encoded(&self) -> &vortex_array::array::erased::ArrayRef
370344

371-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>::exponents(&self) -> vortex_alp::Exponents
345+
pub fn T::exponents(&self) -> vortex_alp::Exponents
372346

373-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALP>::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
347+
pub fn T::patches(&self) -> core::option::Option<vortex_array::patches::Patches>
374348

375349
pub trait vortex_alp::ALPArrayOwnedExt
376350

@@ -512,11 +486,7 @@ pub fn f64::find_best_exponents(values: &[Self]) -> vortex_alp::Exponents
512486

513487
pub fn f64::from_int(n: Self::ALPInt) -> Self
514488

515-
pub trait vortex_alp::ALPRDArrayExt
516-
517-
pub fn vortex_alp::ALPRDArrayExt::alprd_data(&self) -> &vortex_alp::ALPRDData
518-
519-
pub fn vortex_alp::ALPRDArrayExt::alprd_slots(&self) -> &[core::option::Option<vortex_array::array::erased::ArrayRef>]
489+
pub trait vortex_alp::ALPRDArrayExt: vortex_array::array::typed::TypedArrayRef<vortex_alp::ALPRD>
520490

521491
pub fn vortex_alp::ALPRDArrayExt::left_parts(&self) -> &vortex_array::array::erased::ArrayRef
522492

@@ -528,37 +498,17 @@ pub fn vortex_alp::ALPRDArrayExt::right_bit_width(&self) -> u8
528498

529499
pub fn vortex_alp::ALPRDArrayExt::right_parts(&self) -> &vortex_array::array::erased::ArrayRef
530500

531-
impl vortex_alp::ALPRDArrayExt for vortex_array::array::typed::Array<vortex_alp::ALPRD>
532-
533-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::alprd_data(&self) -> &vortex_alp::ALPRDData
534-
535-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::alprd_slots(&self) -> &[core::option::Option<vortex_array::array::erased::ArrayRef>]
536-
537-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::left_parts(&self) -> &vortex_array::array::erased::ArrayRef
538-
539-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::left_parts_dictionary(&self) -> &vortex_buffer::buffer::Buffer<u16>
540-
541-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::left_parts_patches(&self) -> core::option::Option<vortex_array::patches::Patches>
542-
543-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::right_bit_width(&self) -> u8
544-
545-
pub fn vortex_array::array::typed::Array<vortex_alp::ALPRD>::right_parts(&self) -> &vortex_array::array::erased::ArrayRef
546-
547-
impl vortex_alp::ALPRDArrayExt for vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>
548-
549-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::alprd_data(&self) -> &vortex_alp::ALPRDData
550-
551-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::alprd_slots(&self) -> &[core::option::Option<vortex_array::array::erased::ArrayRef>]
501+
impl<T: vortex_array::array::typed::TypedArrayRef<vortex_alp::ALPRD>> vortex_alp::ALPRDArrayExt for T
552502

553-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::left_parts(&self) -> &vortex_array::array::erased::ArrayRef
503+
pub fn T::left_parts(&self) -> &vortex_array::array::erased::ArrayRef
554504

555-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::left_parts_dictionary(&self) -> &vortex_buffer::buffer::Buffer<u16>
505+
pub fn T::left_parts_dictionary(&self) -> &vortex_buffer::buffer::Buffer<u16>
556506

557-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::left_parts_patches(&self) -> core::option::Option<vortex_array::patches::Patches>
507+
pub fn T::left_parts_patches(&self) -> core::option::Option<vortex_array::patches::Patches>
558508

559-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::right_bit_width(&self) -> u8
509+
pub fn T::right_bit_width(&self) -> u8
560510

561-
pub fn vortex_array::array::view::ArrayView<'_, vortex_alp::ALPRD>::right_parts(&self) -> &vortex_array::array::erased::ArrayRef
511+
pub fn T::right_parts(&self) -> &vortex_array::array::erased::ArrayRef
562512

563513
pub trait vortex_alp::ALPRDArrayOwnedExt
564514

encodings/alp/src/alp/array.rs

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use std::hash::Hash;
66

77
use prost::Message;
88
use vortex_array::Array;
9-
use vortex_array::ArrayEq;
10-
use vortex_array::ArrayHash;
119
use vortex_array::ArrayId;
1210
use vortex_array::ArrayParts;
1311
use vortex_array::ArrayRef;
@@ -16,6 +14,7 @@ use vortex_array::ExecutionCtx;
1614
use vortex_array::ExecutionResult;
1715
use vortex_array::IntoArray;
1816
use vortex_array::Precision;
17+
use vortex_array::TypedArrayRef;
1918
use vortex_array::arrays::Primitive;
2019
use vortex_array::buffer::BufferHandle;
2120
use vortex_array::dtype::DType;
@@ -76,7 +75,7 @@ impl VTable for ALP {
7675
)
7776
}
7877

79-
fn array_hash<H: std::hash::Hasher>(data: &ALPData, state: &mut H, precision: Precision) {
78+
fn array_hash<H: std::hash::Hasher>(data: &ALPData, state: &mut H, _precision: Precision) {
8079
data.exponents.hash(state);
8180
data.patch_offset.hash(state);
8281
data.patch_offset_within_chunk.hash(state);
@@ -158,10 +157,6 @@ impl VTable for ALP {
158157
Ok(ArrayParts::new(self.clone(), dtype.clone(), len, data).with_slots(slots))
159158
}
160159

161-
fn slots(array: ArrayView<'_, Self>) -> &[Option<ArrayRef>] {
162-
array.slots()
163-
}
164-
165160
fn slot_name(_array: ArrayView<'_, Self>, idx: usize) -> String {
166161
SLOT_NAMES[idx].to_string()
167162
}
@@ -457,12 +452,10 @@ impl ALP {
457452
let len = encoded.len();
458453
let slots = ALPData::make_slots(&encoded, &patches);
459454
unsafe {
460-
Array::from_parts_unchecked(ArrayParts::new(
461-
ALP,
462-
dtype,
463-
len,
464-
ALPData::new(encoded, exponents, patches),
465-
).with_slots(slots))
455+
Array::from_parts_unchecked(
456+
ArrayParts::new(ALP, dtype, len, ALPData::new(encoded, exponents, patches))
457+
.with_slots(slots),
458+
)
466459
}
467460
}
468461

@@ -521,27 +514,23 @@ impl ALPData {
521514
}
522515
}
523516

524-
pub trait ALPArrayExt {
525-
fn alp_data(&self) -> &ALPData;
526-
fn as_slots(&self) -> &[Option<ArrayRef>];
527-
fn alp_len(&self) -> usize;
528-
517+
pub trait ALPArrayExt: TypedArrayRef<ALP> {
529518
fn encoded(&self) -> &ArrayRef {
530-
self.as_slots()[ENCODED_SLOT]
519+
self.slots_ref()[ENCODED_SLOT]
531520
.as_ref()
532521
.vortex_expect("ALPArray encoded slot")
533522
}
534523

535524
fn exponents(&self) -> Exponents {
536-
self.alp_data().exponents
525+
self.exponents
537526
}
538527

539528
fn patches(&self) -> Option<Patches> {
540529
patches_from_slots(
541-
self.as_slots(),
542-
self.alp_data().patch_offset,
543-
self.alp_data().patch_offset_within_chunk,
544-
self.alp_len(),
530+
self.slots_ref(),
531+
self.patch_offset,
532+
self.patch_offset_within_chunk,
533+
self.as_ref().len(),
545534
)
546535
}
547536
}
@@ -570,33 +559,7 @@ fn patches_from_slots(
570559
}
571560
}
572561

573-
impl ALPArrayExt for Array<ALP> {
574-
fn alp_data(&self) -> &ALPData {
575-
self.data()
576-
}
577-
578-
fn as_slots(&self) -> &[Option<ArrayRef>] {
579-
self.slots()
580-
}
581-
582-
fn alp_len(&self) -> usize {
583-
self.len()
584-
}
585-
}
586-
587-
impl ALPArrayExt for ArrayView<'_, ALP> {
588-
fn alp_data(&self) -> &ALPData {
589-
self.data()
590-
}
591-
592-
fn as_slots(&self) -> &[Option<ArrayRef>] {
593-
self.slots()
594-
}
595-
596-
fn alp_len(&self) -> usize {
597-
self.len()
598-
}
599-
}
562+
impl<T: TypedArrayRef<ALP>> ALPArrayExt for T {}
600563

601564
pub trait ALPArrayOwnedExt {
602565
fn into_parts(self) -> (ArrayRef, Exponents, Option<Patches>);

encodings/alp/src/alp/compress.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ mod tests {
133133
use vortex_buffer::Buffer;
134134
use vortex_buffer::buffer;
135135

136+
use crate::alp::array::ALPArrayExt;
136137
use super::*;
137138
use crate::decompress_into_array;
138139

encodings/alp/src/alp/compute/between.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use vortex_array::scalar_fn::fns::between::StrictComparison;
1818
use vortex_error::VortexResult;
1919

2020
use crate::ALP;
21-
use crate::ALPArrayExt;
21+
use crate::alp::array::ALPArrayExt;
2222
use crate::ALPFloat;
2323
use crate::match_each_alp_float_ptype;
2424

@@ -102,6 +102,7 @@ mod tests {
102102
use vortex_array::scalar_fn::fns::between::StrictComparison;
103103

104104
use crate::ALPArray;
105+
use crate::alp::array::ALPArrayExt;
105106
use crate::alp::compute::between::between_impl;
106107
use crate::alp_encode;
107108

encodings/alp/src/alp/compute/cast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ mod tests {
7171
use vortex_error::VortexExpect;
7272
use vortex_error::VortexResult;
7373

74+
use crate::alp::array::ALPArrayExt;
7475
use crate::alp_encode;
7576

7677
#[test]

encodings/alp/src/alp/compute/mask.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ mod test {
5555
use vortex_array::compute::conformance::mask::test_mask_conformance;
5656
use vortex_buffer::buffer;
5757

58+
use crate::alp::array::ALPArrayExt;
5859
use crate::alp_encode;
5960

6061
#[rstest]

0 commit comments

Comments
 (0)