Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure compressor #55

Merged
merged 3 commits into from
Mar 4, 2024
Merged
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
35 changes: 32 additions & 3 deletions bench-vortex/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
use itertools::Itertools;
use vortex::array::bool::BoolEncoding;
use vortex::array::chunked::ChunkedEncoding;
use vortex::array::constant::ConstantEncoding;

use vortex::array::primitive::PrimitiveEncoding;
use vortex::array::sparse::SparseEncoding;
use vortex::array::struct_::StructEncoding;
use vortex::array::typed::TypedEncoding;
use vortex::array::varbin::VarBinEncoding;
use vortex::array::varbinview::VarBinViewEncoding;
use vortex::array::Encoding;
use vortex_alp::ALPEncoding;
use vortex_dict::DictEncoding;
Expand All @@ -8,11 +17,24 @@ use vortex_ree::REEEncoding;
use vortex_roaring::{RoaringBoolEncoding, RoaringIntEncoding};
use vortex_zigzag::ZigZagEncoding;

pub fn enumerate_arrays() {
pub fn enumerate_arrays() -> Vec<&'static dyn Encoding> {
let encodings: Vec<&dyn Encoding> = vec![
// TODO(ngates): fix https://github.com/fulcrum-so/vortex/issues/35
// Builtins
&BoolEncoding,
&ChunkedEncoding,
&ConstantEncoding,
&PrimitiveEncoding,
&SparseEncoding,
&StructEncoding,
&TypedEncoding,
&VarBinEncoding,
&VarBinViewEncoding,
// Encodings
&ALPEncoding,
&DictEncoding,
&BitPackedEncoding,
// &DeltaEncoding,
&FoREncoding,
//&FFoREncoding,
&REEEncoding,
Expand All @@ -21,10 +43,12 @@ pub fn enumerate_arrays() {
&ZigZagEncoding,
];
println!("{}", encodings.iter().map(|e| e.id()).format(", "));
encodings
}

#[cfg(test)]
mod test {
use std::collections::HashSet;
use std::fs::create_dir_all;
use std::fs::File;
use std::path::Path;
Expand All @@ -36,7 +60,7 @@ mod test {

use vortex::array::chunked::ChunkedArray;
use vortex::array::{Array, ArrayRef};
use vortex::compress::CompressCtx;
use vortex::compress::{CompressConfig, CompressCtx};
use vortex::dtype::DType;
use vortex::error::{VortexError, VortexResult};

Expand Down Expand Up @@ -93,7 +117,12 @@ mod test {
chunked.chunks().len()
);
let array = chunked.boxed();
let compressed = CompressCtx::default().compress(array.as_ref(), None);
let cfg = CompressConfig::new(
HashSet::from_iter(enumerate_arrays().iter().map(|e| (*e).id())),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

HashSet::default(),
);
println!("Compression config {cfg:?}");
let compressed = CompressCtx::new(&cfg).compress(array.as_ref(), None);
println!("Compressed array {compressed}");
println!(
"NBytes {}, Ratio {}",
Expand Down