Skip to content

Commit

Permalink
move ALP into separate module in same crate
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Oct 1, 2024
1 parent c51ecc4 commit c97b284
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use vortex::{
use vortex_dtype::{DType, PType};
use vortex_error::{vortex_bail, vortex_panic, VortexExpect as _, VortexResult};

use crate::alp::Exponents;
use crate::compress::{alp_encode, decompress};
use crate::alp::{alp_encode, decompress, Exponents};
use crate::ALPFloat;

impl_encoding!("vortex.alp", ids::ALP, ALP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use vortex_dtype::{NativePType, PType};
use vortex_error::{vortex_bail, VortexExpect as _, VortexResult};
use vortex_scalar::Scalar;

use crate::alp::ALPFloat;
use crate::array::ALPArray;
use crate::alp::{ALPArray, ALPFloat};
use crate::Exponents;

#[macro_export]
Expand Down
File renamed without changes.
16 changes: 15 additions & 1 deletion encodings/alp/src/alp.rs → encodings/alp/src/alp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ use itertools::Itertools;
use num_traits::{CheckedSub, Float, PrimInt, ToPrimitive};
use serde::{Deserialize, Serialize};

mod array;
mod compress;
mod compute;

pub use array::*;
pub use compress::*;

const SAMPLE_SIZE: usize = 32;

#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand All @@ -19,7 +26,14 @@ impl Display for Exponents {
}
}

pub trait ALPFloat: Float + Display + 'static {
mod private {
pub trait Sealed {}

impl Sealed for f32 {}
impl Sealed for f64 {}
}

pub trait ALPFloat: private::Sealed + Float + Display + 'static {
type ALPInt: PrimInt + Display + ToPrimitive;

const FRACTIONAL_BITS: u8;
Expand Down
5 changes: 0 additions & 5 deletions encodings/alp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

pub use alp::*;
pub use alp_rd::*;
pub use array::*;
pub use compress::*;

mod alp;
mod alp_rd;
mod array;
mod compress;
mod compute;

0 comments on commit c97b284

Please sign in to comment.