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

Array2: Migrate ALP #255

Merged
merged 9 commits into from
Apr 23, 2024
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
66 changes: 66 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
"fastlanez-sys",
"pyvortex",
"vortex-alloc",
#"vortex-alp",
"vortex-alp",
"vortex-array",
#"vortex-datetime",
"vortex-dict",
Expand Down
1 change: 1 addition & 0 deletions bench-vortex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ reqwest = { workspace = true }
simplelog = { workspace = true }
tokio = { workspace = true }
uuid = { workspace = true }
vortex-alp = { path = "../vortex-alp" }
vortex-array = { path = "../vortex-array" }
vortex-dict = { path = "../vortex-dict" }
vortex-error = { path = "../vortex-error", features = ["parquet"] }
Expand Down
3 changes: 2 additions & 1 deletion bench-vortex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use vortex::arrow::FromArrowType;
use vortex::compress::{CompressConfig, CompressCtx};
use vortex::encoding::{EncodingRef, VORTEX_ENCODINGS};
use vortex::{IntoArray, OwnedArray, ToArrayData};
use vortex_alp::ALPEncoding;
use vortex_dict::DictEncoding;
use vortex_fastlanes::{BitPackedEncoding, FoREncoding};
use vortex_ree::REEEncoding;
Expand Down Expand Up @@ -105,7 +106,7 @@ pub fn enumerate_arrays() -> Vec<EncodingRef> {
VORTEX_ENCODINGS.iter().map(|e| e.id()).collect_vec()
);
vec![
//&ALPEncoding,
&ALPEncoding,
&DictEncoding,
&BitPackedEncoding,
&FoREncoding,
Expand Down
2 changes: 1 addition & 1 deletion pyvortex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ crate-type = ["rlib", "cdylib"]
[dependencies]
arrow = { workspace = true }
vortex-array = { path = "../vortex-array" }
#vortex-alp = { path = "../vortex-alp" }
vortex-alp = { path = "../vortex-alp" }
vortex-dict = { path = "../vortex-dict" }
vortex-error = { path = "../vortex-error" }
vortex-fastlanes = { path = "../vortex-fastlanes" }
Expand Down
8 changes: 7 additions & 1 deletion pyvortex/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use vortex::encoding::EncodingRef;
use vortex::ToStatic;
use vortex::{ArrayDType, ArrayData, IntoArray, OwnedArray};
use vortex::{ArrayDef, IntoArrayData};
use vortex_alp::{ALPArray, ALPEncoding, OwnedALPArray, ALP};
use vortex_dict::{Dict, DictArray, DictEncoding, OwnedDictArray};
use vortex_fastlanes::{
BitPacked, BitPackedArray, BitPackedEncoding, Delta, DeltaArray, DeltaEncoding, FoR, FoRArray,
Expand Down Expand Up @@ -67,7 +68,7 @@ pyarray!(StructEncoding, StructArray, "StructArray");
pyarray!(VarBinEncoding, VarBinArray, "VarBinArray");
pyarray!(VarBinViewEncoding, VarBinViewArray, "VarBinViewArray");

// pyarray!(ALPEncoding, ALPArray, "ALPArray");
pyarray!(ALPEncoding, ALPArray, "ALPArray");
pyarray!(BitPackedEncoding, BitPackedArray, "BitPackedArray");
pyarray!(FoREncoding, FoRArray, "FoRArray");
pyarray!(DeltaEncoding, DeltaArray, "DeltaArray");
Expand Down Expand Up @@ -156,6 +157,11 @@ impl PyArray {
)?
.extract(py),

ALP::ID => PyALPArray::wrap(
py,
OwnedALPArray::try_from(inner.into_array()).map_err(PyVortexError::map_err)?,
)?
.extract(py),
_ => Py::new(
py,
Self {
Expand Down
1 change: 1 addition & 0 deletions pyvortex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fn _lib(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<PyVarBinArray>()?;
m.add_class::<PyVarBinViewArray>()?;
// m.add_class::<PyZigZagArray>()?;
m.add_class::<PyALPArray>()?;

m.add_class::<PyDType>()?;

Expand Down
10 changes: 6 additions & 4 deletions vortex-alp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ rust-version = { workspace = true }
workspace = true

[dependencies]
itertools = { workspace = true }
linkme = { workspace = true }
log = { workspace = true }
num-traits = { workspace = true }
paste = { workspace = true }
serde = { workspace = true, features = ["derive"] }
vortex-array = { path = "../vortex-array" }
vortex-error = { path = "../vortex-error" }
vortex-schema = { path = "../vortex-schema" }
linkme = { workspace = true }
itertools = { workspace = true }
num-traits = { workspace = true }
log = { workspace = true }

[dev-dependencies]
divan = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion vortex-alp/src/alp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use std::mem::size_of;

use itertools::Itertools;
use num_traits::{Float, NumCast, PrimInt, Zero};
use serde::{Deserialize, Serialize};

const SAMPLE_SIZE: usize = 32;

#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Exponents {
pub e: u8,
pub f: u8,
Expand Down
Loading