-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
451 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use crate::ALPArray; | ||
use codecz::alp; | ||
use vortex::array::Array; | ||
use vortex::compute::scalar_at::{scalar_at, ScalarAtFn}; | ||
use vortex::compute::ArrayCompute; | ||
use vortex::dtype::{DType, FloatWidth}; | ||
use vortex::error::VortexResult; | ||
use vortex::scalar::{NullableScalar, Scalar}; | ||
|
||
impl ArrayCompute for ALPArray { | ||
fn scalar_at(&self) -> Option<&dyn ScalarAtFn> { | ||
Some(self) | ||
} | ||
} | ||
|
||
impl ScalarAtFn for ALPArray { | ||
fn scalar_at(&self, index: usize) -> VortexResult<Box<dyn Scalar>> { | ||
if let Some(patch) = self | ||
.patches() | ||
.and_then(|p| scalar_at(p, index).ok()) | ||
.and_then(|p| p.into_nonnull()) | ||
{ | ||
return Ok(patch); | ||
} | ||
|
||
let Some(encoded_val) = scalar_at(self.encoded(), index)?.into_nonnull() else { | ||
return Ok(NullableScalar::none(self.dtype().clone()).boxed()); | ||
}; | ||
match self.dtype() { | ||
DType::Float(FloatWidth::_32, _) => { | ||
let encoded_val: i32 = encoded_val.try_into().unwrap(); | ||
Ok(alp::decode_single::<f32>(encoded_val, self.exponents()) | ||
.unwrap() | ||
.into()) | ||
} | ||
|
||
DType::Float(FloatWidth::_64, _) => { | ||
let encoded_val: i64 = encoded_val.try_into().unwrap(); | ||
Ok(alp::decode_single::<f64>(encoded_val, self.exponents()) | ||
.unwrap() | ||
.into()) | ||
} | ||
|
||
_ => unreachable!(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ hashbrown = "0.14.3" | |
linkme = "0.3.22" | ||
log = "0.4.20" | ||
num-traits = "0.2.17" | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::DictArray; | ||
use vortex::compute::scalar_at::{scalar_at, ScalarAtFn}; | ||
use vortex::compute::ArrayCompute; | ||
use vortex::error::VortexResult; | ||
use vortex::scalar::Scalar; | ||
|
||
impl ArrayCompute for DictArray { | ||
fn scalar_at(&self) -> Option<&dyn ScalarAtFn> { | ||
Some(self) | ||
} | ||
} | ||
|
||
impl ScalarAtFn for DictArray { | ||
fn scalar_at(&self, index: usize) -> VortexResult<Box<dyn Scalar>> { | ||
let dict_index: usize = scalar_at(self.codes(), index)?.try_into()?; | ||
scalar_at(self.dict(), dict_index) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ pub use compress::*; | |
pub use dict::*; | ||
|
||
mod compress; | ||
mod compute; | ||
mod dict; | ||
mod downcast; | ||
mod serde; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ linkme = "0.3.22" | |
half = "2.3.1" | ||
num-traits = "0.2.17" | ||
itertools = "0.10.5" | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::REEArray; | ||
use vortex::compute::scalar_at::{scalar_at, ScalarAtFn}; | ||
use vortex::compute::ArrayCompute; | ||
use vortex::error::VortexResult; | ||
use vortex::scalar::Scalar; | ||
|
||
impl ArrayCompute for REEArray { | ||
fn scalar_at(&self) -> Option<&dyn ScalarAtFn> { | ||
Some(self) | ||
} | ||
} | ||
|
||
impl ScalarAtFn for REEArray { | ||
fn scalar_at(&self, index: usize) -> VortexResult<Box<dyn Scalar>> { | ||
scalar_at(self.values(), self.find_physical_index(index)?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.