Skip to content

Commit 0631946

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

42 files changed

Lines changed: 244 additions & 610 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: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,16 @@ impl VTable for ALP {
7676
)
7777
}
7878

79-
fn array_hash<H: std::hash::Hasher>(
80-
array: ArrayView<'_, Self>,
81-
state: &mut H,
82-
precision: Precision,
83-
) {
84-
array.encoded().array_hash(state, precision);
85-
array.exponents.hash(state);
86-
array.patches().array_hash(state, precision);
79+
fn array_hash<H: std::hash::Hasher>(data: &ALPData, state: &mut H, precision: Precision) {
80+
data.exponents.hash(state);
81+
data.patch_offset.hash(state);
82+
data.patch_offset_within_chunk.hash(state);
8783
}
8884

89-
fn array_eq(
90-
array: ArrayView<'_, Self>,
91-
other: ArrayView<'_, Self>,
92-
precision: Precision,
93-
) -> bool {
94-
array.encoded().array_eq(other.encoded(), precision)
95-
&& array.exponents == other.exponents
96-
&& array.patches().array_eq(&other.patches(), precision)
85+
fn array_eq(data: &ALPData, other: &ALPData, _precision: Precision) -> bool {
86+
data.exponents == other.exponents
87+
&& data.patch_offset == other.patch_offset
88+
&& data.patch_offset_within_chunk == other.patch_offset_within_chunk
9789
}
9890

9991
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/alp/src/alp_rd/array.rs

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,30 +82,17 @@ impl VTable for ALPRD {
8282
data.validate_against_outer(dtype, len, slots)
8383
}
8484

85-
fn array_hash<H: std::hash::Hasher>(
86-
array: ArrayView<'_, Self>,
87-
state: &mut H,
88-
precision: Precision,
89-
) {
90-
array.left_parts().array_hash(state, precision);
91-
array.left_parts_dictionary.array_hash(state, precision);
92-
array.right_parts().array_hash(state, precision);
93-
array.right_bit_width.hash(state);
94-
array.left_parts_patches.array_hash(state, precision);
85+
fn array_hash<H: std::hash::Hasher>(data: &ALPRDData, state: &mut H, precision: Precision) {
86+
data.left_parts_dictionary.array_hash(state, precision);
87+
data.right_bit_width.hash(state);
88+
data.left_parts_patches.array_hash(state, precision);
9589
}
9690

97-
fn array_eq(
98-
array: ArrayView<'_, Self>,
99-
other: ArrayView<'_, Self>,
100-
precision: Precision,
101-
) -> bool {
102-
array.left_parts().array_eq(other.left_parts(), precision)
103-
&& array
104-
.left_parts_dictionary
105-
.array_eq(&other.left_parts_dictionary, precision)
106-
&& array.right_parts().array_eq(other.right_parts(), precision)
107-
&& array.right_bit_width == other.right_bit_width
108-
&& array
91+
fn array_eq(data: &ALPRDData, other: &ALPRDData, precision: Precision) -> bool {
92+
data.left_parts_dictionary
93+
.array_eq(&other.left_parts_dictionary, precision)
94+
&& data.right_bit_width == other.right_bit_width
95+
&& data
10996
.left_parts_patches
11097
.array_eq(&other.left_parts_patches, precision)
11198
}

encodings/bytebool/src/array.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,12 @@ impl VTable for ByteBool {
6060
ByteBoolData::validate(data.buffer(), &validity, dtype, len)
6161
}
6262

63-
fn array_hash<H: std::hash::Hasher>(
64-
array: ArrayView<'_, Self>,
65-
state: &mut H,
66-
precision: Precision,
67-
) {
68-
array.buffer.array_hash(state, precision);
69-
ByteBoolArrayExt::validity(&array).array_hash(state, precision);
63+
fn array_hash<H: std::hash::Hasher>(data: &ByteBoolData, state: &mut H, precision: Precision) {
64+
data.buffer.array_hash(state, precision);
7065
}
7166

72-
fn array_eq(
73-
array: ArrayView<'_, Self>,
74-
other: ArrayView<'_, Self>,
75-
precision: Precision,
76-
) -> bool {
77-
array.buffer.array_eq(&other.buffer, precision)
78-
&& ByteBoolArrayExt::validity(&array)
79-
.array_eq(&ByteBoolArrayExt::validity(&other), precision)
67+
fn array_eq(data: &ByteBoolData, other: &ByteBoolData, precision: Precision) -> bool {
68+
data.buffer.array_eq(&other.buffer, precision)
8069
}
8170

8271
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/datetime-parts/src/array.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,18 @@ impl VTable for DateTimeParts {
9999
}
100100

101101
fn array_hash<H: std::hash::Hasher>(
102-
array: ArrayView<'_, Self>,
103-
state: &mut H,
104-
precision: Precision,
102+
_data: &DateTimePartsData,
103+
_state: &mut H,
104+
_precision: Precision,
105105
) {
106-
array.days().array_hash(state, precision);
107-
array.seconds().array_hash(state, precision);
108-
array.subseconds().array_hash(state, precision);
109106
}
110107

111108
fn array_eq(
112-
array: ArrayView<'_, Self>,
113-
other: ArrayView<'_, Self>,
114-
precision: Precision,
109+
_data: &DateTimePartsData,
110+
_other: &DateTimePartsData,
111+
_precision: Precision,
115112
) -> bool {
116-
array.days().array_eq(other.days(), precision)
117-
&& array.seconds().array_eq(other.seconds(), precision)
118-
&& array.subseconds().array_eq(other.subseconds(), precision)
113+
true
119114
}
120115

121116
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,18 @@ impl VTable for DecimalByteParts {
8080
}
8181

8282
fn array_hash<H: std::hash::Hasher>(
83-
array: ArrayView<'_, Self>,
84-
state: &mut H,
85-
precision: Precision,
83+
_data: &DecimalBytePartsData,
84+
_state: &mut H,
85+
_precision: Precision,
8686
) {
87-
array.msp().array_hash(state, precision);
8887
}
8988

9089
fn array_eq(
91-
array: ArrayView<'_, Self>,
92-
other: ArrayView<'_, Self>,
93-
precision: Precision,
90+
_data: &DecimalBytePartsData,
91+
_other: &DecimalBytePartsData,
92+
_precision: Precision,
9493
) -> bool {
95-
array.msp().array_eq(other.msp(), precision)
94+
true
9695
}
9796

9897
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/fastlanes/src/bitpacking/vtable/mod.rs

Lines changed: 12 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -106,76 +106,20 @@ impl VTable for BitPacked {
106106
data.validate_against_slots(dtype, len, &validity, patches.as_ref())
107107
}
108108

109-
fn array_hash<H: std::hash::Hasher>(
110-
array: ArrayView<'_, Self>,
111-
state: &mut H,
112-
precision: Precision,
113-
) {
114-
array.offset.hash(state);
115-
array.bit_width.hash(state);
116-
array.packed.array_hash(state, precision);
117-
match array.patch_indices() {
118-
Some(indices) => {
119-
true.hash(state);
120-
indices.array_hash(state, precision);
121-
}
122-
None => false.hash(state),
123-
}
124-
match array.patch_values() {
125-
Some(values) => {
126-
true.hash(state);
127-
values.array_hash(state, precision);
128-
}
129-
None => false.hash(state),
130-
}
131-
match array.patch_chunk_offsets() {
132-
Some(offsets) => {
133-
true.hash(state);
134-
offsets.array_hash(state, precision);
135-
}
136-
None => false.hash(state),
137-
}
138-
match array.validity_child() {
139-
Some(validity) => {
140-
true.hash(state);
141-
validity.array_hash(state, precision);
142-
}
143-
None => false.hash(state),
144-
}
145-
array.patch_offset.hash(state);
146-
array.patch_offset_within_chunk.hash(state);
109+
fn array_hash<H: std::hash::Hasher>(data: &BitPackedData, state: &mut H, precision: Precision) {
110+
data.offset.hash(state);
111+
data.bit_width.hash(state);
112+
data.packed.array_hash(state, precision);
113+
data.patch_offset.hash(state);
114+
data.patch_offset_within_chunk.hash(state);
147115
}
148116

149-
fn array_eq(
150-
array: ArrayView<'_, Self>,
151-
other: ArrayView<'_, Self>,
152-
precision: Precision,
153-
) -> bool {
154-
array.offset == other.offset
155-
&& array.bit_width == other.bit_width
156-
&& array.packed.array_eq(&other.packed, precision)
157-
&& match (array.patch_indices(), other.patch_indices()) {
158-
(Some(lhs), Some(rhs)) => lhs.array_eq(rhs, precision),
159-
(None, None) => true,
160-
_ => false,
161-
}
162-
&& match (array.patch_values(), other.patch_values()) {
163-
(Some(lhs), Some(rhs)) => lhs.array_eq(rhs, precision),
164-
(None, None) => true,
165-
_ => false,
166-
}
167-
&& match (array.patch_chunk_offsets(), other.patch_chunk_offsets()) {
168-
(Some(lhs), Some(rhs)) => lhs.array_eq(rhs, precision),
169-
(None, None) => true,
170-
_ => false,
171-
}
172-
&& match (array.validity_child(), other.validity_child()) {
173-
(Some(lhs), Some(rhs)) => lhs.array_eq(rhs, precision),
174-
(None, None) => true,
175-
_ => false,
176-
}
177-
&& array.patch_offset == other.patch_offset
178-
&& array.patch_offset_within_chunk == other.patch_offset_within_chunk
117+
fn array_eq(data: &BitPackedData, other: &BitPackedData, precision: Precision) -> bool {
118+
data.offset == other.offset
119+
&& data.bit_width == other.bit_width
120+
&& data.packed.array_eq(&other.packed, precision)
121+
&& data.patch_offset == other.patch_offset
122+
&& data.patch_offset_within_chunk == other.patch_offset_within_chunk
179123
}
180124

181125
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/fastlanes/src/delta/vtable/mod.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,12 @@ impl VTable for Delta {
8181
)
8282
}
8383

84-
fn array_hash<H: std::hash::Hasher>(
85-
array: ArrayView<'_, Self>,
86-
state: &mut H,
87-
precision: Precision,
88-
) {
89-
array.offset().hash(state);
90-
array.bases().array_hash(state, precision);
91-
array.deltas().array_hash(state, precision);
84+
fn array_hash<H: std::hash::Hasher>(data: &DeltaData, state: &mut H, _precision: Precision) {
85+
data.offset.hash(state);
9286
}
9387

94-
fn array_eq(
95-
array: ArrayView<'_, Self>,
96-
other: ArrayView<'_, Self>,
97-
precision: Precision,
98-
) -> bool {
99-
array.offset() == other.offset()
100-
&& array.bases().array_eq(other.bases(), precision)
101-
&& array.deltas().array_eq(other.deltas(), precision)
88+
fn array_eq(data: &DeltaData, other: &DeltaData, _precision: Precision) -> bool {
89+
data.offset == other.offset
10290
}
10391

10492
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/fastlanes/src/for/vtable/mod.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,12 @@ impl VTable for FoR {
6868
FoRData::validate_parts(encoded, &data.reference, dtype, len)
6969
}
7070

71-
fn array_hash<H: std::hash::Hasher>(
72-
array: ArrayView<'_, Self>,
73-
state: &mut H,
74-
precision: Precision,
75-
) {
76-
array.encoded().array_hash(state, precision);
77-
array.reference_scalar().hash(state);
71+
fn array_hash<H: std::hash::Hasher>(data: &FoRData, state: &mut H, _precision: Precision) {
72+
data.reference.hash(state);
7873
}
7974

80-
fn array_eq(
81-
array: ArrayView<'_, Self>,
82-
other: ArrayView<'_, Self>,
83-
precision: Precision,
84-
) -> bool {
85-
array.encoded().array_eq(other.encoded(), precision)
86-
&& array.reference_scalar() == other.reference_scalar()
75+
fn array_eq(data: &FoRData, other: &FoRData, _precision: Precision) -> bool {
76+
data.reference == other.reference
8777
}
8878

8979
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/fastlanes/src/rle/vtable/mod.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,12 @@ impl VTable for RLE {
9292
)
9393
}
9494

95-
fn array_hash<H: std::hash::Hasher>(
96-
array: ArrayView<'_, Self>,
97-
state: &mut H,
98-
precision: Precision,
99-
) {
100-
array.values().array_hash(state, precision);
101-
array.indices().array_hash(state, precision);
102-
array.values_idx_offsets().array_hash(state, precision);
103-
array.offset().hash(state);
95+
fn array_hash<H: std::hash::Hasher>(data: &RLEData, state: &mut H, _precision: Precision) {
96+
data.offset.hash(state);
10497
}
10598

106-
fn array_eq(
107-
array: ArrayView<'_, Self>,
108-
other: ArrayView<'_, Self>,
109-
precision: Precision,
110-
) -> bool {
111-
array.values().array_eq(other.values(), precision)
112-
&& array.indices().array_eq(other.indices(), precision)
113-
&& array
114-
.values_idx_offsets()
115-
.array_eq(other.values_idx_offsets(), precision)
116-
&& array.offset() == other.offset()
99+
fn array_eq(data: &RLEData, other: &RLEData, _precision: Precision) -> bool {
100+
data.offset == other.offset
117101
}
118102

119103
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

encodings/fsst/src/array.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,26 @@ impl VTable for FSST {
8989
data.validate(dtype, len, slots)
9090
}
9191

92-
fn array_hash<H: std::hash::Hasher>(
93-
array: ArrayView<'_, Self>,
94-
state: &mut H,
95-
precision: Precision,
96-
) {
97-
array.symbols.array_hash(state, precision);
98-
array.symbol_lengths.array_hash(state, precision);
99-
array
92+
fn array_hash<H: std::hash::Hasher>(data: &FSSTData, state: &mut H, precision: Precision) {
93+
data.symbols.array_hash(state, precision);
94+
data.symbol_lengths.array_hash(state, precision);
95+
data
10096
.codes
10197
.clone()
10298
.into_array()
10399
.array_hash(state, precision);
104-
array.uncompressed_lengths().array_hash(state, precision);
105100
}
106101

107-
fn array_eq(
108-
array: ArrayView<'_, Self>,
109-
other: ArrayView<'_, Self>,
110-
precision: Precision,
111-
) -> bool {
112-
array.symbols.array_eq(&other.symbols, precision)
113-
&& array
102+
fn array_eq(data: &FSSTData, other: &FSSTData, precision: Precision) -> bool {
103+
data.symbols.array_eq(&other.symbols, precision)
104+
&& data
114105
.symbol_lengths
115106
.array_eq(&other.symbol_lengths, precision)
116-
&& array
107+
&& data
117108
.codes
118109
.clone()
119110
.into_array()
120111
.array_eq(&other.codes.clone().into_array(), precision)
121-
&& array
122-
.uncompressed_lengths()
123-
.array_eq(other.uncompressed_lengths(), precision)
124112
}
125113

126114
fn nbuffers(_array: ArrayView<'_, Self>) -> usize {

0 commit comments

Comments
 (0)