Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lwwmanning committed Mar 20, 2024
1 parent 7b9992f commit afb4477
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 32 deletions.
2 changes: 1 addition & 1 deletion vortex-array/src/array/composite/compress.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
18 changes: 0 additions & 18 deletions vortex-array/src/ptype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
35 changes: 22 additions & 13 deletions vortex-fastlanes/src/delta/compress.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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::<DeltaArray>().unwrap();
}
Expand Down

0 comments on commit afb4477

Please sign in to comment.