From afb4477eef9d40ac1330e07d0506b6a9b180e77a Mon Sep 17 00:00:00 2001 From: Will Manning Date: Wed, 20 Mar 2024 13:36:13 +0000 Subject: [PATCH] more fixes --- vortex-array/src/array/composite/compress.rs | 2 +- vortex-array/src/ptype.rs | 18 ---------- vortex-fastlanes/src/delta/compress.rs | 35 ++++++++++++-------- 3 files changed, 23 insertions(+), 32 deletions(-) diff --git a/vortex-array/src/array/composite/compress.rs b/vortex-array/src/array/composite/compress.rs index 9e57c87147..80f97461eb 100644 --- a/vortex-array/src/array/composite/compress.rs +++ b/vortex-array/src/array/composite/compress.rs @@ -1,6 +1,6 @@ -use crate::array::{Array, ArrayRef}; use crate::array::composite::{CompositeArray, CompositeEncoding}; use crate::array::downcast::DowncastArrayBuiltin; +use crate::array::{Array, ArrayRef}; use crate::compress::{CompressConfig, CompressCtx, EncodingCompression}; use crate::error::VortexResult; diff --git a/vortex-array/src/ptype.rs b/vortex-array/src/ptype.rs index 9682befcf8..bcafbf236e 100644 --- a/vortex-array/src/ptype.rs +++ b/vortex-array/src/ptype.rs @@ -203,24 +203,6 @@ impl Display for PType { } } -impl Display for PType { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - PType::U8 => write!(f, "u8"), - PType::U16 => write!(f, "u16"), - PType::U32 => write!(f, "u32"), - PType::U64 => write!(f, "u64"), - PType::I8 => write!(f, "i8"), - PType::I16 => write!(f, "i16"), - PType::I32 => write!(f, "i32"), - PType::I64 => write!(f, "i64"), - PType::F16 => write!(f, "f16"), - PType::F32 => write!(f, "f32"), - PType::F64 => write!(f, "f64"), - } - } -} - impl TryFrom<&DType> for PType { type Error = VortexError; diff --git a/vortex-fastlanes/src/delta/compress.rs b/vortex-fastlanes/src/delta/compress.rs index 2a8857cbb0..f87a2b7de5 100644 --- a/vortex-fastlanes/src/delta/compress.rs +++ b/vortex-fastlanes/src/delta/compress.rs @@ -1,10 +1,11 @@ -use arrayref::array_ref; use std::mem::size_of; -use fastlanez_sys::{transpose, Delta}; +use arrayref::array_ref; + +use fastlanez_sys::{Delta, transpose}; +use vortex::array::{Array, ArrayRef}; use vortex::array::downcast::DowncastArrayBuiltin; use vortex::array::primitive::PrimitiveArray; -use vortex::array::{Array, ArrayRef}; use vortex::compress::{CompressConfig, CompressCtx, EncodingCompression}; use vortex::compute::fill::fill_forward; use vortex::error::VortexResult; @@ -124,25 +125,33 @@ where #[cfg(test)] mod test { use std::collections::HashSet; + use std::sync::Arc; - use vortex::array::primitive::PrimitiveEncoding; use vortex::array::Encoding; + use vortex::array::primitive::PrimitiveEncoding; use super::*; - #[test] - fn test_compress() { - // FIXME(ngates): remove PrimitiveEncoding https://github.com/fulcrum-so/vortex/issues/35 + fn compress_ctx() -> CompressCtx { let cfg = CompressConfig::new( - HashSet::from([PrimitiveEncoding.id(), DeltaEncoding.id()]), + HashSet::from([ + PrimitiveEncoding.id(), + DeltaEncoding.id(), + ]), HashSet::default(), ); - let ctx = CompressCtx::new(&cfg); + CompressCtx::new(Arc::new(cfg)) + } - let compressed = ctx.compress( - &PrimitiveArray::from_vec(Vec::from_iter((0..10_000).map(|i| (i % 63) as u8))), - None, - ); + #[test] + fn test_compress() { + let ctx = compress_ctx(); + let compressed = ctx + .compress( + &PrimitiveArray::from(Vec::from_iter((0..10_000).map(|i| (i % 63) as u8))), + None, + ) + .unwrap(); assert_eq!(compressed.encoding().id(), DeltaEncoding.id()); _ = compressed.as_any().downcast_ref::().unwrap(); }