Skip to content

Commit ab5e71e

Browse files
authored
Move SparseArray into a crate (#2090)
1 parent b363254 commit ab5e71e

File tree

27 files changed

+147
-147
lines changed

27 files changed

+147
-147
lines changed

Cargo.lock

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ vortex-layout = { version = "0.22.1", path = "./vortex-layout" }
162162
vortex-mask = { version = "0.22.1", path = "./vortex-mask" }
163163
vortex-proto = { version = "0.22.1", path = "./vortex-proto" }
164164
vortex-runend = { version = "0.22.1", path = "./encodings/runend" }
165+
vortex-sampling-compressor = { version = "0.22.1", path = "./vortex-sampling-compressor" }
165166
vortex-scalar = { version = "0.22.1", path = "./vortex-scalar", default-features = false }
166167
vortex-scan = { version = "0.22.1", path = "./vortex-scan", default-features = false }
167-
vortex-sampling-compressor = { version = "0.22.1", path = "./vortex-sampling-compressor" }
168+
vortex-sparse = { version = "0.22.1", path = "./encodings/sparse" }
168169
vortex-zigzag = { version = "0.22.1", path = "./encodings/zigzag" }
169170
# END crates published by this project
170171

bench-vortex/src/bin/notimplemented.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use tabled::settings::themes::Colorization;
88
use tabled::settings::{Color, Style};
99
use vortex::array::builder::VarBinBuilder;
1010
use vortex::array::{
11-
BoolArray, ChunkedArray, ConstantArray, ListArray, NullArray, PrimitiveArray, SparseArray,
12-
StructArray, VarBinViewArray,
11+
BoolArray, ChunkedArray, ConstantArray, ListArray, NullArray, PrimitiveArray, StructArray,
12+
VarBinViewArray,
1313
};
1414
use vortex::buffer::buffer;
1515
use vortex::datetime_dtype::{TemporalMetadata, TimeUnit, TIME_ID};
@@ -21,6 +21,7 @@ use vortex::encodings::dict::DictArray;
2121
use vortex::encodings::fastlanes::{BitPackedArray, DeltaArray, FoRArray};
2222
use vortex::encodings::fsst::{fsst_compress, fsst_train_compressor};
2323
use vortex::encodings::runend::RunEndArray;
24+
use vortex::encodings::sparse::SparseArray;
2425
use vortex::encodings::zigzag::ZigZagArray;
2526
use vortex::scalar::Scalar;
2627
use vortex::validity::Validity;

encodings/dict/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ vortex-dtype = { workspace = true }
2323
vortex-error = { workspace = true }
2424
vortex-mask = { workspace = true }
2525
vortex-scalar = { workspace = true }
26+
vortex-sparse = { workspace = true }
2627

2728
[lints]
2829
workspace = true

encodings/dict/src/compress.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use num_traits::AsPrimitive;
44
use vortex_array::accessor::ArrayAccessor;
55
use vortex_array::aliases::hash_map::{DefaultHashBuilder, Entry, HashMap, HashTable, RandomState};
66
use vortex_array::array::{
7-
BinaryView, ConstantArray, PrimitiveArray, SparseArray, VarBinArray, VarBinViewArray,
7+
BinaryView, ConstantArray, PrimitiveArray, VarBinArray, VarBinViewArray,
88
};
99
use vortex_array::validity::Validity;
1010
use vortex_array::variants::PrimitiveArrayTrait;
@@ -13,6 +13,7 @@ use vortex_buffer::{BufferMut, ByteBufferMut};
1313
use vortex_dtype::{match_each_native_ptype, DType, NativePType, Nullability, PType, ToBytes};
1414
use vortex_error::{vortex_bail, VortexExpect as _, VortexResult, VortexUnwrap};
1515
use vortex_scalar::Scalar;
16+
use vortex_sparse::SparseArray;
1617

1718
use crate::DictArray;
1819

encodings/fastlanes/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ vortex-dtype = { workspace = true }
3030
vortex-error = { workspace = true }
3131
vortex-mask = { workspace = true }
3232
vortex-scalar = { workspace = true }
33+
vortex-sparse = { workspace = true }
3334

3435
[dev-dependencies]
3536
criterion = { workspace = true }

encodings/fastlanes/src/for/compress.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use num_traits::{PrimInt, WrappingAdd, WrappingSub};
2-
use vortex_array::array::{ConstantArray, PrimitiveArray, SparseArray};
2+
use vortex_array::array::{ConstantArray, PrimitiveArray};
33
use vortex_array::stats::{trailing_zeros, ArrayStatistics, Stat};
44
use vortex_array::validity::LogicalValidity;
55
use vortex_array::variants::PrimitiveArrayTrait;
@@ -10,6 +10,7 @@ use vortex_dtype::{
1010
};
1111
use vortex_error::{vortex_bail, vortex_err, VortexExpect, VortexResult};
1212
use vortex_scalar::Scalar;
13+
use vortex_sparse::SparseArray;
1314

1415
use crate::FoRArray;
1516

encodings/sparse/Cargo.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "vortex-sparse"
3+
description = "Vortex Sparse array"
4+
version = { workspace = true }
5+
homepage = { workspace = true }
6+
repository = { workspace = true }
7+
authors = { workspace = true }
8+
license = { workspace = true }
9+
keywords = { workspace = true }
10+
include = { workspace = true }
11+
edition = { workspace = true }
12+
rust-version = { workspace = true }
13+
categories = { workspace = true }
14+
readme = { workspace = true }
15+
16+
[lints]
17+
workspace = true
18+
19+
[dependencies]
20+
itertools = { workspace = true }
21+
rkyv = { workspace = true }
22+
serde = { workspace = true, features = ["derive"] }
23+
vortex-array = { workspace = true }
24+
vortex-buffer = { workspace = true }
25+
vortex-dtype = { workspace = true }
26+
vortex-error = { workspace = true }
27+
vortex-mask = { workspace = true }
28+
vortex-scalar = { workspace = true }
29+
30+
[dev-dependencies]
31+
vortex-array = { workspace = true, features = ["test-harness"] }
32+
rstest = { workspace = true }

vortex-array/src/array/sparse/canonical.rs renamed to encodings/sparse/src/canonical.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
use arrow_buffer::{ArrowNativeType, BooleanBuffer};
1+
use vortex_array::array::{BoolArray, BooleanBuffer, ConstantArray, PrimitiveArray};
2+
use vortex_array::patches::Patches;
3+
use vortex_array::validity::Validity;
4+
use vortex_array::{ArrayDType, ArrayLen, Canonical, IntoCanonical};
25
use vortex_buffer::buffer;
36
use vortex_dtype::{match_each_native_ptype, DType, NativePType, Nullability, PType};
47
use vortex_error::{VortexError, VortexResult};
58
use vortex_scalar::Scalar;
69

7-
use crate::array::primitive::PrimitiveArray;
8-
use crate::array::sparse::SparseArray;
9-
use crate::array::{BoolArray, ConstantArray};
10-
use crate::patches::Patches;
11-
use crate::validity::Validity;
12-
use crate::{ArrayDType, ArrayLen, Canonical, IntoCanonical};
10+
use crate::SparseArray;
1311

1412
impl IntoCanonical for SparseArray {
1513
fn into_canonical(self) -> VortexResult<Canonical> {
@@ -59,7 +57,7 @@ fn canonicalize_sparse_bools(patches: Patches, fill_value: &Scalar) -> VortexRes
5957
}
6058

6159
fn canonicalize_sparse_primitives<
62-
T: NativePType + for<'a> TryFrom<&'a Scalar, Error = VortexError> + ArrowNativeType,
60+
T: NativePType + for<'a> TryFrom<&'a Scalar, Error = VortexError>,
6361
>(
6462
patches: Patches,
6563
fill_value: &Scalar,
@@ -84,17 +82,16 @@ fn canonicalize_sparse_primitives<
8482

8583
#[cfg(test)]
8684
mod test {
87-
use arrow_buffer::BooleanBufferBuilder;
8885
use rstest::rstest;
86+
use vortex_array::array::{BoolArray, BooleanBufferBuilder, PrimitiveArray};
87+
use vortex_array::validity::Validity;
88+
use vortex_array::{ArrayDType, IntoArrayData, IntoCanonical};
8989
use vortex_buffer::buffer;
9090
use vortex_dtype::{DType, Nullability, PType};
9191
use vortex_error::VortexExpect;
9292
use vortex_scalar::Scalar;
9393

94-
use crate::array::sparse::SparseArray;
95-
use crate::array::{BoolArray, PrimitiveArray};
96-
use crate::validity::Validity;
97-
use crate::{ArrayDType, IntoArrayData, IntoCanonical};
94+
use crate::SparseArray;
9895

9996
#[rstest]
10097
#[case(Some(true))]

vortex-array/src/array/sparse/compute/binary_numeric.rs renamed to encodings/sparse/src/compute/binary_numeric.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use vortex_array::array::ConstantArray;
2+
use vortex_array::compute::{binary_numeric, BinaryNumericFn};
3+
use vortex_array::{ArrayData, ArrayLen, IntoArrayData};
14
use vortex_error::{vortex_err, VortexResult};
25
use vortex_scalar::BinaryNumericOperator;
36

4-
use crate::array::{ConstantArray, SparseArray, SparseEncoding};
5-
use crate::compute::{binary_numeric, BinaryNumericFn};
6-
use crate::{ArrayData, ArrayLen as _, IntoArrayData};
7+
use crate::{SparseArray, SparseEncoding};
78

89
impl BinaryNumericFn<SparseArray> for SparseEncoding {
910
fn binary_numeric(

0 commit comments

Comments
 (0)