Skip to content

Commit 9604a90

Browse files
committed
rebased
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent f21bf94 commit 9604a90

File tree

294 files changed

+3291
-4189
lines changed

Some content is hidden

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

294 files changed

+3291
-4189
lines changed

encodings/alp/public-api.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn vortex_alp::ALP::buffer(_array: vortex_array::array::view::ArrayView<'_,
4242

4343
pub fn vortex_alp::ALP::buffer_name(_array: vortex_array::array::view::ArrayView<'_, Self>, _idx: usize) -> core::option::Option<alloc::string::String>
4444

45-
pub fn vortex_alp::ALP::build(dtype: &vortex_array::dtype::DType, len: usize, metadata: &Self::Metadata, _buffers: &[vortex_array::buffer::BufferHandle], children: &dyn vortex_array::serde::ArrayChildren) -> vortex_error::VortexResult<vortex_array::array::erased::ArrayRef>
45+
pub fn vortex_alp::ALP::build(dtype: &vortex_array::dtype::DType, len: usize, metadata: &Self::Metadata, _buffers: &[vortex_array::buffer::BufferHandle], children: &dyn vortex_array::serde::ArrayChildren) -> vortex_error::VortexResult<vortex_alp::ALPData>
4646

4747
pub fn vortex_alp::ALP::deserialize(bytes: &[u8], _dtype: &vortex_array::dtype::DType, _len: usize, _buffers: &[vortex_array::buffer::BufferHandle], _session: &vortex_session::VortexSession) -> vortex_error::VortexResult<Self::Metadata>
4848

@@ -212,7 +212,7 @@ pub fn vortex_alp::ALPRD::buffer(_array: vortex_array::array::view::ArrayView<'_
212212

213213
pub fn vortex_alp::ALPRD::buffer_name(_array: vortex_array::array::view::ArrayView<'_, Self>, _idx: usize) -> core::option::Option<alloc::string::String>
214214

215-
pub fn vortex_alp::ALPRD::build(dtype: &vortex_array::dtype::DType, len: usize, metadata: &Self::Metadata, _buffers: &[vortex_array::buffer::BufferHandle], children: &dyn vortex_array::serde::ArrayChildren) -> vortex_error::VortexResult<vortex_array::array::erased::ArrayRef>
215+
pub fn vortex_alp::ALPRD::build(dtype: &vortex_array::dtype::DType, len: usize, metadata: &Self::Metadata, _buffers: &[vortex_array::buffer::BufferHandle], children: &dyn vortex_array::serde::ArrayChildren) -> vortex_error::VortexResult<vortex_alp::ALPRDData>
216216

217217
pub fn vortex_alp::ALPRD::deserialize(bytes: &[u8], _dtype: &vortex_array::dtype::DType, _len: usize, _buffers: &[vortex_array::buffer::BufferHandle], _session: &vortex_session::VortexSession) -> vortex_error::VortexResult<Self::Metadata>
218218

encodings/alp/src/alp/array.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl VTable for ALP {
131131
metadata: &Self::Metadata,
132132
_buffers: &[BufferHandle],
133133
children: &dyn ArrayChildren,
134-
) -> VortexResult<ArrayRef> {
134+
) -> VortexResult<ALPData> {
135135
let encoded_ptype = match &dtype {
136136
DType::Primitive(PType::F32, n) => DType::Primitive(PType::I32, *n),
137137
DType::Primitive(PType::F64, n) => DType::Primitive(PType::I64, *n),
@@ -153,15 +153,14 @@ impl VTable for ALP {
153153
})
154154
.transpose()?;
155155

156-
Ok(ALPData::try_new(
156+
ALPData::try_new(
157157
encoded,
158158
Exponents {
159159
e: u8::try_from(metadata.exp_e)?,
160160
f: u8::try_from(metadata.exp_f)?,
161161
},
162162
patches,
163-
)?
164-
.into_array())
163+
)
165164
}
166165

167166
fn slots(array: ArrayView<'_, Self>) -> &[Option<ArrayRef>] {

encodings/alp/src/alp/compress.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ pub fn alp_encode(parray: &PrimitiveArray, exponents: Option<Exponents>) -> Vort
4747
};
4848

4949
// SAFETY: alp_encode_components_typed must return well-formed components
50-
unsafe { Ok(ALP::new_unchecked(encoded, exponents, patches)) }
50+
unsafe {
51+
Ok(ALP::new_unchecked(
52+
encoded,
53+
exponents,
54+
patches,
55+
parray.dtype().clone(),
56+
))
57+
}
5158
}
5259

5360
#[expect(

encodings/alp/src/alp/compute/between.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl BetweenReduce for ALP {
3838

3939
let nullability =
4040
array.dtype().nullability() | lower.dtype().nullability() | upper.dtype().nullability();
41-
match_each_alp_float_ptype!(array.dtype().as_ptype(), |F| {
41+
match_each_alp_float_ptype!(array.ptype(), |F| {
4242
between_impl::<F>(
4343
array,
4444
F::try_from(&lower)?,

encodings/alp/src/alp/compute/cast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ impl CastReduce for ALP {
4545
// SAFETY: casting nullability doesn't alter the invariants
4646
unsafe {
4747
Ok(Some(
48-
ALP::new_unchecked(new_encoded, array.exponents(), new_patches).into_array(),
48+
ALP::new_unchecked(new_encoded, array.exponents(), new_patches, dtype.clone())
49+
.into_array(),
4950
))
5051
}
5152
} else {

encodings/alp/src/alp/compute/filter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ impl FilterKernel for ALP {
3030
array.encoded().filter(mask.clone())?,
3131
array.exponents(),
3232
patches,
33+
array.dtype().clone(),
3334
)
3435
.into_array(),
3536
))

encodings/alp/src/alp/decompress.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pub fn decompress_into_array(
2727
array: ALPArray,
2828
ctx: &mut ExecutionCtx,
2929
) -> VortexResult<PrimitiveArray> {
30-
let dtype = array.dtype().clone();
31-
let (encoded, exponents, patches) = array.into_data().into_parts();
30+
let (encoded, exponents, patches, dtype) = array.into_data().into_parts();
3231
if let Some(ref patches) = patches
3332
&& let Some(chunk_offsets) = patches.chunk_offsets()
3433
{
@@ -60,8 +59,7 @@ pub fn decompress_into_array(
6059
///
6160
/// A `PrimitiveArray` containing the decompressed floating-point values with all patches applied.
6261
pub fn execute_decompress(array: ALPArray, ctx: &mut ExecutionCtx) -> VortexResult<PrimitiveArray> {
63-
let dtype = array.dtype().clone();
64-
let (encoded, exponents, patches) = array.into_data().into_parts();
62+
let (encoded, exponents, patches, dtype) = array.into_data().into_parts();
6563
if let Some(ref patches) = patches
6664
&& let Some(chunk_offsets) = patches.chunk_offsets()
6765
{

encodings/alp/src/alp/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod rules;
2222

2323
#[cfg(test)]
2424
mod tests {
25-
use prost::Message;
25+
use vortex_array::ProstMetadata;
2626
use vortex_array::dtype::PType;
2727
use vortex_array::patches::PatchesMetadata;
2828
use vortex_array::test_harness::check_metadata;
@@ -34,7 +34,7 @@ mod tests {
3434
fn test_alp_metadata() {
3535
check_metadata(
3636
"alp.metadata",
37-
&ALPMetadata {
37+
ProstMetadata(ALPMetadata {
3838
patches: Some(PatchesMetadata::new(
3939
usize::MAX,
4040
usize::MAX,
@@ -45,8 +45,7 @@ mod tests {
4545
)),
4646
exp_e: u32::MAX,
4747
exp_f: u32::MAX,
48-
}
49-
.encode_to_vec(),
48+
}),
5049
);
5150
}
5251
}

encodings/alp/src/alp/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl OperationsVTable<ALP> for ALP {
2626

2727
let encoded_val = array.encoded().scalar_at(index)?;
2828

29-
Ok(match_each_alp_float_ptype!(array.dtype().as_ptype(), |T| {
29+
Ok(match_each_alp_float_ptype!(array.ptype(), |T| {
3030
let encoded_val: <T as ALPFloat>::ALPInt =
3131
(&encoded_val).try_into().vortex_expect("invalid ALPInt");
3232
Scalar::primitive(

encodings/alp/src/alp_rd/array.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl VTable for ALPRD {
164164
metadata: &Self::Metadata,
165165
_buffers: &[BufferHandle],
166166
children: &dyn ArrayChildren,
167-
) -> VortexResult<ArrayRef> {
167+
) -> VortexResult<ALPRDData> {
168168
if children.len() < 2 {
169169
vortex_bail!(
170170
"Expected at least 2 children for ALPRD encoding, found {}",
@@ -212,7 +212,7 @@ impl VTable for ALPRD {
212212
})
213213
.transpose()?;
214214

215-
Ok(ALPRDData::try_new(
215+
ALPRDData::try_new(
216216
dtype.clone(),
217217
left_parts,
218218
left_parts_dictionary,
@@ -224,8 +224,7 @@ impl VTable for ALPRD {
224224
)
225225
})?,
226226
left_parts_patches,
227-
)?
228-
.into_array())
227+
)
229228
}
230229

231230
fn slots(array: ArrayView<'_, Self>) -> &[Option<ArrayRef>] {

0 commit comments

Comments
 (0)