Skip to content

Commit e06d80b

Browse files
authored
Rename ArrayEq/Hash Precision to EqMode (#8214)
## Summary This PR renames the `Precision` enum that we use to do array hashing and equality checks to `Accuracy`, as we already have a `Precision` enum we use for stats, that is also part of the binary format. ## API Changes Just the renamed enum, which should be relatively minor. ## Testing N/A --------- Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 71e8d12 commit e06d80b

47 files changed

Lines changed: 236 additions & 239 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use vortex_array::ArrayParts;
1616
use vortex_array::ArrayRef;
1717
use vortex_array::ArraySlots;
1818
use vortex_array::ArrayView;
19+
use vortex_array::EqMode;
1920
use vortex_array::ExecutionCtx;
2021
use vortex_array::ExecutionResult;
2122
use vortex_array::IntoArray;
22-
use vortex_array::Precision;
2323
use vortex_array::TypedArrayRef;
2424
use vortex_array::array_slots;
2525
use vortex_array::arrays::Primitive;
@@ -55,14 +55,14 @@ use crate::alp::rules::RULES;
5555
pub type ALPArray = Array<ALP>;
5656

5757
impl ArrayHash for ALPData {
58-
fn array_hash<H: Hasher>(&self, state: &mut H, _precision: Precision) {
58+
fn array_hash<H: Hasher>(&self, state: &mut H, _accuracy: EqMode) {
5959
self.exponents.hash(state);
6060
self.patches_data.hash(state);
6161
}
6262
}
6363

6464
impl ArrayEq for ALPData {
65-
fn array_eq(&self, other: &Self, _precision: Precision) -> bool {
65+
fn array_eq(&self, other: &Self, _accuracy: EqMode) -> bool {
6666
self.exponents == other.exponents && self.patches_data == other.patches_data
6767
}
6868
}

encodings/alp/src/alp_rd/array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ use vortex_array::ArrayRef;
1818
use vortex_array::ArraySlots;
1919
use vortex_array::ArrayView;
2020
use vortex_array::Canonical;
21+
use vortex_array::EqMode;
2122
use vortex_array::ExecutionCtx;
2223
use vortex_array::ExecutionResult;
2324
use vortex_array::IntoArray;
2425
use vortex_array::LEGACY_SESSION;
25-
use vortex_array::Precision;
2626
use vortex_array::TypedArrayRef;
2727
use vortex_array::VortexSessionExecute;
2828
use vortex_array::arrays::Primitive;
@@ -75,17 +75,17 @@ pub struct ALPRDMetadata {
7575
}
7676

7777
impl ArrayHash for ALPRDData {
78-
fn array_hash<H: Hasher>(&self, state: &mut H, precision: Precision) {
79-
self.left_parts_dictionary.array_hash(state, precision);
78+
fn array_hash<H: Hasher>(&self, state: &mut H, accuracy: EqMode) {
79+
self.left_parts_dictionary.array_hash(state, accuracy);
8080
self.right_bit_width.hash(state);
8181
self.patches_data.hash(state);
8282
}
8383
}
8484

8585
impl ArrayEq for ALPRDData {
86-
fn array_eq(&self, other: &Self, precision: Precision) -> bool {
86+
fn array_eq(&self, other: &Self, accuracy: EqMode) -> bool {
8787
self.left_parts_dictionary
88-
.array_eq(&other.left_parts_dictionary, precision)
88+
.array_eq(&other.left_parts_dictionary, accuracy)
8989
&& self.right_bit_width == other.right_bit_width
9090
&& self.patches_data == other.patches_data
9191
}

encodings/bytebool/src/array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ use vortex_array::ArrayParts;
1414
use vortex_array::ArrayRef;
1515
use vortex_array::ArraySlots;
1616
use vortex_array::ArrayView;
17+
use vortex_array::EqMode;
1718
use vortex_array::ExecutionCtx;
1819
use vortex_array::ExecutionResult;
1920
use vortex_array::IntoArray;
20-
use vortex_array::Precision;
2121
use vortex_array::TypedArrayRef;
2222
use vortex_array::arrays::BoolArray;
2323
use vortex_array::buffer::BufferHandle;
@@ -45,14 +45,14 @@ use crate::kernel::PARENT_KERNELS;
4545
pub type ByteBoolArray = Array<ByteBool>;
4646

4747
impl ArrayHash for ByteBoolData {
48-
fn array_hash<H: Hasher>(&self, state: &mut H, precision: Precision) {
49-
self.buffer.array_hash(state, precision);
48+
fn array_hash<H: Hasher>(&self, state: &mut H, accuracy: EqMode) {
49+
self.buffer.array_hash(state, accuracy);
5050
}
5151
}
5252

5353
impl ArrayEq for ByteBoolData {
54-
fn array_eq(&self, other: &Self, precision: Precision) -> bool {
55-
self.buffer.array_eq(&other.buffer, precision)
54+
fn array_eq(&self, other: &Self, accuracy: EqMode) -> bool {
55+
self.buffer.array_eq(&other.buffer, accuracy)
5656
}
5757
}
5858

encodings/datetime-parts/src/array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use vortex_array::ArrayId;
1515
use vortex_array::ArrayParts;
1616
use vortex_array::ArrayRef;
1717
use vortex_array::ArrayView;
18+
use vortex_array::EqMode;
1819
use vortex_array::ExecutionCtx;
1920
use vortex_array::ExecutionResult;
2021
use vortex_array::IntoArray;
21-
use vortex_array::Precision;
2222
use vortex_array::array_slots;
2323
use vortex_array::arrays::Primitive;
2424
use vortex_array::arrays::TemporalArray;
@@ -50,11 +50,11 @@ use crate::split_temporal;
5050
pub type DateTimePartsArray = Array<DateTimeParts>;
5151

5252
impl ArrayHash for DateTimePartsData {
53-
fn array_hash<H: Hasher>(&self, _state: &mut H, _precision: Precision) {}
53+
fn array_hash<H: Hasher>(&self, _state: &mut H, _accuracy: EqMode) {}
5454
}
5555

5656
impl ArrayEq for DateTimePartsData {
57-
fn array_eq(&self, _other: &Self, _precision: Precision) -> bool {
57+
fn array_eq(&self, _other: &Self, _accuracy: EqMode) -> bool {
5858
true
5959
}
6060
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ use vortex_array::ArrayEq;
1717
use vortex_array::ArrayHash;
1818
use vortex_array::ArrayId;
1919
use vortex_array::ArrayRef;
20+
use vortex_array::EqMode;
2021
use vortex_array::ExecutionCtx;
2122
use vortex_array::ExecutionResult;
2223
use vortex_array::IntoArray;
23-
use vortex_array::Precision;
2424
use vortex_array::TypedArrayRef;
2525
use vortex_array::arrays::DecimalArray;
2626
use vortex_array::arrays::PrimitiveArray;
@@ -53,11 +53,11 @@ use crate::decimal_byte_parts::rules::PARENT_RULES;
5353
pub type DecimalBytePartsArray = Array<DecimalByteParts>;
5454

5555
impl ArrayHash for DecimalBytePartsData {
56-
fn array_hash<H: Hasher>(&self, _state: &mut H, _precision: Precision) {}
56+
fn array_hash<H: Hasher>(&self, _state: &mut H, _accuracy: EqMode) {}
5757
}
5858

5959
impl ArrayEq for DecimalBytePartsData {
60-
fn array_eq(&self, _other: &Self, _precision: Precision) -> bool {
60+
fn array_eq(&self, _other: &Self, _accuracy: EqMode) -> bool {
6161
true
6262
}
6363
}

encodings/experimental/onpair/src/array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use vortex_array::ArrayParts;
1515
use vortex_array::ArrayRef;
1616
use vortex_array::ArrayView;
1717
use vortex_array::Canonical;
18+
use vortex_array::EqMode;
1819
use vortex_array::ExecutionCtx;
1920
use vortex_array::ExecutionResult;
2021
use vortex_array::IntoArray;
21-
use vortex_array::Precision;
2222
use vortex_array::array_slots;
2323
use vortex_array::buffer::BufferHandle;
2424
use vortex_array::builders::ArrayBuilder;
@@ -196,19 +196,19 @@ impl Debug for OnPairData {
196196
}
197197

198198
impl ArrayHash for OnPairData {
199-
fn array_hash<H: Hasher>(&self, state: &mut H, precision: Precision) {
200-
self.dict_bytes.as_host().array_hash(state, precision);
199+
fn array_hash<H: Hasher>(&self, state: &mut H, accuracy: EqMode) {
200+
self.dict_bytes.as_host().array_hash(state, accuracy);
201201
state.write_u32(self.bits);
202202
}
203203
}
204204

205205
impl ArrayEq for OnPairData {
206-
fn array_eq(&self, other: &Self, precision: Precision) -> bool {
206+
fn array_eq(&self, other: &Self, accuracy: EqMode) -> bool {
207207
self.bits == other.bits
208208
&& self
209209
.dict_bytes
210210
.as_host()
211-
.array_eq(other.dict_bytes.as_host(), precision)
211+
.array_eq(other.dict_bytes.as_host(), accuracy)
212212
}
213213
}
214214

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ use vortex_array::ArrayParts;
1313
use vortex_array::ArrayRef;
1414
use vortex_array::ArraySlots;
1515
use vortex_array::ArrayView;
16+
use vortex_array::EqMode;
1617
use vortex_array::ExecutionCtx;
1718
use vortex_array::ExecutionResult;
1819
use vortex_array::IntoArray;
19-
use vortex_array::Precision;
2020
use vortex_array::buffer::BufferHandle;
2121
use vortex_array::builders::ArrayBuilder;
2222
use vortex_array::dtype::DType;
@@ -69,19 +69,19 @@ pub struct BitPackedMetadata {
6969
}
7070

7171
impl ArrayHash for BitPackedData {
72-
fn array_hash<H: Hasher>(&self, state: &mut H, precision: Precision) {
72+
fn array_hash<H: Hasher>(&self, state: &mut H, accuracy: EqMode) {
7373
self.offset.hash(state);
7474
self.bit_width.hash(state);
75-
self.packed.array_hash(state, precision);
75+
self.packed.array_hash(state, accuracy);
7676
self.patches_data.hash(state);
7777
}
7878
}
7979

8080
impl ArrayEq for BitPackedData {
81-
fn array_eq(&self, other: &Self, precision: Precision) -> bool {
81+
fn array_eq(&self, other: &Self, accuracy: EqMode) -> bool {
8282
self.offset == other.offset
8383
&& self.bit_width == other.bit_width
84-
&& self.packed.array_eq(&other.packed, precision)
84+
&& self.packed.array_eq(&other.packed, accuracy)
8585
&& self.patches_data == other.patches_data
8686
}
8787
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use vortex_array::ArrayId;
1212
use vortex_array::ArrayParts;
1313
use vortex_array::ArrayRef;
1414
use vortex_array::ArrayView;
15+
use vortex_array::EqMode;
1516
use vortex_array::ExecutionCtx;
1617
use vortex_array::ExecutionResult;
1718
use vortex_array::IntoArray;
18-
use vortex_array::Precision;
1919
use vortex_array::arrays::PrimitiveArray;
2020
use vortex_array::buffer::BufferHandle;
2121
use vortex_array::dtype::DType;
@@ -58,13 +58,13 @@ pub struct DeltaMetadata {
5858
}
5959

6060
impl ArrayHash for DeltaData {
61-
fn array_hash<H: Hasher>(&self, state: &mut H, _precision: Precision) {
61+
fn array_hash<H: Hasher>(&self, state: &mut H, _accuracy: EqMode) {
6262
self.offset.hash(state);
6363
}
6464
}
6565

6666
impl ArrayEq for DeltaData {
67-
fn array_eq(&self, other: &Self, _precision: Precision) -> bool {
67+
fn array_eq(&self, other: &Self, _accuracy: EqMode) -> bool {
6868
self.offset == other.offset
6969
}
7070
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use vortex_array::ArrayId;
1212
use vortex_array::ArrayParts;
1313
use vortex_array::ArrayRef;
1414
use vortex_array::ArrayView;
15+
use vortex_array::EqMode;
1516
use vortex_array::ExecutionCtx;
1617
use vortex_array::ExecutionResult;
1718
use vortex_array::IntoArray;
18-
use vortex_array::Precision;
1919
use vortex_array::arrays::PrimitiveArray;
2020
use vortex_array::buffer::BufferHandle;
2121
use vortex_array::dtype::DType;
@@ -50,13 +50,13 @@ mod validity;
5050
pub type FoRArray = Array<FoR>;
5151

5252
impl ArrayHash for FoRData {
53-
fn array_hash<H: Hasher>(&self, state: &mut H, _precision: Precision) {
53+
fn array_hash<H: Hasher>(&self, state: &mut H, _accuracy: EqMode) {
5454
self.reference.hash(state);
5555
}
5656
}
5757

5858
impl ArrayEq for FoRData {
59-
fn array_eq(&self, other: &Self, _precision: Precision) -> bool {
59+
fn array_eq(&self, other: &Self, _accuracy: EqMode) -> bool {
6060
self.reference == other.reference
6161
}
6262
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use vortex_array::ArrayId;
1212
use vortex_array::ArrayParts;
1313
use vortex_array::ArrayRef;
1414
use vortex_array::ArrayView;
15+
use vortex_array::EqMode;
1516
use vortex_array::ExecutionCtx;
1617
use vortex_array::ExecutionResult;
1718
use vortex_array::IntoArray;
18-
use vortex_array::Precision;
1919
use vortex_array::arrays::Primitive;
2020
use vortex_array::buffer::BufferHandle;
2121
use vortex_array::dtype::DType;
@@ -65,13 +65,13 @@ pub struct RLEMetadata {
6565
}
6666

6767
impl ArrayHash for RLEData {
68-
fn array_hash<H: Hasher>(&self, state: &mut H, _precision: Precision) {
68+
fn array_hash<H: Hasher>(&self, state: &mut H, _accuracy: EqMode) {
6969
self.offset.hash(state);
7070
}
7171
}
7272

7373
impl ArrayEq for RLEData {
74-
fn array_eq(&self, other: &Self, _precision: Precision) -> bool {
74+
fn array_eq(&self, other: &Self, _accuracy: EqMode) -> bool {
7575
self.offset == other.offset
7676
}
7777
}

0 commit comments

Comments
 (0)