Skip to content

Commit 72257b4

Browse files
committed
Engine
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 011e328 commit 72257b4

99 files changed

Lines changed: 1417 additions & 1410 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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ 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(data: &vortex_alp::ALPData, other: &vortex_alp::ALPData, _precision: vortex_array::hash::Precision) -> bool
36-
37-
pub fn vortex_alp::ALP::array_hash<H: core::hash::Hasher>(data: &vortex_alp::ALPData, state: &mut H, _precision: vortex_array::hash::Precision)
38-
3935
pub fn vortex_alp::ALP::buffer(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> vortex_array::buffer::BufferHandle
4036

4137
pub fn vortex_alp::ALP::buffer_name(_array: vortex_array::array::view::ArrayView<'_, Self>, _idx: usize) -> core::option::Option<alloc::string::String>
@@ -118,6 +114,14 @@ impl core::fmt::Debug for vortex_alp::ALPData
118114

119115
pub fn vortex_alp::ALPData::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
120116

117+
impl vortex_array::hash::ArrayEq for vortex_alp::ALPData
118+
119+
pub fn vortex_alp::ALPData::array_eq(&self, other: &Self, _precision: vortex_array::hash::Precision) -> bool
120+
121+
impl vortex_array::hash::ArrayHash for vortex_alp::ALPData
122+
123+
pub fn vortex_alp::ALPData::array_hash<H: core::hash::Hasher>(&self, state: &mut H, _precision: vortex_array::hash::Precision)
124+
121125
pub struct vortex_alp::ALPMetadata
122126

123127
impl core::clone::Clone for vortex_alp::ALPMetadata
@@ -164,10 +168,6 @@ pub type vortex_alp::ALPRD::OperationsVTable = vortex_alp::ALPRD
164168

165169
pub type vortex_alp::ALPRD::ValidityVTable = vortex_array::array::vtable::validity::ValidityVTableFromChild
166170

167-
pub fn vortex_alp::ALPRD::array_eq(data: &vortex_alp::ALPRDData, other: &vortex_alp::ALPRDData, precision: vortex_array::hash::Precision) -> bool
168-
169-
pub fn vortex_alp::ALPRD::array_hash<H: core::hash::Hasher>(data: &vortex_alp::ALPRDData, state: &mut H, precision: vortex_array::hash::Precision)
170-
171171
pub fn vortex_alp::ALPRD::buffer(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> vortex_array::buffer::BufferHandle
172172

173173
pub fn vortex_alp::ALPRD::buffer_name(_array: vortex_array::array::view::ArrayView<'_, Self>, _idx: usize) -> core::option::Option<alloc::string::String>
@@ -238,6 +238,14 @@ impl core::fmt::Debug for vortex_alp::ALPRDData
238238

239239
pub fn vortex_alp::ALPRDData::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
240240

241+
impl vortex_array::hash::ArrayEq for vortex_alp::ALPRDData
242+
243+
pub fn vortex_alp::ALPRDData::array_eq(&self, other: &Self, precision: vortex_array::hash::Precision) -> bool
244+
245+
impl vortex_array::hash::ArrayHash for vortex_alp::ALPRDData
246+
247+
pub fn vortex_alp::ALPRDData::array_hash<H: core::hash::Hasher>(&self, state: &mut H, precision: vortex_array::hash::Precision)
248+
241249
pub struct vortex_alp::ALPRDDataParts
242250

243251
pub vortex_alp::ALPRDDataParts::left_parts: vortex_array::array::erased::ArrayRef

encodings/alp/src/alp/array.rs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33

44
use std::fmt::Debug;
55
use std::hash::Hash;
6+
use std::hash::Hasher;
67

78
use prost::Message;
89
use vortex_array::Array;
10+
use vortex_array::ArrayEq;
11+
use vortex_array::ArrayHash;
912
use vortex_array::ArrayId;
1013
use vortex_array::ArrayParts;
1114
use vortex_array::ArrayRef;
@@ -43,6 +46,22 @@ use crate::alp::rules::RULES;
4346

4447
vtable!(ALP, ALP, ALPData);
4548

49+
impl ArrayHash for ALPData {
50+
fn array_hash<H: Hasher>(&self, state: &mut H, _precision: Precision) {
51+
self.exponents.hash(state);
52+
self.patch_offset.hash(state);
53+
self.patch_offset_within_chunk.hash(state);
54+
}
55+
}
56+
57+
impl ArrayEq for ALPData {
58+
fn array_eq(&self, other: &Self, _precision: Precision) -> bool {
59+
self.exponents == other.exponents
60+
&& self.patch_offset == other.patch_offset
61+
&& self.patch_offset_within_chunk == other.patch_offset_within_chunk
62+
}
63+
}
64+
4665
impl VTable for ALP {
4766
type ArrayData = ALPData;
4867

@@ -75,18 +94,6 @@ impl VTable for ALP {
7594
)
7695
}
7796

78-
fn array_hash<H: std::hash::Hasher>(data: &ALPData, state: &mut H, _precision: Precision) {
79-
data.exponents.hash(state);
80-
data.patch_offset.hash(state);
81-
data.patch_offset_within_chunk.hash(state);
82-
}
83-
84-
fn array_eq(data: &ALPData, other: &ALPData, _precision: Precision) -> bool {
85-
data.exponents == other.exponents
86-
&& data.patch_offset == other.patch_offset
87-
&& data.patch_offset_within_chunk == other.patch_offset_within_chunk
88-
}
89-
9097
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {
9198
0
9299
}
@@ -413,7 +420,6 @@ impl ALPData {
413420
Some(p) => (Some(p.offset()), p.offset_within_chunk()),
414421
None => (None, None),
415422
};
416-
drop((encoded, patches));
417423

418424
Ok(Self {
419425
patch_offset,
@@ -427,15 +433,14 @@ impl ALPData {
427433
/// See [`ALPData::try_new`] for information about the preconditions that should be checked
428434
/// **before** calling this method.
429435
pub(crate) unsafe fn new_unchecked(
430-
encoded: ArrayRef,
436+
_encoded: ArrayRef,
431437
exponents: Exponents,
432438
patches: Option<Patches>,
433439
) -> Self {
434440
let (patch_offset, patch_offset_within_chunk) = match &patches {
435441
Some(p) => (Some(p.offset()), p.offset_within_chunk()),
436442
None => (None, None),
437443
};
438-
drop((encoded, patches));
439444

440445
Self {
441446
patch_offset,
@@ -516,7 +521,7 @@ impl ALPData {
516521

517522
pub trait ALPArrayExt: TypedArrayRef<ALP> {
518523
fn encoded(&self) -> &ArrayRef {
519-
self.slots_ref()[ENCODED_SLOT]
524+
self.as_ref().slots()[ENCODED_SLOT]
520525
.as_ref()
521526
.vortex_expect("ALPArray encoded slot")
522527
}
@@ -527,7 +532,7 @@ pub trait ALPArrayExt: TypedArrayRef<ALP> {
527532

528533
fn patches(&self) -> Option<Patches> {
529534
patches_from_slots(
530-
self.slots_ref(),
535+
self.as_ref().slots(),
531536
self.patch_offset,
532537
self.patch_offset_within_chunk,
533538
self.as_ref().len(),

encodings/alp/src/alp_rd/array.rs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use std::fmt::Debug;
55
use std::hash::Hash;
6+
use std::hash::Hasher;
67

78
use itertools::Itertools;
89
use prost::Message;
@@ -63,6 +64,25 @@ pub struct ALPRDMetadata {
6364
patches: Option<PatchesMetadata>,
6465
}
6566

67+
impl ArrayHash for ALPRDData {
68+
fn array_hash<H: Hasher>(&self, state: &mut H, precision: Precision) {
69+
self.left_parts_dictionary.array_hash(state, precision);
70+
self.right_bit_width.hash(state);
71+
self.patch_offset.hash(state);
72+
self.patch_offset_within_chunk.hash(state);
73+
}
74+
}
75+
76+
impl ArrayEq for ALPRDData {
77+
fn array_eq(&self, other: &Self, precision: Precision) -> bool {
78+
self.left_parts_dictionary
79+
.array_eq(&other.left_parts_dictionary, precision)
80+
&& self.right_bit_width == other.right_bit_width
81+
&& self.patch_offset == other.patch_offset
82+
&& self.patch_offset_within_chunk == other.patch_offset_within_chunk
83+
}
84+
}
85+
6686
impl VTable for ALPRD {
6787
type ArrayData = ALPRDData;
6888

@@ -83,21 +103,6 @@ impl VTable for ALPRD {
83103
data.validate_against_outer(dtype, len, slots)
84104
}
85105

86-
fn array_hash<H: std::hash::Hasher>(data: &ALPRDData, state: &mut H, precision: Precision) {
87-
data.left_parts_dictionary.array_hash(state, precision);
88-
data.right_bit_width.hash(state);
89-
data.patch_offset.hash(state);
90-
data.patch_offset_within_chunk.hash(state);
91-
}
92-
93-
fn array_eq(data: &ALPRDData, other: &ALPRDData, precision: Precision) -> bool {
94-
data.left_parts_dictionary
95-
.array_eq(&other.left_parts_dictionary, precision)
96-
&& data.right_bit_width == other.right_bit_width
97-
&& data.patch_offset == other.patch_offset
98-
&& data.patch_offset_within_chunk == other.patch_offset_within_chunk
99-
}
100-
101106
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {
102107
0
103108
}
@@ -531,14 +536,12 @@ impl ALPRDData {
531536
/// it constructs it from parts.
532537
pub(crate) unsafe fn new_unchecked(
533538
_dtype: DType,
534-
left_parts: ArrayRef,
539+
_left_parts: ArrayRef,
535540
left_parts_dictionary: Buffer<u16>,
536-
right_parts: ArrayRef,
541+
_right_parts: ArrayRef,
537542
right_bit_width: u8,
538543
left_parts_patches: Option<Patches>,
539544
) -> Self {
540-
drop(left_parts);
541-
drop(right_parts);
542545
Self {
543546
patch_offset: left_parts_patches.as_ref().map(Patches::offset),
544547
patch_offset_within_chunk: left_parts_patches
@@ -631,11 +634,11 @@ fn patches_from_slots(
631634

632635
pub trait ALPRDArrayExt: TypedArrayRef<ALPRD> {
633636
fn left_parts(&self) -> &ArrayRef {
634-
left_parts_from_slots(self.slots_ref())
637+
left_parts_from_slots(self.as_ref().slots())
635638
}
636639

637640
fn right_parts(&self) -> &ArrayRef {
638-
right_parts_from_slots(self.slots_ref())
641+
right_parts_from_slots(self.as_ref().slots())
639642
}
640643

641644
fn right_bit_width(&self) -> u8 {
@@ -644,7 +647,7 @@ pub trait ALPRDArrayExt: TypedArrayRef<ALPRD> {
644647

645648
fn left_parts_patches(&self) -> Option<Patches> {
646649
patches_from_slots(
647-
self.slots_ref(),
650+
self.as_ref().slots(),
648651
self.patch_offset,
649652
self.patch_offset_within_chunk,
650653
self.as_ref().len(),

encodings/bytebool/public-api.lock

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ pub type vortex_bytebool::ByteBool::OperationsVTable = vortex_bytebool::ByteBool
2828

2929
pub type vortex_bytebool::ByteBool::ValidityVTable = vortex_bytebool::ByteBool
3030

31-
pub fn vortex_bytebool::ByteBool::array_eq(data: &vortex_bytebool::ByteBoolData, other: &vortex_bytebool::ByteBoolData, precision: vortex_array::hash::Precision) -> bool
32-
33-
pub fn vortex_bytebool::ByteBool::array_hash<H: core::hash::Hasher>(data: &vortex_bytebool::ByteBoolData, state: &mut H, precision: vortex_array::hash::Precision)
34-
3531
pub fn vortex_bytebool::ByteBool::buffer(array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> vortex_array::buffer::BufferHandle
3632

3733
pub fn vortex_bytebool::ByteBool::buffer_name(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> core::option::Option<alloc::string::String>
@@ -112,6 +108,14 @@ impl core::fmt::Debug for vortex_bytebool::ByteBoolData
112108

113109
pub fn vortex_bytebool::ByteBoolData::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
114110

111+
impl vortex_array::hash::ArrayEq for vortex_bytebool::ByteBoolData
112+
113+
pub fn vortex_bytebool::ByteBoolData::array_eq(&self, other: &Self, precision: vortex_array::hash::Precision) -> bool
114+
115+
impl vortex_array::hash::ArrayHash for vortex_bytebool::ByteBoolData
116+
117+
pub fn vortex_bytebool::ByteBoolData::array_hash<H: core::hash::Hasher>(&self, state: &mut H, precision: vortex_array::hash::Precision)
118+
115119
pub trait vortex_bytebool::ByteBoolArrayExt: vortex_array::array::typed::TypedArrayRef<vortex_bytebool::ByteBool>
116120

117121
pub fn vortex_bytebool::ByteBoolArrayExt::validity(&self) -> vortex_array::validity::Validity

encodings/bytebool/src/array.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::fmt::Debug;
5+
use std::hash::Hasher;
56

67
use vortex_array::Array;
78
use vortex_array::ArrayEq;
@@ -40,6 +41,18 @@ use crate::kernel::PARENT_KERNELS;
4041

4142
vtable!(ByteBool, ByteBool, ByteBoolData);
4243

44+
impl ArrayHash for ByteBoolData {
45+
fn array_hash<H: Hasher>(&self, state: &mut H, precision: Precision) {
46+
self.buffer.array_hash(state, precision);
47+
}
48+
}
49+
50+
impl ArrayEq for ByteBoolData {
51+
fn array_eq(&self, other: &Self, precision: Precision) -> bool {
52+
self.buffer.array_eq(&other.buffer, precision)
53+
}
54+
}
55+
4356
impl VTable for ByteBool {
4457
type ArrayData = ByteBoolData;
4558

@@ -61,14 +74,6 @@ impl VTable for ByteBool {
6174
ByteBoolData::validate(data.buffer(), &validity, dtype, len)
6275
}
6376

64-
fn array_hash<H: std::hash::Hasher>(data: &ByteBoolData, state: &mut H, precision: Precision) {
65-
data.buffer.array_hash(state, precision);
66-
}
67-
68-
fn array_eq(data: &ByteBoolData, other: &ByteBoolData, precision: Precision) -> bool {
69-
data.buffer.array_eq(&other.buffer, precision)
70-
}
71-
7277
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {
7378
1
7479
}
@@ -168,7 +173,7 @@ pub struct ByteBoolData {
168173
pub trait ByteBoolArrayExt: TypedArrayRef<ByteBool> {
169174
fn validity(&self) -> Validity {
170175
child_to_validity(
171-
&self.slots_ref()[VALIDITY_SLOT],
176+
&self.as_ref().slots()[VALIDITY_SLOT],
172177
self.as_ref().dtype().nullability(),
173178
)
174179
}

encodings/datetime-parts/public-api.lock

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ pub type vortex_datetime_parts::DateTimeParts::OperationsVTable = vortex_datetim
2626

2727
pub type vortex_datetime_parts::DateTimeParts::ValidityVTable = vortex_array::array::vtable::validity::ValidityVTableFromChild
2828

29-
pub fn vortex_datetime_parts::DateTimeParts::array_eq(_data: &vortex_datetime_parts::DateTimePartsData, _other: &vortex_datetime_parts::DateTimePartsData, _precision: vortex_array::hash::Precision) -> bool
30-
31-
pub fn vortex_datetime_parts::DateTimeParts::array_hash<H: core::hash::Hasher>(_data: &vortex_datetime_parts::DateTimePartsData, _state: &mut H, _precision: vortex_array::hash::Precision)
32-
3329
pub fn vortex_datetime_parts::DateTimeParts::buffer(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> vortex_array::buffer::BufferHandle
3430

3531
pub fn vortex_datetime_parts::DateTimeParts::buffer_name(_array: vortex_array::array::view::ArrayView<'_, Self>, idx: usize) -> core::option::Option<alloc::string::String>
@@ -104,6 +100,14 @@ impl core::fmt::Debug for vortex_datetime_parts::DateTimePartsData
104100

105101
pub fn vortex_datetime_parts::DateTimePartsData::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
106102

103+
impl vortex_array::hash::ArrayEq for vortex_datetime_parts::DateTimePartsData
104+
105+
pub fn vortex_datetime_parts::DateTimePartsData::array_eq(&self, _other: &Self, _precision: vortex_array::hash::Precision) -> bool
106+
107+
impl vortex_array::hash::ArrayHash for vortex_datetime_parts::DateTimePartsData
108+
109+
pub fn vortex_datetime_parts::DateTimePartsData::array_hash<H: core::hash::Hasher>(&self, _state: &mut H, _precision: vortex_array::hash::Precision)
110+
107111
#[repr(C)] pub struct vortex_datetime_parts::DateTimePartsMetadata
108112

109113
pub vortex_datetime_parts::DateTimePartsMetadata::days_ptype: i32

0 commit comments

Comments
 (0)