Skip to content

Commit 9eeca48

Browse files
authored
Move and rename DecimalType (#5120)
Oof. Moving this type from vortex-scalar to vortex-dtype so we can use it in vortex-vector 😢 --------- Signed-off-by: Nicholas Gates <[email protected]>
1 parent a0808e7 commit 9eeca48

File tree

42 files changed

+435
-427
lines changed

Some content is hidden

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

42 files changed

+435
-427
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

encodings/decimal-byte-parts/src/decimal_byte_parts/compute/compare.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use num_traits::NumCast;
66
use vortex_array::arrays::ConstantArray;
77
use vortex_array::compute::{CompareKernel, CompareKernelAdapter, Operator, compare};
88
use vortex_array::{Array, ArrayRef, register_kernel};
9-
use vortex_dtype::{IntegerPType, Nullability, PType, match_each_integer_ptype};
9+
use vortex_dtype::{IntegerPType, Nullability, PType, ToI256, match_each_integer_ptype};
1010
use vortex_error::{VortexExpect, VortexResult};
11-
use vortex_scalar::{DecimalValue, Scalar, ScalarValue, ToI256, match_each_decimal_value};
11+
use vortex_scalar::{DecimalValue, Scalar, ScalarValue, match_each_decimal_value};
1212

1313
use crate::DecimalBytePartsVTable;
1414
use crate::decimal_byte_parts::compute::compare::Sign::Positive;

encodings/sparse/src/canonical.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ use vortex_array::vtable::{CanonicalVTable, ValidityHelper};
1919
use vortex_array::{Array, Canonical, ToCanonical};
2020
use vortex_buffer::{BitBuffer, Buffer, BufferString, ByteBuffer, buffer, buffer_mut};
2121
use vortex_dtype::{
22-
DType, DecimalDType, IntegerPType, NativePType, Nullability, StructFields,
22+
DType, DecimalDType, IntegerPType, NativeDecimalType, NativePType, Nullability, StructFields,
2323
match_each_integer_ptype, match_each_native_ptype,
2424
};
2525
use vortex_error::{VortexError, VortexExpect, vortex_panic};
2626
use vortex_scalar::{
27-
DecimalScalar, ListScalar, NativeDecimalType, Scalar, StructScalar,
28-
match_each_decimal_value_type,
27+
DecimalScalar, ListScalar, Scalar, StructScalar, match_each_decimal_value_type,
2928
};
3029

3130
use crate::{SparseArray, SparseVTable};

fuzz/src/array/compare.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use vortex_array::compute::{Operator, scalar_cmp};
1010
use vortex_array::validity::Validity;
1111
use vortex_array::{Array, ArrayRef, IntoArray, ToCanonical};
1212
use vortex_buffer::BitBuffer;
13-
use vortex_dtype::{DType, NativePType, match_each_native_ptype};
13+
use vortex_dtype::{DType, NativeDecimalType, NativePType, match_each_native_ptype};
1414
use vortex_error::{VortexExpect, VortexResult, vortex_err};
15-
use vortex_scalar::{NativeDecimalType, Scalar, match_each_decimal_value_type};
15+
use vortex_scalar::{Scalar, match_each_decimal_value_type};
1616

1717
pub fn compare_canonical_array(
1818
array: &dyn Array,

fuzz/src/array/take.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ use vortex_array::builders::builder_with_capacity;
77
use vortex_array::validity::Validity;
88
use vortex_array::{Array, ArrayRef, IntoArray, ToCanonical};
99
use vortex_buffer::Buffer;
10-
use vortex_dtype::{DType, DecimalDType, NativePType, Nullability, match_each_native_ptype};
10+
use vortex_dtype::{
11+
DType, DecimalDType, NativeDecimalType, NativePType, Nullability, match_each_native_ptype,
12+
};
1113
use vortex_error::VortexResult;
12-
use vortex_scalar::{NativeDecimalType, match_each_decimal_value_type};
14+
use vortex_scalar::match_each_decimal_value_type;
1315

1416
pub fn take_canonical_array_non_nullable_indices(
1517
array: &dyn Array,

vortex-array/src/arrays/chunked/compute/sum.rs

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

44
use num_traits::PrimInt;
55
use vortex_dtype::Nullability::Nullable;
6-
use vortex_dtype::{DType, DecimalDType, NativePType, match_each_native_ptype};
6+
use vortex_dtype::{DType, DecimalDType, NativePType, i256, match_each_native_ptype};
77
use vortex_error::{VortexResult, vortex_bail, vortex_err};
8-
use vortex_scalar::{DecimalScalar, DecimalValue, FromPrimitiveOrF16, Scalar, i256};
8+
use vortex_scalar::{DecimalScalar, DecimalValue, FromPrimitiveOrF16, Scalar};
99

1010
use crate::arrays::{ChunkedArray, ChunkedVTable};
1111
use crate::compute::{SumKernel, SumKernelAdapter, sum};

vortex-array/src/arrays/constant/compute/sum.rs

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

44
use num_traits::{CheckedMul, ToPrimitive};
5-
use vortex_dtype::{DType, DecimalDType, NativePType, Nullability, match_each_native_ptype};
5+
use vortex_dtype::{DType, DecimalDType, NativePType, Nullability, i256, match_each_native_ptype};
66
use vortex_error::{VortexExpect, VortexResult, vortex_bail, vortex_err};
77
use vortex_scalar::{
8-
DecimalScalar, DecimalValue, FromPrimitiveOrF16, PrimitiveScalar, Scalar, ScalarValue, i256,
8+
DecimalScalar, DecimalValue, FromPrimitiveOrF16, PrimitiveScalar, Scalar, ScalarValue,
99
};
1010

1111
use crate::arrays::{ConstantArray, ConstantVTable};

vortex-array/src/arrays/decimal/array.rs

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

44
use itertools::Itertools;
55
use vortex_buffer::{BitBufferMut, Buffer, BufferMut, ByteBuffer};
6-
use vortex_dtype::{DType, DecimalDType, IntegerPType, match_each_integer_ptype};
6+
use vortex_dtype::{
7+
BigCast, DType, DecimalDType, DecimalType, IntegerPType, NativeDecimalType,
8+
match_each_integer_ptype,
9+
};
710
use vortex_error::{VortexExpect, VortexResult, vortex_ensure, vortex_panic};
8-
use vortex_scalar::{BigCast, DecimalValueType, NativeDecimalType, match_each_decimal_value_type};
11+
use vortex_scalar::match_each_decimal_value_type;
912

1013
use crate::ToCanonical;
1114
use crate::arrays::is_compatible_decimal_value_type;
@@ -51,7 +54,7 @@ use crate::vtable::ValidityHelper;
5154
/// ## Valid Scalar Types
5255
///
5356
/// The underlying storage uses these native types based on precision:
54-
/// - `DecimalValueType::I8`, `I16`, `I32`, `I64`, `I128`, `I256`
57+
/// - `DecimalType::I8`, `I16`, `I32`, `I64`, `I128`, `I256`
5558
/// - Type selection is automatic based on the required precision
5659
///
5760
/// # Examples
@@ -75,7 +78,7 @@ use crate::vtable::ValidityHelper;
7578
pub struct DecimalArray {
7679
pub(super) dtype: DType,
7780
pub(super) values: ByteBuffer,
78-
pub(super) values_type: DecimalValueType,
81+
pub(super) values_type: DecimalType,
7982
pub(super) validity: Validity,
8083
pub(super) stats_set: ArrayStats,
8184
}
@@ -139,7 +142,7 @@ impl DecimalArray {
139142

140143
Self {
141144
values: buffer.into_byte_buffer(),
142-
values_type: T::VALUES_TYPE,
145+
values_type: T::DECIMAL_TYPE,
143146
dtype: DType::Decimal(decimal_dtype, validity.nullability()),
144147
validity,
145148
stats_set: Default::default(),
@@ -171,10 +174,10 @@ impl DecimalArray {
171174
}
172175

173176
pub fn buffer<T: NativeDecimalType>(&self) -> Buffer<T> {
174-
if self.values_type != T::VALUES_TYPE {
177+
if self.values_type != T::DECIMAL_TYPE {
175178
vortex_panic!(
176179
"Cannot extract Buffer<{:?}> for DecimalArray with values_type {:?}",
177-
T::VALUES_TYPE,
180+
T::DECIMAL_TYPE,
178181
self.values_type,
179182
);
180183
}
@@ -190,7 +193,7 @@ impl DecimalArray {
190193
}
191194
}
192195

193-
pub fn values_type(&self) -> DecimalValueType {
196+
pub fn values_type(&self) -> DecimalType {
194197
self.values_type
195198
}
196199

@@ -276,10 +279,10 @@ where
276279
PatchDVT: NativeDecimalType,
277280
ValuesDVT: NativeDecimalType,
278281
{
279-
if !is_compatible_decimal_value_type(ValuesDVT::VALUES_TYPE, decimal_dtype) {
282+
if !is_compatible_decimal_value_type(ValuesDVT::DECIMAL_TYPE, decimal_dtype) {
280283
vortex_panic!(
281284
"patch_typed: {:?} cannot represent every value in {}.",
282-
ValuesDVT::VALUES_TYPE,
285+
ValuesDVT::DECIMAL_TYPE,
283286
decimal_dtype
284287
)
285288
}

vortex-array/src/arrays/decimal/compute/between.rs

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

44
use vortex_buffer::BitBuffer;
5-
use vortex_dtype::Nullability;
5+
use vortex_dtype::{NativeDecimalType, Nullability};
66
use vortex_error::{VortexResult, vortex_bail};
7-
use vortex_scalar::{NativeDecimalType, Scalar, match_each_decimal_value_type};
7+
use vortex_scalar::{Scalar, match_each_decimal_value_type};
88

99
use crate::arrays::{BoolArray, DecimalArray, DecimalVTable};
1010
use crate::compute::{BetweenKernel, BetweenKernelAdapter, BetweenOptions, StrictComparison};
@@ -51,7 +51,7 @@ fn between_unpack<T: NativeDecimalType>(
5151
else {
5252
vortex_bail!(
5353
"invalid lower bound Scalar: {lower}, expected {:?}",
54-
T::VALUES_TYPE
54+
T::DECIMAL_TYPE
5555
)
5656
};
5757
let Some(upper_value) = upper
@@ -61,7 +61,7 @@ fn between_unpack<T: NativeDecimalType>(
6161
else {
6262
vortex_bail!(
6363
"invalid upper bound Scalar: {upper}, expected {:?}",
64-
T::VALUES_TYPE
64+
T::DECIMAL_TYPE
6565
)
6666
};
6767

vortex-array/src/arrays/decimal/compute/is_sorted.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use itertools::Itertools;
5+
use vortex_dtype::NativeDecimalType;
56
use vortex_error::VortexResult;
67
use vortex_mask::Mask;
7-
use vortex_scalar::{NativeDecimalType, match_each_decimal_value_type};
8+
use vortex_scalar::match_each_decimal_value_type;
89

910
use crate::arrays::{DecimalArray, DecimalVTable};
1011
use crate::compute::{IsSortedIteratorExt, IsSortedKernel, IsSortedKernelAdapter};

0 commit comments

Comments
 (0)