Skip to content
7 changes: 4 additions & 3 deletions encodings/alp/src/alp/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::TypedArrayRef;
use vortex_array::array_slots;
Expand Down Expand Up @@ -183,7 +184,7 @@ impl VTable for ALP {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
RULES.evaluate(array, parent, child_idx)
Expand Down Expand Up @@ -421,8 +422,8 @@ pub trait ALPArrayExt: ALPArraySlotsExt {
fn patches(&self) -> Option<Patches> {
PatchesData::patches_from_slots(
self.patches_data.as_ref(),
self.as_ref().len(),
self.as_ref().slots(),
self.len(),
self.slots(),
PATCH_SLOTS,
)
}
Expand Down
13 changes: 5 additions & 8 deletions encodings/alp/src/alp_rd/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::TypedArrayRef;
use vortex_array::VortexSessionExecute;
Expand Down Expand Up @@ -302,7 +303,7 @@ impl VTable for ALPRD {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
RULES.evaluate(array, parent, child_idx)
Expand Down Expand Up @@ -578,23 +579,19 @@ fn validate_parts(

pub trait ALPRDArrayExt: TypedArrayRef<ALPRD> {
fn left_parts(&self) -> &ArrayRef {
left_parts_from_slots(self.as_ref().slots())
left_parts_from_slots(self.slots())
}

fn right_parts(&self) -> &ArrayRef {
right_parts_from_slots(self.as_ref().slots())
right_parts_from_slots(self.slots())
}

fn right_bit_width(&self) -> u8 {
ALPRDData::right_bit_width(self)
}

fn left_parts_patches(&self) -> Option<Patches> {
patches_from_slots(
self.as_ref().slots(),
self.patches_data.as_ref(),
self.as_ref().len(),
)
patches_from_slots(self.slots(), self.patches_data.as_ref(), self.len())
}

fn left_parts_dictionary(&self) -> &Buffer<u16> {
Expand Down
7 changes: 4 additions & 3 deletions encodings/bytebool/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::TypedArrayRef;
use vortex_array::arrays::BoolArray;
Expand Down Expand Up @@ -143,7 +144,7 @@ impl VTable for ByteBool {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
crate::rules::RULES.evaluate(array, parent, child_idx)
Expand Down Expand Up @@ -187,8 +188,8 @@ impl Display for ByteBoolData {
pub trait ByteBoolArrayExt: TypedArrayRef<ByteBool> {
fn validity(&self) -> Validity {
child_to_validity(
self.as_ref().slots()[VALIDITY_SLOT].as_ref(),
self.as_ref().dtype().nullability(),
self.slots()[VALIDITY_SLOT].as_ref(),
self.dtype().nullability(),
)
}
}
Expand Down
3 changes: 2 additions & 1 deletion encodings/datetime-parts/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::array_slots;
use vortex_array::arrays::Primitive;
Expand Down Expand Up @@ -195,7 +196,7 @@ impl VTable for DateTimeParts {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
PARENT_RULES.evaluate(array, parent, child_idx)
Expand Down
8 changes: 3 additions & 5 deletions encodings/datetime-parts/src/compute/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use vortex_array::arrays::slice::SliceReduceAdaptor;
use vortex_array::builtins::ArrayBuiltins;
use vortex_array::dtype::DType;
use vortex_array::extension::datetime::Timestamp;
use vortex_array::optimizer::ArrayOptimizer;
use vortex_array::optimizer::rules::ArrayParentReduceRule;
use vortex_array::optimizer::rules::ParentRuleSet;
use vortex_array::scalar_fn::fns::between::Between;
Expand Down Expand Up @@ -133,10 +132,9 @@ impl ArrayParentReduceRule<DateTimeParts> for DTPComparisonPushDownRule {
}
}

let result =
ScalarFnArray::try_new(parent.scalar_fn().clone(), new_children, parent.len())?
.into_array()
.optimize()?;
let parts =
ScalarFnArray::try_new_parts(parent.scalar_fn().clone(), new_children, parent.len())?;
let result = parts.optimize()?;

Ok(Some(result))
}
Expand Down
5 changes: 3 additions & 2 deletions encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use vortex_array::ArrayRef;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::TypedArrayRef;
use vortex_array::arrays::DecimalArray;
Expand Down Expand Up @@ -156,7 +157,7 @@ impl VTable for DecimalByteParts {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
PARENT_RULES.evaluate(array, parent, child_idx)
Expand Down Expand Up @@ -206,7 +207,7 @@ pub struct DecimalBytePartsDataParts {

pub trait DecimalBytePartsArrayExt: TypedArrayRef<DecimalByteParts> {
fn msp(&self) -> &ArrayRef {
self.as_ref().slots()[MSP_SLOT]
self.slots()[MSP_SLOT]
.as_ref()
.vortex_expect("DecimalBytePartsArray msp slot")
}
Expand Down
8 changes: 4 additions & 4 deletions encodings/fastlanes/src/bitpacking/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ pub trait BitPackedArrayExt: BitPackedArraySlotsExt {
fn patches(&self) -> Option<Patches> {
PatchesData::patches_from_slots(
self.patches_data.as_ref(),
self.as_ref().len(),
self.as_ref().slots(),
self.len(),
self.slots(),
PATCH_SLOTS,
)
}

#[inline]
fn validity(&self) -> Validity {
child_to_validity(self.validity_child(), self.as_ref().dtype().nullability())
child_to_validity(self.validity_child(), self.dtype().nullability())
}

#[inline]
Expand All @@ -313,7 +313,7 @@ pub trait BitPackedArrayExt: BitPackedArraySlotsExt {

#[inline]
fn unpacked_chunks<T: BitPackedIter>(&self) -> VortexResult<BitUnpackedChunks<T>> {
BitPackedData::unpacked_chunks::<T>(self, self.as_ref().dtype(), self.as_ref().len())
BitPackedData::unpacked_chunks::<T>(self, self.dtype(), self.len())
}
}

Expand Down
5 changes: 3 additions & 2 deletions encodings/fastlanes/src/bitpacking/compute/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ fn slice_bitpacked(
mod tests {
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::ParentRef;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::SliceArray;
Expand All @@ -87,11 +88,11 @@ mod tests {
let values = PrimitiveArray::from_iter(0u32..2048);
let bitpacked = bitpack_encode(&values, 11, None, &mut ctx)?;

let slice_array = SliceArray::new(bitpacked.clone().into_array(), 500..1500);
let slice_array = SliceArray::new(bitpacked.clone().into_array(), 500..1500).into_array();

let bitpacked_ref = bitpacked.into_array();
let reduced = bitpacked_ref
.reduce_parent(&slice_array.into_array(), 0)?
.reduce_parent(&ParentRef::from_array_ref(&slice_array), 0)?
.expect("expected slice kernel to execute");

assert!(reduced.is::<BitPacked>());
Expand Down
3 changes: 2 additions & 1 deletion encodings/fastlanes/src/bitpacking/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::buffer::BufferHandle;
use vortex_array::builders::ArrayBuilder;
Expand Down Expand Up @@ -279,7 +280,7 @@ impl VTable for BitPacked {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
RULES.evaluate(array, parent, child_idx)
Expand Down
5 changes: 3 additions & 2 deletions encodings/fastlanes/src/bitpacking/vtable/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod test {
use vortex_array::ArrayRef;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::ParentRef;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::SliceArray;
Expand Down Expand Up @@ -63,9 +64,9 @@ mod test {

fn slice_via_reduce(array: &BitPackedArray, range: Range<usize>) -> BitPackedArray {
let array_ref = array.clone().into_array();
let slice_array = SliceArray::new(array_ref.clone(), range);
let slice_array = SliceArray::new(array_ref.clone(), range).into_array();
Comment thread
robert3005 marked this conversation as resolved.
let sliced = array_ref
.reduce_parent(&slice_array.into_array(), 0)
.reduce_parent(&ParentRef::from_array_ref(&slice_array), 0)
.expect("execute_parent failed")
.expect("expected slice kernel to execute");
sliced.as_::<BitPacked>().into_owned()
Expand Down
4 changes: 2 additions & 2 deletions encodings/fastlanes/src/delta/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ impl Display for DeltaData {

pub trait DeltaArrayExt: TypedArrayRef<crate::Delta> {
fn bases(&self) -> &ArrayRef {
self.as_ref().slots()[BASES_SLOT]
self.slots()[BASES_SLOT]
.as_ref()
.vortex_expect("DeltaArray bases slot")
}

fn deltas(&self) -> &ArrayRef {
self.as_ref().slots()[DELTAS_SLOT]
self.slots()[DELTAS_SLOT]
.as_ref()
.vortex_expect("DeltaArray deltas slot")
}
Expand Down
3 changes: 2 additions & 1 deletion encodings/fastlanes/src/delta/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::buffer::BufferHandle;
Expand Down Expand Up @@ -110,7 +111,7 @@ impl VTable for Delta {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
rules::RULES.evaluate(array, parent, child_idx)
Expand Down
2 changes: 1 addition & 1 deletion encodings/fastlanes/src/for/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct FoRData {

pub trait FoRArrayExt: TypedArrayRef<crate::FoR> {
fn encoded(&self) -> &ArrayRef {
self.as_ref().slots()[ENCODED_SLOT]
self.slots()[ENCODED_SLOT]
.as_ref()
.vortex_expect("FoRArray encoded slot")
}
Expand Down
3 changes: 2 additions & 1 deletion encodings/fastlanes/src/for/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::buffer::BufferHandle;
Expand Down Expand Up @@ -141,7 +142,7 @@ impl VTable for FoR {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
PARENT_RULES.evaluate(array, parent, child_idx)
Expand Down
6 changes: 3 additions & 3 deletions encodings/fastlanes/src/rle/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ impl RLEData {
pub trait RLEArrayExt: TypedArrayRef<crate::RLE> {
#[inline]
fn values(&self) -> &ArrayRef {
self.as_ref().slots()[VALUES_SLOT]
self.slots()[VALUES_SLOT]
.as_ref()
.vortex_expect("RLEArray values slot must be populated")
}

#[inline]
fn indices(&self) -> &ArrayRef {
self.as_ref().slots()[INDICES_SLOT]
self.slots()[INDICES_SLOT]
.as_ref()
.vortex_expect("RLEArray indices slot must be populated")
}

#[inline]
fn values_idx_offsets(&self) -> &ArrayRef {
self.as_ref().slots()[VALUES_IDX_OFFSETS_SLOT]
self.slots()[VALUES_IDX_OFFSETS_SLOT]
.as_ref()
.vortex_expect("RLEArray values_idx_offsets slot must be populated")
}
Expand Down
3 changes: 2 additions & 1 deletion encodings/fastlanes/src/rle/vtable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use vortex_array::ArrayView;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::ParentRef;
use vortex_array::Precision;
use vortex_array::arrays::Primitive;
use vortex_array::buffer::BufferHandle;
Expand Down Expand Up @@ -124,7 +125,7 @@ impl VTable for RLE {

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
parent: &ParentRef<'_>,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
RULES.evaluate(array, parent, child_idx)
Expand Down
Loading
Loading