Skip to content

Commit 9c707b9

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

7 files changed

Lines changed: 12 additions & 66 deletions

File tree

encodings/alp/src/alp/array.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,7 @@ impl ALPData {
432432
///
433433
/// See [`ALPData::try_new`] for information about the preconditions that should be checked
434434
/// **before** calling this method.
435-
pub(crate) unsafe fn new_unchecked(
436-
_encoded: ArrayRef,
437-
exponents: Exponents,
438-
patches: Option<Patches>,
439-
) -> Self {
435+
pub(crate) unsafe fn new_unchecked(exponents: Exponents, patches: Option<Patches>) -> Self {
440436
let (patch_offset, patch_offset_within_chunk) = match &patches {
441437
Some(p) => (Some(p.offset()), p.offset_within_chunk()),
442438
None => (None, None),
@@ -488,7 +484,7 @@ impl ALP {
488484
let dtype = ALPData::logical_dtype(&encoded).vortex_expect("ALP encoded dtype");
489485
let len = encoded.len();
490486
let slots = ALPData::make_slots(&encoded, &patches);
491-
let data = unsafe { ALPData::new_unchecked(encoded, exponents, patches) };
487+
let data = unsafe { ALPData::new_unchecked(exponents, patches) };
492488
unsafe {
493489
Array::from_parts_unchecked(ArrayParts::new(ALP, dtype, len, data).with_slots(slots))
494490
}

encodings/alp/src/alp_rd/array.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -373,22 +373,12 @@ impl ALPRD {
373373
left_parts_patches: Option<Patches>,
374374
) -> ALPRDArray {
375375
let len = left_parts.len();
376-
let logical_dtype = dtype.clone();
377376
let slots = ALPRDData::make_slots(&left_parts, &right_parts, &left_parts_patches);
378377
let data = unsafe {
379-
ALPRDData::new_unchecked(
380-
dtype,
381-
left_parts,
382-
left_parts_dictionary,
383-
right_parts,
384-
right_bit_width,
385-
left_parts_patches,
386-
)
378+
ALPRDData::new_unchecked(left_parts_dictionary, right_bit_width, left_parts_patches)
387379
};
388380
unsafe {
389-
Array::from_parts_unchecked(
390-
ArrayParts::new(ALPRD, logical_dtype, len, data).with_slots(slots),
391-
)
381+
Array::from_parts_unchecked(ArrayParts::new(ALPRD, dtype, len, data).with_slots(slots))
392382
}
393383
}
394384
}
@@ -535,10 +525,7 @@ impl ALPRDData {
535525
/// Build a new `ALPRDArray` from components. This does not perform any validation, and instead
536526
/// it constructs it from parts.
537527
pub(crate) unsafe fn new_unchecked(
538-
_dtype: DType,
539-
_left_parts: ArrayRef,
540528
left_parts_dictionary: Buffer<u16>,
541-
_right_parts: ArrayRef,
542529
right_bit_width: u8,
543530
left_parts_patches: Option<Patches>,
544531
) -> Self {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl DeltaData {
9797
Self::validate_parts(&bases, &deltas, offset, len)?;
9898

9999
// SAFETY: validation done above
100-
Ok(unsafe { Self::new_unchecked(bases, deltas, offset) })
100+
Ok(unsafe { Self::new_unchecked(offset) })
101101
}
102102

103103
pub(crate) fn validate_against_slots(
@@ -156,7 +156,7 @@ impl DeltaData {
156156
Ok(())
157157
}
158158

159-
pub(crate) unsafe fn new_unchecked(_bases: ArrayRef, _deltas: ArrayRef, offset: usize) -> Self {
159+
pub(crate) unsafe fn new_unchecked(offset: usize) -> Self {
160160
Self { offset }
161161
}
162162
}

vortex-array/public-api.lock

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,10 +1082,6 @@ pub struct vortex_array::arrays::chunked::ChunkedData
10821082

10831083
impl vortex_array::arrays::chunked::ChunkedData
10841084

1085-
pub unsafe fn vortex_array::arrays::chunked::ChunkedData::new_unchecked(_chunks: alloc::vec::Vec<vortex_array::ArrayRef>, _dtype: vortex_array::dtype::DType) -> Self
1086-
1087-
pub fn vortex_array::arrays::chunked::ChunkedData::try_new(chunks: alloc::vec::Vec<vortex_array::ArrayRef>, dtype: vortex_array::dtype::DType) -> vortex_error::VortexResult<Self>
1088-
10891085
pub fn vortex_array::arrays::chunked::ChunkedData::validate(chunks: &[vortex_array::ArrayRef], dtype: &vortex_array::dtype::DType) -> vortex_error::VortexResult<()>
10901086

10911087
impl core::clone::Clone for vortex_array::arrays::chunked::ChunkedData
@@ -1760,7 +1756,7 @@ impl vortex_array::arrays::dict::DictData
17601756

17611757
pub fn vortex_array::arrays::dict::DictData::new(codes: vortex_array::ArrayRef, values: vortex_array::ArrayRef) -> Self
17621758

1763-
pub unsafe fn vortex_array::arrays::dict::DictData::new_unchecked(_codes: vortex_array::ArrayRef, _values: vortex_array::ArrayRef) -> Self
1759+
pub unsafe fn vortex_array::arrays::dict::DictData::new_unchecked() -> Self
17641760

17651761
pub unsafe fn vortex_array::arrays::dict::DictData::set_all_values_referenced(self, all_values_referenced: bool) -> Self
17661762

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

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -198,34 +198,6 @@ impl ChunkedData {
198198
slots
199199
}
200200

201-
/// Constructs a new `ChunkedArray`.
202-
///
203-
/// See `ChunkedArray::new_unchecked` for more information.
204-
///
205-
/// # Errors
206-
///
207-
/// Returns an error if the provided components do not satisfy the invariants documented in
208-
/// `ChunkedArray::new_unchecked`.
209-
pub fn try_new(chunks: Vec<ArrayRef>, dtype: DType) -> VortexResult<Self> {
210-
Self::validate(&chunks, &dtype)?;
211-
Ok(Self)
212-
}
213-
214-
/// Creates a new `ChunkedArray` without validation from these components:
215-
///
216-
/// * `chunks` is a vector of arrays to be concatenated logically.
217-
/// * `dtype` is the common data type of all chunks.
218-
///
219-
/// # Safety
220-
///
221-
/// All chunks must have exactly the same [`DType`] as the provided `dtype`.
222-
pub unsafe fn new_unchecked(_chunks: Vec<ArrayRef>, _dtype: DType) -> Self {
223-
#[cfg(debug_assertions)]
224-
Self::validate(&_chunks, &_dtype)
225-
.vortex_expect("[Debug Assertion]: Invalid `ChunkedArray` parameters");
226-
Self
227-
}
228-
229201
/// Validates the components that would be used to create a `ChunkedArray`.
230202
///
231203
/// This function checks all the invariants required by `ChunkedArray::new_unchecked`.
@@ -302,10 +274,6 @@ impl Array<Chunked> {
302274
}
303275

304276
/// Creates a new `ChunkedArray` without validation.
305-
///
306-
/// # Safety
307-
///
308-
/// See [`ChunkedData::new_unchecked`].
309277
pub unsafe fn new_unchecked(chunks: Vec<ArrayRef>, dtype: DType) -> Self {
310278
let len = chunks.iter().map(|chunk| chunk.len()).sum();
311279
unsafe {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl DictData {
5858
/// This should be called only when you can guarantee the invariants checked
5959
/// by the safe `DictArray::try_new` constructor are valid, for example when
6060
/// you are filtering or slicing an existing valid `DictArray`.
61-
pub unsafe fn new_unchecked(_codes: ArrayRef, _values: ArrayRef) -> Self {
61+
pub unsafe fn new_unchecked() -> Self {
6262
Self {
6363
all_values_referenced: false,
6464
}
@@ -97,12 +97,12 @@ impl DictData {
9797
/// of the `values` array. Otherwise, this constructor returns an error.
9898
///
9999
/// It is an error to provide a nullable `codes` with non-nullable `values`.
100-
pub(crate) fn try_new(codes: ArrayRef, values: ArrayRef) -> VortexResult<Self> {
100+
pub(crate) fn try_new(codes: ArrayRef, _values: ArrayRef) -> VortexResult<Self> {
101101
if !codes.dtype().is_int() {
102102
vortex_bail!(MismatchedTypes: "int", codes.dtype());
103103
}
104104

105-
Ok(unsafe { Self::new_unchecked(codes, values) })
105+
Ok(unsafe { Self::new_unchecked() })
106106
}
107107
}
108108

@@ -249,7 +249,7 @@ impl Array<Dict> {
249249
.dtype()
250250
.union_nullability(codes.dtype().nullability());
251251
let len = codes.len();
252-
let data = unsafe { DictData::new_unchecked(codes.clone(), values.clone()) };
252+
let data = unsafe { DictData::new_unchecked() };
253253
unsafe {
254254
Array::from_parts_unchecked(
255255
ArrayParts::new(Dict, dtype, len, data).with_slots(vec![Some(codes), Some(values)]),

vortex-array/src/arrays/dict/vtable/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ impl VTable for Dict {
159159

160160
Ok(
161161
crate::array::ArrayParts::new(self.clone(), dtype.clone(), len, unsafe {
162-
DictData::new_unchecked(codes.clone(), values.clone())
163-
.set_all_values_referenced(all_values_referenced)
162+
DictData::new_unchecked().set_all_values_referenced(all_values_referenced)
164163
})
165164
.with_slots(vec![Some(codes), Some(values)]),
166165
)

0 commit comments

Comments
 (0)