Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions encodings/alp/src/alp/decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use std::mem::transmute;

use vortex_array::ExecutionCtx;
use vortex_array::ToCanonical;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::primitive::chunk_range;
use vortex_array::arrays::primitive::patch_chunk;
Expand Down Expand Up @@ -33,14 +32,10 @@ pub fn decompress_into_array(
if let Some(ref patches) = patches
&& let Some(chunk_offsets) = patches.chunk_offsets()
{
let prim_encoded = encoded.to_primitive();
// We need to drop ALPArray here in case converting encoded buffer into
// primitive didn't create a copy. In that case both alp_encoded and array
// will hold a reference to the buffer we want to mutate.
drop(encoded);
let patches_chunk_offsets = chunk_offsets.as_ref().to_primitive();
let patches_indices = patches.indices().to_primitive();
let patches_values = patches.values().to_primitive();
let prim_encoded = encoded.execute::<PrimitiveArray>(ctx)?;
let patches_chunk_offsets = chunk_offsets.clone().execute::<PrimitiveArray>(ctx)?;
let patches_indices = patches.indices().clone().execute::<PrimitiveArray>(ctx)?;
let patches_values = patches.values().clone().execute::<PrimitiveArray>(ctx)?;
Ok(decompress_chunked_core(
prim_encoded,
exponents,
Expand All @@ -51,11 +46,7 @@ pub fn decompress_into_array(
dtype,
))
} else {
let encoded_prim = encoded.to_primitive();
// We need to drop ALPArray here in case converting encoded buffer into
// primitive didn't create a copy. In that case both alp_encoded and array
// will hold a reference to the buffer we want to mutate.
drop(encoded);
let encoded_prim = encoded.execute::<PrimitiveArray>(ctx)?;
decompress_unchunked_core(encoded_prim, exponents, patches, dtype, ctx)
}
}
Expand Down
4 changes: 2 additions & 2 deletions encodings/datetime-parts/src/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ mod test {
use rstest::rstest;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::ToCanonical;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::TemporalArray;
use vortex_array::assert_arrays_eq;
Expand Down Expand Up @@ -156,7 +155,8 @@ mod test {
let mut ctx = ExecutionCtx::new(VortexSession::empty());
let primitive_values = decode_to_temporal(&date_times, &mut ctx)?
.temporal_values()
.to_primitive();
.clone()
.execute::<PrimitiveArray>(&mut ctx)?;

assert_arrays_eq!(primitive_values, milliseconds);
assert_eq!(primitive_values.validity(), &validity);
Expand Down
6 changes: 3 additions & 3 deletions encodings/fastlanes/src/bitpacking/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use vortex_array::ArrayRef;
use vortex_array::DynArray;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::ToCanonical;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::dict::TakeExecute;
use vortex_array::dtype::IntegerPType;
Expand Down Expand Up @@ -43,7 +42,8 @@ impl TakeExecute for BitPackedVTable {
) -> VortexResult<Option<ArrayRef>> {
// If the indices are large enough, it's faster to flatten and take the primitive array.
if indices.len() * UNPACK_CHUNK_THRESHOLD > array.len() {
return array.to_primitive().take(indices.to_array()).map(Some);
let prim = array.clone().into_array().execute::<PrimitiveArray>(ctx)?;
return prim.take(indices.to_array()).map(Some);
}

// NOTE: we use the unsigned PType because all values in the BitPackedArray must
Expand All @@ -52,7 +52,7 @@ impl TakeExecute for BitPackedVTable {
let validity = array.validity();
let taken_validity = validity.take(indices)?;

let indices = indices.to_primitive();
let indices = indices.clone().execute::<PrimitiveArray>(ctx)?;
let taken = match_each_unsigned_integer_ptype!(ptype.to_unsigned(), |T| {
match_each_integer_ptype!(indices.ptype(), |I| {
take_primitive::<T, I>(array, &indices, taken_validity, ctx)?
Expand Down
6 changes: 3 additions & 3 deletions encodings/runend/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ pub fn vortex_runend::RunEndVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>)

impl vortex_array::arrays::dict::take::TakeExecute for vortex_runend::RunEndVTable

pub fn vortex_runend::RunEndVTable::take(array: &vortex_runend::RunEndArray, indices: &vortex_array::array::ArrayRef, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
pub fn vortex_runend::RunEndVTable::take(array: &vortex_runend::RunEndArray, indices: &vortex_array::array::ArrayRef, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::arrays::filter::kernel::FilterKernel for vortex_runend::RunEndVTable

pub fn vortex_runend::RunEndVTable::filter(array: &vortex_runend::RunEndArray, mask: &vortex_mask::Mask, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
pub fn vortex_runend::RunEndVTable::filter(array: &vortex_runend::RunEndArray, mask: &vortex_mask::Mask, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::compute::is_constant::IsConstantKernel for vortex_runend::RunEndVTable

Expand All @@ -144,7 +144,7 @@ pub fn vortex_runend::RunEndVTable::min_max(&self, array: &vortex_runend::RunEnd

impl vortex_array::scalar_fn::fns::binary::compare::CompareKernel for vortex_runend::RunEndVTable

pub fn vortex_runend::RunEndVTable::compare(lhs: &vortex_runend::RunEndArray, rhs: &vortex_array::array::ArrayRef, operator: vortex_array::scalar_fn::fns::operators::CompareOperator, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
pub fn vortex_runend::RunEndVTable::compare(lhs: &vortex_runend::RunEndArray, rhs: &vortex_array::array::ArrayRef, operator: vortex_array::scalar_fn::fns::operators::CompareOperator, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::scalar_fn::fns::cast::kernel::CastReduce for vortex_runend::RunEndVTable

Expand Down
9 changes: 5 additions & 4 deletions encodings/runend/src/compute/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use vortex_array::ArrayRef;
use vortex_array::DynArray;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::ToCanonical;
use vortex_array::arrays::BoolArray;
use vortex_array::arrays::ConstantArray;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::builtins::ArrayBuiltins;
use vortex_array::scalar_fn::fns::binary::CompareKernel;
use vortex_array::scalar_fn::fns::operators::CompareOperator;
Expand All @@ -22,7 +23,7 @@ impl CompareKernel for RunEndVTable {
lhs: &RunEndArray,
rhs: &ArrayRef,
operator: CompareOperator,
_ctx: &mut ExecutionCtx,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
// If the RHS is constant, then we just need to compare against our encoded values.
if let Some(const_scalar) = rhs.as_constant() {
Expand All @@ -31,8 +32,8 @@ impl CompareKernel for RunEndVTable {
Operator::from(operator),
)?;
let decoded = runend_decode_bools(
lhs.ends().to_primitive(),
values.to_bool(),
lhs.ends().clone().execute::<PrimitiveArray>(ctx)?,
values.execute::<BoolArray>(ctx)?,
lhs.offset(),
lhs.len(),
)?;
Expand Down
5 changes: 2 additions & 3 deletions encodings/runend/src/compute/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use num_traits::AsPrimitive;
use vortex_array::ArrayRef;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::ToCanonical;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::filter::FilterKernel;
use vortex_array::dtype::NativePType;
Expand All @@ -30,7 +29,7 @@ impl FilterKernel for RunEndVTable {
fn filter(
array: &RunEndArray,
mask: &Mask,
_ctx: &mut ExecutionCtx,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
let mask_values = mask
.values()
Expand All @@ -45,7 +44,7 @@ impl FilterKernel for RunEndVTable {
&Validity::NonNullable,
)?))
} else {
let primitive_run_ends = array.ends().to_primitive();
let primitive_run_ends = array.ends().clone().execute::<PrimitiveArray>(ctx)?;
let (run_ends, values_mask) =
match_each_unsigned_integer_ptype!(primitive_run_ends.ptype(), |P| {
filter_run_end_primitive(
Expand Down
4 changes: 2 additions & 2 deletions encodings/runend/src/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ impl TakeExecute for RunEndVTable {
fn take(
array: &RunEndArray,
indices: &ArrayRef,
_ctx: &mut ExecutionCtx,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
let primitive_indices = indices.to_primitive();
let primitive_indices = indices.clone().execute::<PrimitiveArray>(ctx)?;

let checked_indices = match_each_integer_ptype!(primitive_indices.ptype(), |P| {
primitive_indices
Expand Down
2 changes: 1 addition & 1 deletion encodings/sequence/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn vortex_sequence::SequenceVTable::fmt(&self, f: &mut core::fmt::Formatter<

impl vortex_array::arrays::dict::take::TakeExecute for vortex_sequence::SequenceVTable

pub fn vortex_sequence::SequenceVTable::take(array: &vortex_sequence::SequenceArray, indices: &vortex_array::array::ArrayRef, _ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>
pub fn vortex_sequence::SequenceVTable::take(array: &vortex_sequence::SequenceArray, indices: &vortex_array::array::ArrayRef, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::ArrayRef>>

impl vortex_array::arrays::filter::kernel::FilterKernel for vortex_sequence::SequenceVTable

Expand Down
5 changes: 2 additions & 3 deletions encodings/sequence/src/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use vortex_array::ArrayRef;
use vortex_array::DynArray;
use vortex_array::ExecutionCtx;
use vortex_array::IntoArray;
use vortex_array::ToCanonical;
use vortex_array::arrays::ConstantArray;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::dict::TakeExecute;
Expand Down Expand Up @@ -77,10 +76,10 @@ impl TakeExecute for SequenceVTable {
fn take(
array: &SequenceArray,
indices: &ArrayRef,
_ctx: &mut ExecutionCtx,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
let mask = indices.validity_mask()?;
let indices = indices.to_primitive();
let indices = indices.clone().execute::<PrimitiveArray>(ctx)?;
let result_nullability = array.dtype().nullability() | indices.dtype().nullability();

match_each_integer_ptype!(indices.ptype(), |T| {
Expand Down
3 changes: 1 addition & 2 deletions vortex-array/src/arrays/chunked/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::arrays::ChunkedVTable;
use crate::arrays::PrimitiveArray;
use crate::arrays::dict::TakeExecute;
use crate::builtins::ArrayBuiltins;
use crate::canonical::ToCanonical;
use crate::dtype::DType;
use crate::dtype::PType;
use crate::executor::ExecutionCtx;
Expand All @@ -30,7 +29,7 @@ fn take_chunked(
let indices = indices
.to_array()
.cast(DType::Primitive(PType::U64, indices.dtype().nullability()))?
.to_primitive();
.execute::<PrimitiveArray>(ctx)?;

let indices_mask = indices.validity_mask()?;
let indices_values = indices.as_slice::<u64>();
Expand Down
3 changes: 1 addition & 2 deletions vortex-duckdb/src/exporter/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use vortex::array::Canonical;
use vortex::array::DynArray;
use vortex::array::ExecutionCtx;
use vortex::array::IntoArray;
use vortex::array::ToCanonical;
use vortex::array::arrays::ConstantArray;
use vortex::array::arrays::ConstantVTable;
use vortex::array::arrays::DictArray;
Expand Down Expand Up @@ -72,7 +71,7 @@ pub(crate) fn new_exporter_with_flatten(
}

let values_key = Arc::as_ptr(values).addr();
let codes = array.codes().to_primitive();
let codes = array.codes().clone().execute::<PrimitiveArray>(ctx)?;

let exporter_values = if flatten {
let canonical = cache
Expand Down
Loading