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

Extract a vortex-scalar crate #275

Merged
merged 2 commits into from
Apr 30, 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
22 changes: 22 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions vortex-alp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ serde = { workspace = true, features = ["derive"] }
vortex-array = { path = "../vortex-array" }
vortex-error = { path = "../vortex-error" }
vortex-dtype = { path = "../vortex-dtype" }
vortex-scalar = { path = "../vortex-scalar" }

[dev-dependencies]
divan = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion vortex-alp/src/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use itertools::Itertools;
use vortex::array::primitive::PrimitiveArray;
use vortex::array::sparse::{Sparse, SparseArray};
use vortex::compress::{CompressConfig, CompressCtx, EncodingCompression};
use vortex::scalar::Scalar;
use vortex::validity::Validity;
use vortex::{Array, ArrayDType, ArrayDef, AsArray, IntoArray, OwnedArray};
use vortex_dtype::{NativePType, PType};
use vortex_error::{vortex_bail, vortex_err, VortexResult};
use vortex_scalar::Scalar;

use crate::alp::ALPFloat;
use crate::array::{ALPArray, ALPEncoding};
Expand Down
2 changes: 1 addition & 1 deletion vortex-alp/src/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use vortex::compute::scalar_at::{scalar_at, ScalarAtFn};
use vortex::compute::slice::{slice, SliceFn};
use vortex::compute::take::{take, TakeFn};
use vortex::compute::ArrayCompute;
use vortex::scalar::Scalar;
use vortex::{Array, ArrayDType, IntoArray, OwnedArray};
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::{match_each_alp_float_ptype, ALPArray};

Expand Down
3 changes: 2 additions & 1 deletion vortex-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ paste = { workspace = true }
rand = { workspace = true }
thiserror = { workspace = true }
vortex-alloc = { path = "../vortex-alloc" }
vortex-dtype = { path = "../vortex-dtype", features = ["serde"] }
vortex-error = { path = "../vortex-error", features = ["flexbuffers"] }
vortex-flatbuffers = { path = "../vortex-flatbuffers" }
vortex-dtype = { path = "../vortex-dtype", features = ["serde"] }
vortex-scalar = { path = "../vortex-scalar", features = ["serde"] }
serde = { workspace = true, features = ["derive"] }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/bool/compute/scalar_at.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use vortex_error::VortexResult;
use vortex_scalar::{BoolScalar, Scalar};

use crate::array::bool::BoolArray;
use crate::compute::scalar_at::ScalarAtFn;
use crate::scalar::{BoolScalar, Scalar};
use crate::validity::ArrayValidity;
use crate::ArrayDType;

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/bool/stats.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashMap;

use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::array::bool::BoolArray;
use crate::scalar::Scalar;
use crate::stats::{ArrayStatisticsCompute, Stat};
use crate::ArrayTrait;

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/chunked/compute/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::array::chunked::ChunkedArray;
use crate::compute::as_contiguous::{as_contiguous, AsContiguousFn};
use crate::compute::scalar_at::{scalar_at, ScalarAtFn};
use crate::compute::take::TakeFn;
use crate::compute::ArrayCompute;
use crate::scalar::Scalar;
use crate::{Array, OwnedArray, ToStatic};

mod take;
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/chunked/stats.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashMap;

use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::array::chunked::ChunkedArray;
use crate::scalar::Scalar;
use crate::stats::{ArrayStatisticsCompute, Stat};

impl ArrayStatisticsCompute for ChunkedArray<'_> {
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/composite/compute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use arrow_array::ArrayRef as ArrowArrayRef;
use itertools::Itertools;
use vortex_error::{vortex_err, VortexResult};
use vortex_scalar::Scalar;

use crate::array::composite::array::CompositeArray;
use crate::compute::as_arrow::AsArrowArray;
Expand All @@ -9,7 +10,6 @@ use crate::compute::scalar_at::{scalar_at, ScalarAtFn};
use crate::compute::slice::{slice, SliceFn};
use crate::compute::take::{take, TakeFn};
use crate::compute::ArrayCompute;
use crate::scalar::Scalar;
use crate::{Array, ArrayDType, IntoArray, OwnedArray};

impl ArrayCompute for CompositeArray<'_> {
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/constant/compute.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use itertools::Itertools;
use vortex_error::{vortex_err, VortexResult};
use vortex_scalar::Scalar;

use crate::array::constant::ConstantArray;
use crate::compute::as_contiguous::AsContiguousFn;
use crate::compute::scalar_at::ScalarAtFn;
use crate::compute::take::TakeFn;
use crate::compute::ArrayCompute;
use crate::scalar::Scalar;
use crate::{Array, ArrayTrait, IntoArray, OwnedArray};

impl ArrayCompute for ConstantArray<'_> {
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/constant/flatten.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use vortex_dtype::{match_each_native_ptype, Nullability};
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::array::bool::BoolArray;
use crate::array::constant::ConstantArray;
use crate::array::primitive::PrimitiveArray;
use crate::scalar::Scalar;
use crate::validity::Validity;
use crate::{ArrayDType, ArrayTrait};
use crate::{ArrayFlatten, Flattened};
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/constant/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::collections::HashMap;

use vortex_dtype::DType;
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::array::constant::ConstantArray;
use crate::scalar::Scalar;
use crate::stats::{ArrayStatisticsCompute, Stat};
use crate::{ArrayDType, ArrayTrait};

Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/array/primitive/compute/scalar_at.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use vortex_dtype::match_each_native_ptype;
use vortex_error::VortexResult;
use vortex_scalar::PrimitiveScalar;
use vortex_scalar::Scalar;

use crate::array::primitive::PrimitiveArray;
use crate::compute::scalar_at::ScalarAtFn;
use crate::scalar::PrimitiveScalar;
use crate::scalar::Scalar;
use crate::validity::ArrayValidity;
use crate::ArrayDType;

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/primitive/compute/search_sorted.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use vortex_dtype::match_each_native_ptype;
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::array::primitive::PrimitiveArray;
use crate::compute::search_sorted::{SearchResult, SearchSorted};
use crate::compute::search_sorted::{SearchSortedFn, SearchSortedSide};
use crate::scalar::Scalar;

impl SearchSortedFn for PrimitiveArray<'_> {
fn search_sorted(&self, value: &Scalar, side: SearchSortedSide) -> VortexResult<SearchResult> {
Expand Down
7 changes: 4 additions & 3 deletions vortex-array/src/array/primitive/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use std::mem::size_of;
use arrow_buffer::buffer::BooleanBuffer;
use vortex_dtype::match_each_native_ptype;
use vortex_error::VortexResult;
use vortex_scalar::{ListScalarVec, PScalar};
use vortex_scalar::{PScalarType, Scalar};

use crate::array::primitive::PrimitiveArray;
use crate::scalar::{ListScalarVec, PScalar};
use crate::scalar::{PScalarType, Scalar};
use crate::stats::{ArrayStatisticsCompute, Stat};
use crate::validity::ArrayValidity;
use crate::validity::LogicalValidity;
Expand Down Expand Up @@ -229,8 +229,9 @@ impl<T: PStatsType> StatsAccumulator<T> {

#[cfg(test)]
mod test {
use vortex_scalar::ListScalarVec;

use crate::array::primitive::PrimitiveArray;
use crate::scalar::ListScalarVec;
use crate::stats::{ArrayStatistics, Stat};

#[test]
Expand Down
4 changes: 2 additions & 2 deletions vortex-array/src/array/sparse/compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::collections::HashMap;
use itertools::Itertools;
use vortex_dtype::match_each_integer_ptype;
use vortex_error::{vortex_bail, VortexResult};
use vortex_scalar::Scalar;

use crate::array::primitive::{OwnedPrimitiveArray, PrimitiveArray};
use crate::array::sparse::SparseArray;
Expand All @@ -11,7 +12,6 @@ use crate::compute::scalar_at::{scalar_at, ScalarAtFn};
use crate::compute::slice::SliceFn;
use crate::compute::take::{take, TakeFn};
use crate::compute::ArrayCompute;
use crate::scalar::Scalar;
use crate::{Array, ArrayDType, ArrayTrait, IntoArray, OwnedArray};

mod slice;
Expand Down Expand Up @@ -139,14 +139,14 @@ fn take_search_sorted(
mod test {
use itertools::Itertools;
use vortex_dtype::{DType, FloatWidth, Nullability};
use vortex_scalar::Scalar;

use crate::array::primitive::PrimitiveArray;
use crate::array::sparse::compute::take_map;
use crate::array::sparse::SparseArray;
use crate::compute::as_contiguous::as_contiguous;
use crate::compute::slice::slice;
use crate::compute::take::take;
use crate::scalar::Scalar;
use crate::validity::Validity;
use crate::{ArrayTrait, IntoArray, OwnedArray};

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/sparse/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use arrow_buffer::BooleanBufferBuilder;
use itertools::Itertools;
use vortex_dtype::{match_each_native_ptype, NativePType};
use vortex_error::{VortexError, VortexResult};
use vortex_scalar::Scalar;

use crate::array::primitive::PrimitiveArray;
use crate::array::sparse::SparseArray;
use crate::scalar::Scalar;
use crate::validity::Validity;
use crate::{ArrayFlatten, ArrayTrait, Flattened};

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/sparse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ mod test {
use vortex_dtype::Signedness::Signed;
use vortex_dtype::{DType, IntWidth};
use vortex_error::VortexError;
use vortex_scalar::Scalar;

use crate::accessor::ArrayAccessor;
use crate::array::sparse::SparseArray;
use crate::compute::cast::cast;
use crate::compute::scalar_at::scalar_at;
use crate::compute::slice::slice;
use crate::scalar::Scalar;
use crate::{Array, IntoArray, OwnedArray};

fn nullable_fill() -> Scalar {
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/struct/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use arrow_array::{
use arrow_schema::{Field, Fields};
use itertools::Itertools;
use vortex_error::VortexResult;
use vortex_scalar::{Scalar, StructScalar};

use crate::array::r#struct::StructArray;
use crate::compute::as_arrow::{as_arrow, AsArrowArray};
Expand All @@ -14,7 +15,6 @@ use crate::compute::scalar_at::{scalar_at, ScalarAtFn};
use crate::compute::slice::{slice, SliceFn};
use crate::compute::take::{take, TakeFn};
use crate::compute::ArrayCompute;
use crate::scalar::{Scalar, StructScalar};
use crate::ArrayTrait;
use crate::{Array, ArrayDType, IntoArray, OwnedArray};

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbin/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ impl<O: NativePType> VarBinBuilder<O> {
mod test {
use vortex_dtype::DType;
use vortex_dtype::Nullability::Nullable;
use vortex_scalar::Utf8Scalar;

use crate::array::varbin::builder::VarBinBuilder;
use crate::compute::scalar_at::scalar_at;
use crate::scalar::Utf8Scalar;
use crate::{ArrayDType, IntoArray};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbin/compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use itertools::Itertools;
use vortex_dtype::DType;
use vortex_dtype::PType;
use vortex_error::{vortex_bail, VortexResult};
use vortex_scalar::Scalar;

use crate::array::primitive::PrimitiveArray;
use crate::array::varbin::{varbin_scalar, VarBinArray};
Expand All @@ -18,7 +19,6 @@ use crate::compute::scalar_at::ScalarAtFn;
use crate::compute::slice::SliceFn;
use crate::compute::take::TakeFn;
use crate::compute::ArrayCompute;
use crate::scalar::Scalar;
use crate::validity::{ArrayValidity, Validity};
use crate::{Array, ArrayDType, IntoArray, OwnedArray, ToArray};

Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use serde::{Deserialize, Serialize};
use vortex_dtype::{match_each_native_ptype, NativePType};
use vortex_dtype::{IntWidth, Nullability, Signedness};
use vortex_error::{vortex_bail, VortexResult};
use vortex_scalar::{BinaryScalar, Utf8Scalar};

use crate::array::varbin::builder::VarBinBuilder;
use crate::compute::scalar_at::scalar_at;
use crate::compute::slice::slice;
use crate::scalar::{BinaryScalar, Utf8Scalar};
use crate::validity::{Validity, ValidityMetadata};
use crate::ArrayDType;
use crate::{impl_encoding, OwnedArray, ToArrayData};
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/varbin/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::collections::HashMap;

use vortex_dtype::DType;
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::accessor::ArrayAccessor;
use crate::array::varbin::{varbin_scalar, VarBinArray};
use crate::scalar::Scalar;
use crate::stats::{ArrayStatisticsCompute, Stat};
use crate::{ArrayDType, ArrayTrait};

Expand Down
Loading